Managing Remote Servers with PowerShell

 

new

start how-to

powershell for WIN10 IoT  (Raspberry Pi 2)

set-item wsman:\localhost\client\trustedhosts *

restart-service winrm

Enter-PSSession -ConnectionURI http://xxx.xx.xxx.xx:5985

Enter-PSSession -ConnectionUri http://xxx.xx.xxx.xx:5985 -Credential user

You can skip the http:// stuff if you're using the default WinRM configuration and instead of:

Enter-PSSession -ConnectionURI http://xxx.xx.xxx.xx:5985

And you need to explicitly tell enter-pssession which user account on the remote machine will be used:

$Cred = Get-Credential "remotecomputername\username"

Enter-PSSession XXX.XX.XX.XX -Credential $Cred

Trust more remote machines:

winrm set winrm/config/client '@{TrustedHosts="machineA,machineB"}'

Set-Item WSMan:\localhost\Client\TrustedHosts -Value "machineA,machineB"

How can I get list about TrustedHosts (WSMan:\LocalHost\Client ) in local computer ?

Get-Item WSMan:\localhost\Client\TrustedHosts

How can I know if WinRM service is enabled in a computer ?

Get-Service -ComputerName server01 -Name winrm | Select Status

How can I know if WinRM is set up to receive request in a computer ?
One way to find is to see if the client ports are listed or not.

Get-ChildItem WSMan:\localhost\Client\DefaultPorts


How can I know if WinRM is set up for remote management on this machine?.
You should be able to list the listeners.

Get-ChildItem WSMan:\localhost\Listener


Get WinRM-Configuration

WinRM get winrm/config/client

Output:

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 = 192.168.xxx.xxx