To enable Winrm
Check that the service is running
PS C:\powershell> get-service winrm Status Name DisplayName ------ ---- ----------- Running winrm Windows Remote Management (WS-Manag...
if is is not running start it and set to automatic
PS C:\powershell> (get-service winrm).start() PS C:\powershell> set-service winrm -startuptype "Automatic"
Do quick config on winrm
PS C:\powershell> winrm quickconfig WinRM service is already running on this machine. WSManFault Message ProviderFault WSManFault Message = WinRM firewall exception will not work since one of the network connection types on this machine is set to Public. Change the network connection type to either Domain or Private and try again. Error number: -2144108183 0x80338169 WinRM firewall exception will not work since one of the network connection types on this machine is set to Public. Change the network connection type to either Domain or Private and try again.
If you have virtual machine software on your computer you will get the previous error -- then run the following code to set the adapters.
$nlm = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}")) $nlm.getnetworkconnections() | foreach { if ($_.getnetwork().getcategory() -eq 0) { $_.getnetwork().setcategory(1) } }
PS C:\powershell> winrm quickconfig WinRM service is already running on this machine. WinRM is not set up to allow remote access to this machine for management. The following changes must be made: Create a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine. Enable the WinRM firewall exception. Configure LocalAccountTokenFilterPolicy to grant administrative rights remotely to local users. < Make these changes [y/n]? y WinRM has been updated for remote management. Created a WinRM listener on HTTP://* to accept WS-Man requests to any IP on this machine. WinRM firewall exception enabled. Configured LocalAccountTokenFilterPolicy to grant administrative rights remotely to local users.
To add computers to the trusted hosts:
PS C:\powershell> winrm s winrm/config/client '@{TrustedHosts="10.21.1.3"}' 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 = 10.21.1.3