I have trouble with following piece of code:
$result = "F651F545A059588ABFDCE7EE3EEB27EED8CED28D"
winrm create winrm/config/Listener?Address=*+Transport=HTTPS '@{Hostname="my.host.winagent"; CertificateThumbprint="$result"}'
it yields:
Message = The WS-Management service cannot process the configuration request because the certificate thumbprint in the request is not a valid hex string: $result.
it looks like variable result is not being expanded, probably because it is inside array? How to get the variable value expanded there?
'and"."..."strings (double-quoted) perform string interpolation (expansion of variable values) in PowerShell, not'...'strings (single-quoted): see this answer for an overview of PowerShell's expandable strings (interpolating strings) and this answer for an overview of PowerShell string literals in general..ToString()stringification would then be passed (because an external program is being called), (uselessly) resulting in verbatimSystem.Collections.Hashtablegetting passed.cmd /c echo @{ foo = 1 }(Windows) and/bin/echo @{ foo = 1 }(Unix)