Permalink
Switch branches/tags
Nothing to show
Find file Copy path
ce02390 May 26, 2016
1 contributor

Users who have contributed to this file

580 lines (545 sloc) 22.7 KB
#------------------------------------------------------------------------
# Source File Information (DO NOT MODIFY)
# Source ID: a33f0f3b-dbbe-4c28-b992-c8c1b6224eb7
# Source File: RandomPasswordGenerator.psproj
#------------------------------------------------------------------------
#region Project Recovery Data (DO NOT MODIFY)
<#RecoveryData:
EAIAAB+LCAAAAAAABACNkl1LwzAUhu8H+w+l9136MXSDNBdubnihjjm8lZP2VCJpUpJU3b83ta10
COLlk5z3eckh9IiFfkdz3oIDNp8FAT0Y/YaF+waPz2is0Ioli4SSEYa7nZB4t2WQZVVcZTwqOcdo
WaSriK/XaVSsioRfpekS+TUlw/AQHVpO5wZZTMkUR7mWpa8LyLTNDjBgcMQKDaoCH6DGPAyDm1bI
Mg/jkD05MK5tFo21ffnf0Q1IGd2DUDtt6pfGVlPXeO5l1b9le6k5SK9KJqpgo+saVHn76VB1u8zD
k2kxZP209Q3JRUMP/bt/9tTToxGvQoHsBrpedvRiXR/A2g9tyj0qNOC08c7G5yj5FZjPKLn4AV+3
V6rrEAIAAA==#>
#endregion
<#
.NOTES
--------------------------------------------------------------------------------
Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2016 v5.2.120
Generated on: 2016-05-26 18:10
Generated by: ibelmans
--------------------------------------------------------------------------------
.DESCRIPTION
Script generated by PowerShell Studio 2016
#>
#region Source: Startup.pss
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
SwQAAB+LCAAAAAAABAC9lEtLAzEQgO+C/yH0vOzD7boWsgtS6UXQ4kr1mk1nS2geZZK07L93W0sV
PYiFhlwyEzIfH8MMfQFutoD9A3OMDBcrjK5GN6P6+ooQ+oxiJTSTMyHhiSmoG8fQ+U28sZYmv14P
f+6tBdVKAfYQf2X6WlluUIo2IosjaRyn+xORqZfOI1QavEMmIzL3Qw3+CP2rWYOu2rJkBS9us0k+
hvRuQpNT1Z+UprcOVAhG/Cb00uxsPDOobBDivk9hQMh2Qq/OYaV5V3Rll2XLImU5+5v1rmQYJ4HA
ncG+AdwKDme17N92U4MQRO9oNUczqF3A7RR+zjZNvi+P+gNBqg7+SwQAAA==#>
#endregion
#----------------------------------------------
#region Import Assemblies
#----------------------------------------------
[void][Reflection.Assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][Reflection.Assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][Reflection.Assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][Reflection.Assembly]::Load('System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][Reflection.Assembly]::Load('System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies
####################################################################################################
### Begin: Script information ######################################################################
####################################################################################################
<#
.SYNOPSIS
PowerShell GUI script to generate random passwords.
.DESCRIPTION
PowerShell GUI script to generate random passwords.
.NOTES
Author : Ingvald Belmans
Website : http://www.supersysadmin.com
Version : 1.0
Changelog:
- 1.0 (2016-05-26) Initial version.
.LINK
http://www.supersysadmin.com
#>
####################################################################################################
### End: Script information ########################################################################
####################################################################################################
####################################################################################################
### Begin: Main function ###########################################################################
####################################################################################################
#region function Main
function Main
{
<#
.SYNOPSIS
The Main function starts the project application.
.PARAMETER Commandline
$Commandline contains the complete argument string passed to the script packager executable.
.NOTES
Use this function to initialize your script and to call GUI forms.
.NOTES
To get the console output in the Packager (Forms Engine) use:
$ConsoleOutput (Type: System.Collections.ArrayList)
#>
Param
(
[String]$Commandline
)
if ((Call-MainForm_psf) -eq 'OK')
{
}
$global:ExitCode = 0 #Set the exit code for the Packager
}
#endregion
####################################################################################################
### End: Main function #############################################################################
####################################################################################################
#endregion Source: Startup.pss
#region Source: MainForm.psf
function Call-MainForm_psf
{
#region File Recovery Data (DO NOT MODIFY)
<#RecoveryData:
BSoAAB+LCAAAAAAABADtmm1P4zgQx9+fdN/ByukkTipt00cqleqgLKvVwi6iwK7uDXLTKfXhxpHj
AN1Pf3YeStskjdM2va20QkKEeDx/z/w8duJ0b8FiL8BnF1hgJP9wCbNPjZrR+/03hLpfOXkiNqaX
hMIXPIXeNSb2JePTsuOOu5XY7cBo+C9YAomZA6fGYOYKmJa/EXvEXt2ysg1+l1DSrRJ6CDU0ylX1
U0J9jwqPw6kNnuCYltCNN6TE+gyzO/YM9umw3cZNq9kyO/UGVE86BrKllFND9afkGsiaEDrisqnR
Z7bgjLrB8KTWG84c4GIW2vQpAVsMyA8weq1mo4RqrUa3EjVKMVJOrsH2BoITJ+pZNruFMUivFkTt
ojaBqkrUXWb/xCZTbxqqasuQ1Kv1TCuVD6MXBSGz+UBgLm6YS4QMvtHryzAAH1gcINv2Dt6E0bvF
Mo/TG+y6r4yPPoINHAvG0YtZrsa7+PAiPYT2VwyP3qU+qstuxW8Qtc5G6iNnnnPO3grHKnKkpH71
hOOJdYDFg3VmWxPGjd4dc0ronAnB5FS4grEooVvyNBGxUMW7uGIWDtJkdkzJ6ImGTYBDXLyGaQBe
oymDVqs1NQzu8PCTPYI3aaTXeiCYnDiXmLqgY+Djli4/G5ZbYk1UL/vgZcGXLjI7gSbeyaV0JGc2
s11GsRxix9Gze8etXUJmS8smwC1x7Fr2svIwSs8xd/3CYMFIJkQQC1M98wDZuhRcS6iV66GNV6t0
ChfuJxotljll0Z9g+wlGKaF5XGiyXAFV/wHX81Vj+TIb+nNPYmMXznvgRo2pzxzZVi6psuJgPspX
JhdqXF0msZ6UlGToUgVolzqzrapqEjbp0Gi19pFRqpBgSOkaauq6d+GBuB6mAzGjcI6t5z6jfkHg
XmLJXOROOrKe18Tl0W+wsuL+/HiFOwyIdhxb8VXdhK9VBYUCVtMGLJKFcujaLWCrgdkNYf/PFs9R
lLhbwbXh/izwnA8qs5Vvg2YWuEFL15+d6ys8BFp4on0vC7GWSy/Hlnzwycj3uoy3TnJuktJF5Njq
tNspBSXv7jx11cqnShmdUfIkA3JNRiMKarOahMJyFdBi44s3BU6se+eCvRa/4Cx52zUrEpVODlSy
teRAptlS615OZJJWoXj7B0w9VZESa9EGGe9PwHreR+X3HQ2X6u/AAYtgul2S60mRSMtyuogc2TXr
HZlezRm+dhebVhFCTejozxL6G/1RQuVy+S8t+9ybjQNDRk7T4QZ1we9JPRumhCHFYiDkTiukBpL2
ellwVreEMxxu4XDq1Z4AzlATOqoed35BqbJ0xV6B97ELB4Jle0sq5+MtnMukPXQal74qpGShI3z8
4xeaKlX3jnNQaDa2RHM+3sLRzPMq01cVonl2/M9e0Mz/EmB+iFY4qCvHdXme/z9JXcvgqv+sG9Yd
YzRwJr2qxsUNb0FWwiFlTIh/4ksovB9YBolT9xbSmvlS4H0GSdH6b9uWsqD9LiQ4u9U8fVozV5Jn
ylRqcpWmeOVfAnr5IpvtPUKQme2Uo94LeakePlcI/0n51qf7bMjUqVxlgehlwA99gB/eSPr4ND8m
SO08++sCf1YGx3GanxMk9HvA8ynga7Po+raaITarKsbxJ6XkGKf0nPBuf724+Pv9A06VP1M2y5Qy
1U1Us5YjUckd58mT6iErTWeuC1MZPHAjD+F/Zr2pazFOyXAHCehW5r2ueglSvg8fO8cq26P6wm4/
jjh+JfbTJr6q9XFz3B6b5qhZxXWc7ev7lO5nTIRLTBmfDYC/EAs2Slnu0fUZh70MLxyVnOByaAWM
bX4ZzO1uZfGzz95/pIxiVQUqAAA=#>
#endregion
#----------------------------------------------
#region Import the Assemblies
#----------------------------------------------
[void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Data, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
[void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][reflection.assembly]::Load('System.DirectoryServices, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][reflection.assembly]::Load('System.ServiceProcess, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
[void][reflection.assembly]::Load('System.Design, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
#endregion Import Assemblies
#----------------------------------------------
#region Generated Form Objects
#----------------------------------------------
[System.Windows.Forms.Application]::EnableVisualStyles()
$FormMain = New-Object 'System.Windows.Forms.Form'
$GroupBoxMainOutput = New-Object 'System.Windows.Forms.GroupBox'
$RichTextBoxMainOutput = New-Object 'System.Windows.Forms.RichTextBox'
$ButtonMainCopyToClipBoard = New-Object 'System.Windows.Forms.Button'
$ButtonMainGeneratePassword = New-Object 'System.Windows.Forms.Button'
$GroupBoxMainOptions = New-Object 'System.Windows.Forms.GroupBox'
$LabelMainOptionsCharacters = New-Object 'System.Windows.Forms.Label'
$NumericUpDownMainOptionsCharacters = New-Object 'System.Windows.Forms.NumericUpDown'
$CheckboxMainOptionsSpecial = New-Object 'System.Windows.Forms.CheckBox'
$CheckboxMainOptionsNumbers = New-Object 'System.Windows.Forms.CheckBox'
$CheckboxMainOptionsLowerCase = New-Object 'System.Windows.Forms.CheckBox'
$CheckboxMainOptionsUpperCase = New-Object 'System.Windows.Forms.CheckBox'
$MenuStripMain = New-Object 'System.Windows.Forms.MenuStrip'
$ToolStripMenuItemMainFile = New-Object 'System.Windows.Forms.ToolStripMenuItem'
$ToolStripMenuItemMainFileAbout = New-Object 'System.Windows.Forms.ToolStripMenuItem'
$ToolStripMenuItemMainFileExit = New-Object 'System.Windows.Forms.ToolStripMenuItem'
$InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
#endregion Generated Form Objects
#----------------------------------------------
# User Generated Script
#----------------------------------------------
####################################################################################################
### Begin: Main form ###############################################################################
####################################################################################################
$FormMain_Load =
{
}
$ToolStripMenuItemMainFileAbout_Click =
{
Start-Process -FilePath "http://supersysadmin.com/200/powershell-gui-script-generate-random-passwords"
}
$ToolStripMenuItemMainFileExit_Click =
{
$FormMain.Close()
}
$ButtonMainGeneratePassword_Click =
{
$NumericUpDownMainOptionsCharactersValue = $NumericUpDownMainOptionsCharacters.Text
if ($CheckboxMainOptionsUpperCase.Checked -eq $True)
{
$CheckboxMainOptionsUpperCaseStatus = $True
}
else
{
$CheckboxMainOptionsUpperCaseStatus = $False
}
if ($CheckboxMainOptionsLowerCase.Checked -eq $True)
{
$CheckboxMainOptionsLowerCaseStatus = $True
}
else
{
$CheckboxMainOptionsLowerCaseStatus = $False
}
if ($CheckboxMainOptionsNumbers.Checked -eq $True)
{
$CheckboxMainOptionsNumbersStatus = $True
}
else
{
$CheckboxMainOptionsNumbersStatus = $False
}
if ($CheckboxMainOptionsSpecial.Checked -eq $True)
{
$CheckboxMainOptionsSpecialStatus = $True
}
else
{
$CheckboxMainOptionsSpecialStatus = $False
}
$Global:NewPassword = New-SSARandomPassword -UpperCaseCharacters $CheckboxMainOptionsUpperCaseStatus -LowerCaseCharacters $CheckboxMainOptionsLowerCaseStatus -NumberCharacters $CheckboxMainOptionsNumbersStatus -SpecialCharacters $CheckboxMainOptionsSpecialStatus -CharacterCount $NumericUpDownMainOptionsCharactersValue
Add-SSAOutput -OutputText $NewPassword
}
$ButtonMainCopyToClipBoard_Click =
{
$NewPassword | Set-Clipboard
}
$RichTextBoxMainOutput_TextChanged =
{
$RichTextBoxMainOutput.SelectionStart = $RichTextBoxMainOutput.Text.Length
$RichTextBoxMainOutput.ScrollToCaret()
}
####################################################################################################
### End: Main form #################################################################################
####################################################################################################
# --End User Generated Script--
#----------------------------------------------
#region Generated Events
#----------------------------------------------
$Form_StateCorrection_Load=
{
#Correct the initial state of the form to prevent the .Net maximized form issue
$FormMain.WindowState = $InitialFormWindowState
}
$Form_StoreValues_Closing=
{
#Store the control values
$script:MainForm_RichTextBoxMainOutput = $RichTextBoxMainOutput.Text
$script:MainForm_NumericUpDownMainOptionsCharacters = $NumericUpDownMainOptionsCharacters.Value
$script:MainForm_CheckboxMainOptionsSpecial = $CheckboxMainOptionsSpecial.Checked
$script:MainForm_CheckboxMainOptionsNumbers = $CheckboxMainOptionsNumbers.Checked
$script:MainForm_CheckboxMainOptionsLowerCase = $CheckboxMainOptionsLowerCase.Checked
$script:MainForm_CheckboxMainOptionsUpperCase = $CheckboxMainOptionsUpperCase.Checked
}
$Form_Cleanup_FormClosed=
{
#Remove all event handlers from the controls
try
{
$RichTextBoxMainOutput.remove_TextChanged($RichTextBoxMainOutput_TextChanged)
$ButtonMainCopyToClipBoard.remove_Click($ButtonMainCopyToClipBoard_Click)
$ButtonMainGeneratePassword.remove_Click($ButtonMainGeneratePassword_Click)
$FormMain.remove_Load($FormMain_Load)
$ToolStripMenuItemMainFileAbout.remove_Click($ToolStripMenuItemMainFileAbout_Click)
$ToolStripMenuItemMainFileExit.remove_Click($ToolStripMenuItemMainFileExit_Click)
$FormMain.remove_Load($Form_StateCorrection_Load)
$FormMain.remove_Closing($Form_StoreValues_Closing)
$FormMain.remove_FormClosed($Form_Cleanup_FormClosed)
}
catch [Exception]
{ }
}
#endregion Generated Events
#----------------------------------------------
#region Generated Form Code
#----------------------------------------------
$FormMain.SuspendLayout()
$GroupBoxMainOutput.SuspendLayout()
$GroupBoxMainOptions.SuspendLayout()
$NumericUpDownMainOptionsCharacters.BeginInit()
$MenuStripMain.SuspendLayout()
#
# FormMain
#
$FormMain.Controls.Add($GroupBoxMainOutput)
$FormMain.Controls.Add($ButtonMainCopyToClipBoard)
$FormMain.Controls.Add($ButtonMainGeneratePassword)
$FormMain.Controls.Add($GroupBoxMainOptions)
$FormMain.Controls.Add($MenuStripMain)
$FormMain.ClientSize = '654, 264'
$FormMain.MainMenuStrip = $MenuStripMain
$FormMain.MinimumSize = '670, 303'
$FormMain.Name = 'FormMain'
$FormMain.StartPosition = 'CenterScreen'
$FormMain.Text = 'RandomPasswordGenerator v1.0'
$FormMain.add_Load($FormMain_Load)
#
# GroupBoxMainOutput
#
$GroupBoxMainOutput.Controls.Add($RichTextBoxMainOutput)
$GroupBoxMainOutput.Anchor = 'Top, Bottom, Left, Right'
$GroupBoxMainOutput.Location = '191, 28'
$GroupBoxMainOutput.Name = 'GroupBoxMainOutput'
$GroupBoxMainOutput.Size = '450, 225'
$GroupBoxMainOutput.TabIndex = 4
$GroupBoxMainOutput.TabStop = $False
$GroupBoxMainOutput.Text = 'Output'
#
# RichTextBoxMainOutput
#
$RichTextBoxMainOutput.Anchor = 'Top, Bottom, Left, Right'
$RichTextBoxMainOutput.Font = 'Consolas, 9pt'
$RichTextBoxMainOutput.Location = '7, 16'
$RichTextBoxMainOutput.Name = 'RichTextBoxMainOutput'
$RichTextBoxMainOutput.ScrollBars = 'ForcedVertical'
$RichTextBoxMainOutput.Size = '437, 203'
$RichTextBoxMainOutput.TabIndex = 0
$RichTextBoxMainOutput.Text = ''
$RichTextBoxMainOutput.add_TextChanged($RichTextBoxMainOutput_TextChanged)
#
# ButtonMainCopyToClipBoard
#
$ButtonMainCopyToClipBoard.Location = '13, 230'
$ButtonMainCopyToClipBoard.Name = 'ButtonMainCopyToClipBoard'
$ButtonMainCopyToClipBoard.Size = '171, 23'
$ButtonMainCopyToClipBoard.TabIndex = 3
$ButtonMainCopyToClipBoard.Text = 'Copy to Clipboard'
$ButtonMainCopyToClipBoard.UseVisualStyleBackColor = $True
$ButtonMainCopyToClipBoard.add_Click($ButtonMainCopyToClipBoard_Click)
#
# ButtonMainGeneratePassword
#
$ButtonMainGeneratePassword.Location = '13, 200'
$ButtonMainGeneratePassword.Name = 'ButtonMainGeneratePassword'
$ButtonMainGeneratePassword.Size = '171, 23'
$ButtonMainGeneratePassword.TabIndex = 2
$ButtonMainGeneratePassword.Text = 'Generate Password'
$ButtonMainGeneratePassword.UseVisualStyleBackColor = $True
$ButtonMainGeneratePassword.add_Click($ButtonMainGeneratePassword_Click)
#
# GroupBoxMainOptions
#
$GroupBoxMainOptions.Controls.Add($LabelMainOptionsCharacters)
$GroupBoxMainOptions.Controls.Add($NumericUpDownMainOptionsCharacters)
$GroupBoxMainOptions.Controls.Add($CheckboxMainOptionsSpecial)
$GroupBoxMainOptions.Controls.Add($CheckboxMainOptionsNumbers)
$GroupBoxMainOptions.Controls.Add($CheckboxMainOptionsLowerCase)
$GroupBoxMainOptions.Controls.Add($CheckboxMainOptionsUpperCase)
$GroupBoxMainOptions.Location = '13, 28'
$GroupBoxMainOptions.Name = 'GroupBoxMainOptions'
$GroupBoxMainOptions.Size = '171, 165'
$GroupBoxMainOptions.TabIndex = 1
$GroupBoxMainOptions.TabStop = $False
$GroupBoxMainOptions.Text = 'Options'
#
# LabelMainOptionsCharacters
#
$LabelMainOptionsCharacters.Location = '68, 16'
$LabelMainOptionsCharacters.Name = 'LabelMainOptionsCharacters'
$LabelMainOptionsCharacters.Size = '77, 23'
$LabelMainOptionsCharacters.TabIndex = 4
$LabelMainOptionsCharacters.Text = 'Characters'
$LabelMainOptionsCharacters.TextAlign = 'MiddleLeft'
#
# NumericUpDownMainOptionsCharacters
#
$NumericUpDownMainOptionsCharacters.Location = '6, 19'
$NumericUpDownMainOptionsCharacters.Name = 'NumericUpDownMainOptionsCharacters'
$NumericUpDownMainOptionsCharacters.Size = '56, 20'
$NumericUpDownMainOptionsCharacters.TabIndex = 2
$NumericUpDownMainOptionsCharacters.Value = 15
#
# CheckboxMainOptionsSpecial
#
$CheckboxMainOptionsSpecial.Location = '6, 135'
$CheckboxMainOptionsSpecial.Name = 'CheckboxMainOptionsSpecial'
$CheckboxMainOptionsSpecial.Size = '139, 24'
$CheckboxMainOptionsSpecial.TabIndex = 3
$CheckboxMainOptionsSpecial.Text = 'Special (%, @ #, ...)'
$CheckboxMainOptionsSpecial.UseVisualStyleBackColor = $True
#
# CheckboxMainOptionsNumbers
#
$CheckboxMainOptionsNumbers.Checked = $True
$CheckboxMainOptionsNumbers.CheckState = 'Checked'
$CheckboxMainOptionsNumbers.Location = '6, 105'
$CheckboxMainOptionsNumbers.Name = 'CheckboxMainOptionsNumbers'
$CheckboxMainOptionsNumbers.Size = '139, 24'
$CheckboxMainOptionsNumbers.TabIndex = 2
$CheckboxMainOptionsNumbers.Text = 'Numbers (0-9)'
$CheckboxMainOptionsNumbers.UseVisualStyleBackColor = $True
#
# CheckboxMainOptionsLowerCase
#
$CheckboxMainOptionsLowerCase.Checked = $True
$CheckboxMainOptionsLowerCase.CheckState = 'Checked'
$CheckboxMainOptionsLowerCase.Location = '6, 75'
$CheckboxMainOptionsLowerCase.Name = 'CheckboxMainOptionsLowerCase'
$CheckboxMainOptionsLowerCase.Size = '139, 24'
$CheckboxMainOptionsLowerCase.TabIndex = 1
$CheckboxMainOptionsLowerCase.Text = 'Lower Case (a-z)'
$CheckboxMainOptionsLowerCase.UseVisualStyleBackColor = $True
#
# CheckboxMainOptionsUpperCase
#
$CheckboxMainOptionsUpperCase.Checked = $True
$CheckboxMainOptionsUpperCase.CheckState = 'Checked'
$CheckboxMainOptionsUpperCase.Location = '6, 45'
$CheckboxMainOptionsUpperCase.Name = 'CheckboxMainOptionsUpperCase'
$CheckboxMainOptionsUpperCase.Size = '139, 24'
$CheckboxMainOptionsUpperCase.TabIndex = 0
$CheckboxMainOptionsUpperCase.Text = 'Upper Case (A-Z)'
$CheckboxMainOptionsUpperCase.UseVisualStyleBackColor = $True
#
# MenuStripMain
#
[void]$MenuStripMain.Items.Add($ToolStripMenuItemMainFile)
$MenuStripMain.Location = '0, 0'
$MenuStripMain.Name = 'MenuStripMain'
$MenuStripMain.Size = '654, 24'
$MenuStripMain.TabIndex = 0
$MenuStripMain.Text = 'menustrip1'
#
# ToolStripMenuItemMainFile
#
[void]$ToolStripMenuItemMainFile.DropDownItems.Add($ToolStripMenuItemMainFileAbout)
[void]$ToolStripMenuItemMainFile.DropDownItems.Add($ToolStripMenuItemMainFileExit)
$ToolStripMenuItemMainFile.Name = 'ToolStripMenuItemMainFile'
$ToolStripMenuItemMainFile.Size = '37, 20'
$ToolStripMenuItemMainFile.Text = 'File'
#
# ToolStripMenuItemMainFileAbout
#
$ToolStripMenuItemMainFileAbout.Name = 'ToolStripMenuItemMainFileAbout'
$ToolStripMenuItemMainFileAbout.Size = '107, 22'
$ToolStripMenuItemMainFileAbout.Text = 'About'
$ToolStripMenuItemMainFileAbout.add_Click($ToolStripMenuItemMainFileAbout_Click)
#
# ToolStripMenuItemMainFileExit
#
$ToolStripMenuItemMainFileExit.Name = 'ToolStripMenuItemMainFileExit'
$ToolStripMenuItemMainFileExit.Size = '152, 22'
$ToolStripMenuItemMainFileExit.Text = 'Exit'
$ToolStripMenuItemMainFileExit.add_Click($ToolStripMenuItemMainFileExit_Click)
$MenuStripMain.ResumeLayout()
$NumericUpDownMainOptionsCharacters.EndInit()
$GroupBoxMainOptions.ResumeLayout()
$GroupBoxMainOutput.ResumeLayout()
$FormMain.ResumeLayout()
#endregion Generated Form Code
#----------------------------------------------
#Save the initial state of the form
$InitialFormWindowState = $FormMain.WindowState
#Init the OnLoad event to correct the initial state of the form
$FormMain.add_Load($Form_StateCorrection_Load)
#Clean up the control events
$FormMain.add_FormClosed($Form_Cleanup_FormClosed)
#Store the control values when form is closing
$FormMain.add_Closing($Form_StoreValues_Closing)
#Show the Form
return $FormMain.ShowDialog()
}
#endregion Source: MainForm.psf
#region Source: Globals.ps1
####################################################################################################
### Begin: Custom functions ########################################################################
####################################################################################################
#region function New-SSARandomPassword
function New-SSARandomPassword
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory = $True)]
[bool]$UpperCaseCharacters,
[Parameter(Mandatory = $True)]
[bool]$LowerCaseCharacters,
[Parameter(Mandatory = $True)]
[bool]$NumberCharacters,
[Parameter(Mandatory = $True)]
[bool]$SpecialCharacters,
[Parameter(Mandatory = $True)]
[int]$CharacterCount
)
Begin
{
}
Process
{
if ($UpperCaseCharacters -eq $True)
{
$UpperCaseCharacterArray = @("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z")
}
else
{
$UpperCaseCharacterArray = @()
}
if ($LowerCaseCharacters -eq $True)
{
$LowerCaseCharacterArray = @("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z")
}
else
{
$LowerCaseCharacterArray = @()
}
if ($NumberCharacters -eq $True)
{
$NumberCharacterArray = @(0, 1, 2, 3, 4, 5, 6, 7, 8, 9)
}
else
{
$NumberCharacterArray = @()
}
if ($SpecialCharacters -eq $True)
{
$SpecialCharacterArray = @("&", "@", "#", "§", "!", "$", "*", "%", "?")
}
else
{
$SpecialCharacterArray = @()
}
$RandomPasswordArray = $UpperCaseCharacterArray + $LowerCaseCharacterArray + $NumberCharacterArray + $SpecialCharacterArray
$RandomPassword = $RandomPasswordArray | Get-Random -Count $CharacterCount
$RandomPassword -join "" | Write-Output
}
End
{
}
}
#endregion
#region function Add-SSAOutput
function Add-SSAOutput
{
[CmdletBinding()]
Param
(
[Parameter(Mandatory = $True)]
$OutputText
)
Begin
{
}
Process
{
$RichTextBoxMainOutput.Text += "$OutputText`n"
}
End
{
}
}
#endregion
####################################################################################################
### End: Custom functions ##########################################################################
####################################################################################################
#endregion Source: Globals.ps1
#Start the application
Main ($CommandLine)