I am trying to post a new topic with some Powershell code in it, but I get the following message when trying to preview my message. I don't have any external links in my question, just the script I have a question about.
Sorry. You need to have made a minimum of 5 posts before you can include external links in your posts.
Any suggestions?
Problem posting a problem
Forum rules
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Do not post any licensing information in this forum.
Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
Re: Problem posting a problem
Powershell Studio Version: 2020
Powershell version: 7 - 64 bit
I have a button that I want to generate a random password using the following code that will show the password in a textbox for the user to see. However, when I run the script I get the following error message: Unable to find type (periods would appear between each word) [System Web Security Membership]
$buttonGeneratePassword_Click={
#TODO: Place custom script here
add-type -AssemblyName System.Web -PassThru
$minLength = 15 ## characters
$maxLength = 25 ## characters
$length = Get-Random -Minimum $minLength -Maximum $maxLength
$nonAlphaChars = 5
$password = [System Web Security Membership]::GeneratePassword($length, $nonAlphaChars)
$txtbxPassword.Text = $password
}
Powershell version: 7 - 64 bit
I have a button that I want to generate a random password using the following code that will show the password in a textbox for the user to see. However, when I run the script I get the following error message: Unable to find type (periods would appear between each word) [System Web Security Membership]
$buttonGeneratePassword_Click={
#TODO: Place custom script here
add-type -AssemblyName System.Web -PassThru
$minLength = 15 ## characters
$maxLength = 25 ## characters
$length = Get-Random -Minimum $minLength -Maximum $maxLength
$nonAlphaChars = 5
$password = [System Web Security Membership]::GeneratePassword($length, $nonAlphaChars)
$txtbxPassword.Text = $password
}