During my lab time, I tried to add Windows Server 2012 to the “Server Manager” which I installed on my Windows 8 system for remote management purpose.
As it’s shown in above screenshots, it’s a simple process, it’s only needed to click on “Manage” button in the server manager window, then choosing the “Add Servers” item; new windows would be open which let user to select different method for adding servers, I selected DNS option and provided the server name, select that and pressed OK button. up to now everything is simple and straight forward, but if the client don’t know the remote server then it’ll generate some error like bellow image.
The error would be “WinRM Negotiate authentication error”, and if searching for it over internet, some article stated the reason as the remote server might not be listed in the “TrustedHosts” list.
In order to check the current “TrustedHosts” using bellow code might help; It’s possible to use just first portion of code (before first pipe) but it’ll bring some info which might not be needed so I tried to show only needed part.
[crayon]Get-Item WSMan:\localhost\Client\TrustedHosts | select name,value | format-list[/crayon]
Running above code in PowerShell should generate data like bellow image.
For adding target remote server, it’s needed to replace “Set” and “Get” word and provide two more parameters without any piping, like bellow
[crayon]Set-Item WSMan:\localhost\Client\TrustedHosts -Value “server1,server1.domain,server2,server2.domain” -Concatenate -Force[/crayon]
Above code would add remote servers to currently existed list, if “-Concatenate” parameter used, the whole existing list would be replaced by newly provided server list.
I used bellow line as shown in the image as well
[crayon]Set-Item WSMan:\localhost\Client\TrustedHosts -Value “dc,dc.poddcs.net” -Concatenate -Force[/crayon]
If above code entered in the normal (user mode) PowerShell Window, it will return an error of “Access is denied”, so run this code in the “Administrator” mode by right-clicking on the PowerShell icon and selecting “Run as Administrator”; after running this code, check the “TrustedHosts” list again as it should be changed containing current server names.
Now the remote server added in “TrustedHosts” list, it’s time to refresh the list on Server Manager or re-adding servers
Server(s) should be Online in the list, but if their “Authentication” information is not provided before or not same as user who running the Server Manager, “Access denied” message would be shown up. for solving this part, right-click on the server and select “Manage As …” option; this will bring new window for providing username and password for user with efficient access permission and by pressing enter button at the bottom of window, it’ll try to reconnect to remote server by new authentication information.