Playing with PowerShell Remoting

by Dec 21, 2017

If you’d like to test-drive PowerShell remoting, you need to enable it at least on the target machine (the one you’d like to visit). For this, you need local Administrator privileges on the target machine. Open PowerShell with Administrator privileges, and run the code below:

#requires -RunAsAdministrator

# manually enable PowerShell remoting
Enable-PSRemoting -SkipNetworkProfileCheck -Force

Next, from any other computer that has network access, run the “Ping” for PowerShell remoting to see whether you can reach the target:

# "ping" for PowerShell remoting
# tests anonymously whether you can reach the target
$IPorNameTargetComputer = 'place name or IP address here'
Test-WSMan $IPorNameTargetComputer

Test-WSMan returns text similar to the text below when the target computer responds. It does an anonymous test, so if it fails, you know there is an issue either with the firewall or the target computer configuration.

 
wsmid           : http://schemas.dmtf.org/wbem/wsman/identity/1/wsmanidentity.xsd
ProtocolVersion : http://schemas.dmtf.org/wbem/wsman/1/wsman.xsd
ProductVendor   : Microsoft Corporation
ProductVersion  : OS: 0.0.0 SP: 0.0 Stack: 3.0 
 

In our next tips, we’ll look at what you can do with PowerShell remoting, and how to execute scripts remotely.

Twitter This Tip! ReTweet this Tip!