
Ex1.LAB.COM computer
Active Directory Certificate Service is installed and configured as Enterprise root.
MMC--Certificates--Computer
Request a Domain Controller certificate
IIS Manager--Server certificate--Ex1.lab.com
Open PowerShell
Enable-PSRemoting -force
One.Lab.com computer
Open PowerShell
check if winrm service is running
get-service winrm
if not, run winrm quickconfig
$session=New-PSSession -ComputerName Ex1
Enter-PSSession $session
[ex1]: PS C:\Users\Administrator.EX1\Documents> Get-PSSnapin -Registered
Name : Microsoft.Exchange.Management.PowerShell.E2010
PSVersion : 1.0
Description : Admin Tasks for the Exchange Server
Name : Microsoft.Exchange.Management.PowerShell.Setup
PSVersion : 1.0
Description : Setup Tasks for the Exchange Server
Name : Microsoft.Exchange.Management.Powershell.Support
PSVersion : 1.0
Description : Support Tasks for the Exchange Server
Name : Windows.ServerBackup
PSVersion : 2.0
Description : This Windows PowerShell snap-in for Windows Server Backup contains cmdlets used to configure, run, and ma
nage backups.
Don't type CD \
If you do, it will go into the local powershell session. You could use cd ..
[ex1]: PS C:\Users\Administrator.EX1\Documents> Add-PSSnapin Microsoft.Exchange.Management.Powershell.e2010
[ex1]: PS C:\Users\Administrator.EX1\Documents>$s=$env:ExchangeInstallPath+"bin\RemoteExchange.ps1"
[ex1]: PS C:\Users\Administrator.EX1\Documents>&$s
[ex1]: PS C:\Users\Administrator.EX1\Documents>$t=$env:ExchangeInstallPath+"bin\connectFunctions.ps1"
[ex1]: PS C:\Users\Administrator.EX1\Documents>&$t
And then,
You could run the Exchange Management cmdlets from workstation without installing Exchange Management Shell.
To exit the PS session, exit-pssesion
$Session=New-PSsession -ConfigurationName Microsoft.Exchange -ConnectionURI http://ex1.lab.com/powershell/?SerializationLevel=Full -Authentication kerberos |
In domain environment, new-pssession -computerName ex1 will use Kerberos mechanism. As you see from the firewall settings, even though both HTTPS and HTTP are blocked, the workstation can still create the PowerShell remoting session to the server. But if "Windows Remote Management" is unchecked in the firewall, the workstation cannot create a PowerShell remoting session to the server.

Disjoin the computer ONE from the LAB domain

At Ex1.LAB.COM
Active Directory Certificate Service is installed and configured as Enterprise root.
Certificate Authority


Request a New Certificate for the CA and Export it to a file
Request a New Certificate for the Domain Controller
IS Manager--Server certificate--Ex1.lab.com
Bind the new Ex1.lab.com to https
Open PowerShell
Enable-PSRemoting -force
Enable Windows Authentication for PowerShell virtual directory

Windows Firewall Settings

winrm get winrm/config

Because the computer ONE is not a member of the domain, it must be explicitly trusted.
winrm s winrm/config/client '@{TrustedHosts="one"}'
Client
NetworkDelayms = 5000
URLPrefix = wsman
AllowUnencrypted = false
Auth
Basic = true
Digest = true
Kerberos = true
Negotiate = true
Certificate = true
CredSSP = false
DefaultPorts
HTTP = 5985
HTTPS = 5986
TrustedHosts = one
To trust all hosts:
winrm s winrm/config/client '@{TrustedHosts="*"}'
winrm e winrm/config/listener
Listener
Address = *
Transport = HTTP
Port = 5985
Hostname
Enabled = true
URLPrefix = wsman
CertificateThumbprint
ListeningOn = 127.0.0.1, 192.168.11.100, ::1
Listener
Address = *
Transport = HTTPS
Port = 5986
Hostname = ex1.lab.com
Enabled = true
URLPrefix = wsman
CertificateThumbprint = f7 b4 6d 54 33 48 35 75 34 51 2f 83 29 2f fe 2dc9 e8 c2 91
ListeningOn = 127.0.0.1, 192.168.11.100, ::1
The computer certificate for Ex1.lab.com has the CertificateThumbprint 28df8be4204c058bb75ef8566bed25eb3e4a33cf
To modify the Certificate Thumbprint
winrm s winrm/config/listener?address=*+transport=https '@{Port="5986";CertificateThumbprint="28df8be4204c058bb75ef8566bed25eb3e4a33cf"}'
At the standalone workstation: ONE
Start Windows PowerShell and initiate the New-PSSession cmdlet
New-PSSession -ComputerName ex1
[ex1] Connecting to remote server failed with the following error message : The WinRM client cannot process the request. If the authentication scheme is different from Kerberos, or if the client computer is not joined to a domain, then HTTPS transport must be used or the destination machine must be added to the TrustedHosts configuration setting. Use winrm.cmd to configure TrustedHosts. Note that computers in the TrustedHosts list might not be authenticated.
https://ex1.lab.com/owa
a security warning window about the certificate of Ex1 pops up. Click "View Certificate" button, click "Install" button and place the certificate in Trusted Root Certificate Authority store.
Test:
1:
PS C:\Users\Administrator> $s = New-PSSession ex1.lab.com -Credential lab\administrator -UseSSL
PS C:\Users\Administrator> icm $s {$env:computername}
PS C:\Users\Administrator> icm $s {Get-ExchangeServer}
2:
PS C:\Users\Administrator> $s=New-PSSession -ConnectionURI https://ex1.lab.com/powershell -Credential lab\administrator
-ConfigurationName Microsoft.Exchange
PS C:\Users\Administrator> icm $s {get-ExchangeServer}
PSComputerName : ex1.lab.com
RunspaceId : 49f5c3a4-208b-459a-a6f7-ed0dc0712584
PSShowComputerName : True
........
..............
3:
Enter-PSSession -ConnectionURI https://ex1.lab.com:5986/wsman -Credential lab\administrator
4:
Enter-PSSession ex1.lab.com -Credential lab\administrator -UseSSL
The examples 3 and 4 are the best.
| $Session=New-PSsession -ConfigurationName Microsoft.Exchange -ConnectionURI https://ex1.lab.com/powershell/?SerializationLevel=Full -Credential LAB\Administrator Import-PSSession $Session |