Why do I get Type Not Found when trying to use this class/method in PowerShell?
[System.Web.Security.Membership]::GeneratePassword()
Do I need to install a module or something to make use of it?
For those landing here who are using PowerShell Core, as per this link:
https://github.com/PowerShell/PowerShell/issues/5352
.NET Core does not support System.Web.dll
As such [System.Web.Security.Membership]::GeneratePassword()
will result in the same Type Not Found
error in PowerShell Core even with the add-type
fix above.
You'll have to roll your own password generator.
Load the assembly first:
add-type -AssemblyName System.Web
[System.Web.Security.Membership]::GeneratePassword(10,0)
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