The setting of Windows Remote Management (WinRM) is quite confusing. After some hard work, I finally set this function successfully. The following is the configuration process, I hope it helps.
Server side
start winrm service
On Powershell (as admin):
net start winrm
Or, on CMD (as admin):
winrm quickconfig
Note: If the user account is not the original "administrator" account, run the following in the CMD ( as admin ).
reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f
Check the winrm status in powershell:
Get-Service | findstr "WinRM"
start listener
Start remote management in powershell:
Enable-PSRemoting -Force
Use the following command to check winrm listening status in CMD:
winrm enumerate winrm/config/listener
Client side
start winrm service
Start winrm service (Powershell)
net start winrm
Check the service status (Powershell)
Get-Service | findstr "WinRM"
start remote management (Not Necessary, can skip)
Start remote management (Powershell)
Enable-PSRemoting -Force
add server to trust list (Necessary)
Set the server IP to trustlist:
Set-Item WSMan:\localhost\Client\TrustedHosts -Value "192.168.1.2"
Get-Item WSMan:\localhost\Client\TrustedHosts
connect to server (specify computer name if receiving error)
Connect to the server
Enter-PSSession x.x.x.x -Credential $X
or
Enter-PSSession x.x.x.x -Credential yourcomputername\yourusername
Note: computer name is important, you may receive connection error if computer name unspecified.
Reference
https://serverfault.com/questions/530903/enable-psremoting-on-windows-server-2008-r2-error
0 Comments