[System.Uri]::new('http://www.stackoverflow.com')
is failing with error message
[System.Uri] does not contain a method named 'new'
however I am able to find this method on another box. and runs fine.
How to find if there is difference between System object loaded under PowerShell
You need Powershell 5 or higher to use the .ctor of a .NET class. In older versions of Powershell you'll have to use New-Object to do this.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With