Remote PowerShell to Exchange 2013

Please refer to the following PowerShell Script to connect to Exchange 2013 Server from Internet – Tested working with Microsoft Internal CA Server with Only Port 443 open in External Firewall 

First, you will need to enable the PowerShell Remoting in Exchange 2013 Server, and configure the Basic Authentication for PowerShell Virtual Directory

I would like to keep all my client Password (if they provided to me for Remote Support) in encrypted file, and prepared Remote Access PowerShell Script for each client. It is easy for me to login when they called, and I need to support remotely.

#Enable PowerShell Remote on the Exchange 2013 Server
Enable-PSRemoting -Force

#Enable the Basic Authentication & External URL for PowerShell Virtual Directory
Get-PowerShellVirtualDirectory -Server EX01 | Set-PowerShellVirtualDirectory -BasicAuthentication $true -ExternalUrl

#Remote PowerShell for Exchange 2013

#Run the following to convert the password to secure string and store it in file (Run 1 time to generate the password file only)
#"P@ssw0rd" | ConvertTo-SecureString -AsPlainText -Force |ConvertFrom-SecureString | Out-File "C:\PowerShell\PASSWORD.txt"

$PasswordFile = "C:\PowerShell\PASSWORD.txt"
$Cred=New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $User, (Get-Content $PasswordFile | ConvertTo-SecureString)

#Since My Customer are using Internal CA, we need to specify the following to skip the CA Check 
$PSSessionOption =New-PSSessionOption -SkipRevocationCheck -SkipCACheck

$ExchangeURL = ""

#Connect to Exchange 2013 Server via Internet
$Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri $ExchangeURL -Credential $Cred -Authentication Basic -AllowRedirection -SessionOption $PSSessionOption

Import-PSSession $Session

Share This