Partager via


Powershell and IPv6

If you have code like below and you pass IPv6 address for the parameter remoteNode, surprisely it won't work. Then then you go to powershell cmd and try to use new-pssession with ipv6, surprisely it works!

WSManConnectionInfo connInfo = new WSManConnectionInfo(false, remoteNode, 0, null, null, credential);
runspace = RunspaceFactory.CreateRunspace(connInfo);
runspace.Open();

You might wonder why there is such weird and inconsistent behavior. Well, it is just a bug of powershell. The magic is passing "wsman" the highlighted paramter.

The article is based on my dev buddy's investigation. He is famous as yongwei in case you don't know:-)