Search code examples
powershellclasspasswords

[System.Web.Security.Membership]::GeneratePassword() - Type Not found


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?


Solution

  • Load the assembly first:

    add-type -AssemblyName System.Web
    [System.Web.Security.Membership]::GeneratePassword(10,0)