[System.Uri]::new('http://www.stackoverflow.com')
失败了错误消息
[system.uri]不包含名为" new"'''''的方法
但是,我能够在另一个盒子上找到此方法。并运行良好。
如何查找在PowerShell下加载的系统对象之间是否存在差异
您需要5或更高的PowerShell才能使用.NET类的.ctor。在PowerShell的较旧版本中,您必须使用New-Object进行此操作。