There are many ways how cmdlets can get remote information from another computer. Here are just a few:

# try and connect to this computer
# (adjust it to a valid name in your network)
$destinationServer = "SERVER12"

# PowerShell remoting
$result1 = Invoke-Command { Get-Service } -ComputerName $destinationServer

# built-in
$result2 = Get-Service -ComputerName $destinationServer
$result3 = Get-Process -ComputerName $destinationServer

Most likely, remote access won’t work by default. First of all, for many remoting techniques you need to have Administrator privileges on the target side. But even if you do, by default remoting is disabled on a client OS.

If you’d like to open up the most commonly used remoting techniques on a test machine, run these lines from a PowerShell with elevated privileges:

netsh firewall set service remoteadmin enable
Enable-PSRemoting -SkipNetworkProfileCheck -Force

The first command, although deprecated, still works like a charm and adds the admin remote exception to your firewall, enabling DCOM-based remoting. The second line enables PowerShell remoting.

Twitter This Tip! ReTweet this Tip!