-
-
Save vincent1890/b1563eacd7e760b6c45d94026b104ba6 to your computer and use it in GitHub Desktop.
create\remove PSSession to Exchange server
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$q=Read-Host -Prompt "connect\disconnect" | |
switch ($q) { | |
{$q -eq "connect"} {$fqdn=Read-Host -Prompt "Enter FQDN" | |
$UserCredential = Get-Credential | |
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri http://"$fqdn"/PowerShell/ -Authentication Kerberos -Credential $UserCredential | |
Import-PSSession $Session -DisableNameChecking} | |
{$q -eq "disconnect"} {Remove-PSSession $Session} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment