What is the difference between PowerShell and cmd.exe command syntax?
@{}
defines a hashtable in PowerShell, but winrm
expects a string argument. Put that argument in quotes if you want to run the command directly in PowerShell:
winrm s winrm/config/service '@{AllowUnencrypted="true"; MaxConcurrentOperationsPerUser="4294967295"}'
Also, you need admin privileges for this to work.
Or use the special --%
parameter which lets PowerShell stop parsing the parameters.
winrm --% s winrm/config/service @{AllowUnencrypted="true";MaxConcurrentOperationsPerUser="4294967295"}
You can prefix your command with cmd /c and quote it like:
cmd /c "winrm s winrm/config/service @{AllowUnencrypted=`"true`";MaxConcurrentOperationsPerUser=`"4294967295`"}"
PowerShell will execute executables that exist in the system.