Home

1

ADFSAccount DC:

Open PowerShell

Enable-PSRemoting -force

Check the Winrm service is running

Get-Service winrm

Check the Winrm listening port

Winrm eumerate winrm/config/listener

address = *
Transport= http
Port=5985

 


Workstation: Postbox

Open PowerShell

check if winrm service is running

get-service winrm

if not, run winrm quickconfig

Enter-PSSession -ComputerName ADFSAccount

Change the location:

Set-Location C:\

To remotely manage the Exchange 2010:

Set-ExecutionPolicy unrestricted

$session=New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionURI http://adfsaccount.adatum.com/PowerShell

Import-PSsession $session

To remove the PSSession:

Remove-PSSession $session


2

ADFSAccount domain controller:

Enable-PSRemoting -force


Postbox:

set-service -name winrm -startuptype automatic -status running

Because the workstation is not a member of the domain, the workstation must trust the ADFSAccount computer explicitly.

The "*" means all hosts.

The following command must be executed at postbox workstation.

winrm set winrm/config/client '@{TrustedHosts="*"}'

$credential=get-credential

Enter-PSSession -ComputerName ADFSAccount -credential $credential

To manage Exchange 2010:

Set-ExecutionPolicy unrestricted

$credential=get-credential

Enter-PSSession -ComputerName ADFSAccount -credential $credential

$session=New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionURI http://adresource/powershell -Credential $credential -Authentication Kerberos

Import-PSSession $session

Remove-PSSession $session

Another method:

PS C:\Users\Administrator> Enter-PSSession -ComputerName ADFSAccount -credential $credential

[adfsaccount]: PS C:\Users\Administrator\Documents>Add-PSSnapin Microsoft.Exchange.Management.PowerShell.E2010

[adfsaccount]: PS C:\Users\Administrator\Documents>$s=$env:ExchangeInstallPath+"bin\RemoteExchange.ps1"

[adfsaccount]: PS C:\Users\Administrator\Documents>&$s

[adfsaccount]: PS C:\Users\Administrator\Documents>$t=$env:ExchangeInstallPath+"bin\connectFunctions.ps1"

[adfsaccount]: PS C:\Users\Administrator\Documents>&$t

The & (ampersand operator) is a CALL operator.


Create the https listener:

winrm create winrm/config/listener?Address=*+Transport=https

The https port will be 5986.

Change the listening port:

winrm s winrm/config/listener?address=*+transport=http '@{Port="80"}'

The parameter Port is case-sensitive.

Check all the configuation of Winrm:

winrm get winrm/config