Connect-ExchangeOnPremise.ps1


<#PSScriptInfo
 
.VERSION 1.0
 
.GUID 513f5adc-84a4-471f-be9d-f2407695b8ec
 
.AUTHOR nicolo.guerra
 
.COMPANYNAME
 
.COPYRIGHT
 
.TAGS
 
.LICENSEURI
 
.PROJECTURI
 
.ICONURI
 
.EXTERNALMODULEDEPENDENCIES
 
.REQUIREDSCRIPTS
 
.EXTERNALSCRIPTDEPENDENCIES
 
.RELEASENOTES
 
 
.PRIVATEDATA
 
#>


<#
 
.DESCRIPTION
 Connect to an Exchange On Premise
 
#>
 

Param()



$FQDN = Read-Host "Exchange FQDN"
$UserCredential = Get-Credential

$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri "http://$FQDN/PowerShell/" -Authentication Kerberos -Credential $UserCredential

If ($null -ne $Session){
    Import-PSSession $Session -DisableNameChecking -Prefix "SRC"
}