As part of my investigation into Microsoft’s new Nano Server I hit an unusual WinRM error that had me going round in circles for quite a while. I finally figured out what the issue was and decided to post this so that the next person running into this will be able to move past this problem faster than I did.

In managing Nano Server, you need to add the server as a trusted host on a Management Server’s Server Manager Console. Nano Server does not have a graphical user interface so to manage it via Server Manager or Powershell you need to connect to it via WinRM and add it as a trusted host.

The command to add a Nano Server as a trusted host via the command line is:
winrm set winrm/config/client @{ TrustedHosts=”<IP of Nano Server>” }

When I ran that command I kept getting the following error:
Syntax Error: input must be of the form {KEY=”VALUE”[;KEY=”VALUE”]}

After many attempts I decided to retype the command rather than copy and paste it from the notes I had taken. The command worked then which piqued my interest as to what had actually caused the error in the first place as the command was exactly the same.

It turns out the command was not ‘exactly’ the same. The quotation marks that I copied and pasted were not the same as the ones I used in the command line. I copied and pasted both commands into Notepad where I could clearly see the difference.

I hope this quick posts helps someone out there who runs into the same issue.

5 Comments

  1. sunil katke

    Thanks It worked as you told. Great Post

  2. Chris Lazari

    You are most welcome Sunil

  3. Joe

    Thank you! Huge help!!

  4. Jaco du Plessis

    OMG! It worked! Thanks a lot! 🙂

  5. Surendhar Ponnusamy

    Hi, I’m trying to run this command from linux terminal. The target machine is the windows machine.But getting the syntax err.

    az vm run-command invoke -g rgname -n vmname –command-id RunPowerShellScript –scripts “winrm set winrm/config/service ‘@{AllowUnencrypted=”true”}'”

Comments are closed.