PowerShell – Enable WinRM

Not recommended for production computers but this will get the WinRM working on a development computer.

Enable-PSRemoting -Force

Set-WSManQuickConfig -SkipNetworkProfileCheck

winrm set winrm/config/client/auth '@{Basic="true"}'
winrm set winrm/config/service/auth '@{Basic="true"}'
winrm set winrm/config/service '@{AllowUnencrypted="true"}'

Set-Item wsman:\localhost\client\trustedhosts *

Winrm enumerate winrm/config/listener

Restart-Service WinRM

New-NetFirewallRule -DisplayName "Windows Remote Management (HTTPS-In)" -Name "Windows Remote Management (HTTPS-In)" -Profile Any -LocalPort 5986 -Protocol TCP
New-NetFirewallRule -DisplayName "RemotePowerShell" -Direction Inbound –LocalPort 5985-5986 -Protocol TCP -Action Allow

Test-WSMan 10.40.20.174

Invoke-Command -ComputerName 10.40.20.174 -ScriptBlock { Get-ChildItem C:\ } -credential dkittell

If you can’t connect due to access denied try this

reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.