#------------------------------------------------------------------------ # Source File Information (DO NOT MODIFY) # Source ID: 0e06dde8-f772-4774-9abc-25f43e38060d # Source File: EPIC_v1.3.psf #------------------------------------------------------------------------ #region File Recovery Data (DO NOT MODIFY) <#RecoveryData: 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 CXVI+RVtfg2RPz+Lv+569H/7zy0X/XoAAA==#> #endregion <# .NOTES -------------------------------------------------------------------------------- Code generated by: SAPIEN Technologies, Inc., PowerShell Studio 2017 v5.4.145 Generated on: 02/11/2017 22:40 Generated by: supersean -------------------------------------------------------------------------------- .DESCRIPTION GUI script generated by PowerShell Studio 2017 #> #---------------------------------------------- #region Application Functions #---------------------------------------------- #endregion Application Functions #---------------------------------------------- # Generated Form Function #---------------------------------------------- function Show-EPIC_v1_3_psf { #---------------------------------------------- #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') #endregion Import Assemblies #---------------------------------------------- #region Define SAPIEN Types #---------------------------------------------- try{ [ProgressBarOverlay] | Out-Null } catch { Add-Type -ReferencedAssemblies ('System.Windows.Forms', 'System.Drawing') -TypeDefinition @" using System; using System.Windows.Forms; using System.Drawing; namespace SAPIENTypes { public class ProgressBarOverlay : System.Windows.Forms.ProgressBar { public ProgressBarOverlay() : base() { SetStyle(ControlStyles.OptimizedDoubleBuffer | ControlStyles.AllPaintingInWmPaint, true); } protected override void WndProc(ref Message m) { base.WndProc(ref m); if (m.Msg == 0x000F)// WM_PAINT { if (Style != System.Windows.Forms.ProgressBarStyle.Marquee || !string.IsNullOrEmpty(this.Text)) { using (Graphics g = this.CreateGraphics()) { using (StringFormat stringFormat = new StringFormat(StringFormatFlags.NoWrap)) { stringFormat.Alignment = StringAlignment.Center; stringFormat.LineAlignment = StringAlignment.Center; if (!string.IsNullOrEmpty(this.Text)) g.DrawString(this.Text, this.Font, Brushes.Black, this.ClientRectangle, stringFormat); else { int percent = (int)(((double)Value / (double)Maximum) * 100); g.DrawString(percent.ToString() + "%", this.Font, Brushes.Black, this.ClientRectangle, stringFormat); } } } } } } public string TextOverlay { get { return base.Text; } set { base.Text = value; Invalidate(); } } } } "@ -IgnoreWarnings | Out-Null } #endregion Define SAPIEN Types #---------------------------------------------- #region Generated Form Objects #---------------------------------------------- [System.Windows.Forms.Application]::EnableVisualStyles() $formEPIC = New-Object 'System.Windows.Forms.Form' $buttonCancel = New-Object 'System.Windows.Forms.Button' $buttonBack = New-Object 'System.Windows.Forms.Button' $buttonFinish = New-Object 'System.Windows.Forms.Button' $tabcontrolWizard = New-Object 'System.Windows.Forms.TabControl' $tabpageStep1 = New-Object 'System.Windows.Forms.TabPage' $richtextboxStatusTab1 = New-Object 'System.Windows.Forms.RichTextBox' $groupboxPrinterInfo = New-Object 'System.Windows.Forms.GroupBox' $checkboxAlsoCreateFAX = New-Object 'System.Windows.Forms.CheckBox' $checkboxEnterIPManualy = New-Object 'System.Windows.Forms.CheckBox' $groupboxMoreInfo = New-Object 'System.Windows.Forms.GroupBox' $buttonContinueScan = New-Object 'System.Windows.Forms.Button' $textboxPrinterIPValue = New-Object 'System.Windows.Forms.TextBox' $labelPrinterIP = New-Object 'System.Windows.Forms.Label' $labelPortName = New-Object 'System.Windows.Forms.Label' $labelPrinterNameCustom = New-Object 'System.Windows.Forms.Label' $labelPrinterName = New-Object 'System.Windows.Forms.Label' $labelPortNameCustom = New-Object 'System.Windows.Forms.Label' $comboboxCompany = New-Object 'System.Windows.Forms.ComboBox' $labelSelectCompany = New-Object 'System.Windows.Forms.Label' $textboxMACAddress = New-Object 'System.Windows.Forms.TextBox' $labelEnterMACAddress = New-Object 'System.Windows.Forms.Label' $tabpageStep2 = New-Object 'System.Windows.Forms.TabPage' $richtextboxStatusTab2 = New-Object 'System.Windows.Forms.RichTextBox' $groupboxPrinterConfig = New-Object 'System.Windows.Forms.GroupBox' $labelFAXDriver = New-Object 'System.Windows.Forms.Label' $comboboxFaxDriver = New-Object 'System.Windows.Forms.ComboBox' $textboxPrinterComment = New-Object 'System.Windows.Forms.TextBox' $textboxPrinterLocation = New-Object 'System.Windows.Forms.TextBox' $labelPrinterComment = New-Object 'System.Windows.Forms.Label' $labelPrinterLocation = New-Object 'System.Windows.Forms.Label' $labelPrinterDriver = New-Object 'System.Windows.Forms.Label' $comboboxPrinterDriver = New-Object 'System.Windows.Forms.ComboBox' $tabpageStep3 = New-Object 'System.Windows.Forms.TabPage' $richtextboxStatusTab3 = New-Object 'System.Windows.Forms.RichTextBox' $groupboxMembers = New-Object 'System.Windows.Forms.GroupBox' $textboxMembers = New-Object 'System.Windows.Forms.TextBox' $buttonMembersRemove = New-Object 'System.Windows.Forms.Button' $buttonMembersAdd = New-Object 'System.Windows.Forms.Button' $listboxMembers = New-Object 'System.Windows.Forms.ListBox' $tabpageStep4 = New-Object 'System.Windows.Forms.TabPage' $richtextboxStatusTab4 = New-Object 'System.Windows.Forms.RichTextBox' $groupboxConfirmJobs = New-Object 'System.Windows.Forms.GroupBox' $progressbaroverlay3 = New-Object 'SAPIENTypes.ProgressBarOverlay' $buttonRun = New-Object 'System.Windows.Forms.Button' $checkboxConfirmAllJobs = New-Object 'System.Windows.Forms.CheckBox' $checkedlistboxJobs = New-Object 'System.Windows.Forms.CheckedListBox' $buttonNext = New-Object 'System.Windows.Forms.Button' $InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState' #endregion Generated Form Objects #---------------------------------------------- # User Generated Script #---------------------------------------------- #------------------------------------------------------- # NOTE: When new TabPage added place the validation code # in the Validate-WizardPage function. #------------------------------------------------------- function Validate-WizardPage { <# Add TabPages and place the validation code in this function #> [OutputType([boolean])] param([System.Windows.Forms.TabPage]$tabPage) if($tabPage -eq $tabpageStep1) { #TODO: Enter Validation Code here for Step 1 if (($labelPrinterIP.Text) -and ($script:IPTestsSuccess -eq $true)) { return $true } return $false } elseif ($tabPage -eq $tabpageStep2) { #TODO: Enter Validation Code here for Step 2 if(($comboboxPrinterDriver.Text) -and ($textboxPrinterLocation.Text) -and ($textboxPrinterComment.text)) { return $true } return $false } elseif ($tabPage -eq $tabpageStep3) { #TODO: Enter Validation Code here for Step 3 if($listboxMembers.Items.Count -ge 1) { return $true } } elseif ($tabPage -eq $tabpageStep4) { #TODO: Enter Validation Code here for Step 3 if ($progressbaroverlay3.Maximum -eq $progressbaroverlay3.Value) { return $true } } #Add more pages here return $false } $buttonFinish_Click={ #------------------------------------------------------- # TODO: Place finalization script here #------------------------------------------------------- } #region Events and Functions $formEPIC_Load={ $inilocation = ".\epic_conf.ini" $script:ini = Get-IniContent $inilocation $richtextboxStatusTab1.Text += Get-IniContent $inilocation | Out-String for ($i = 0; $i -lt $script:ini["company"].count; $i++) { $richtextboxStatusTab1.Text += "Reading INI... found company: " + $script:ini["company"]["company$($i)"] | Out-String $richtextboxStatusTab1.Text += "SERVER: " + $script:ini["setup"]["servername"] Load-ComboBox $comboboxCompany $script:ini["company"]["company$($i)"] -Append } Import-Module ActiveDirectory Update-NavButtons $PrinterIP = "NO IP YET" $labelPortNameCustom.Text = "$PrinterIP" Load-ComboBox $comboboxPrinterDriver (Get-PrinterDriver -ComputerName $script:ini["setup"]["servername"] | where {$_.PrinterEnvironment -eq "Windows x64" -and $_.Name -notmatch "fax"} | select name -ExpandProperty name ) Load-ComboBox $comboboxFaxDriver (Get-PrinterDriver -ComputerName $script:ini["setup"]["servername"] | where {$_.Name -match "fax" -and $_.PrinterEnvironment -eq "Windows x64"} | select name -ExpandProperty name) $userrecords = (Get-ADUser -Filter * -SearchBase $script:ini["setup"]["searchbase1"]).samaccountname foreach ($user in $userrecords) { $textboxMembers.AutoCompleteCustomSource.AddRange($user) } $userrecordsMM = (Get-ADUser -Filter * -SearchBase $script:ini["setup"]["searchbase2"]).samaccountname foreach ($user in $userrecordsMM) { $textboxMembers.AutoCompleteCustomSource.AddRange($user) } } function Update-NavButtons { <# .DESCRIPTION Validates the current tab and Updates the Next, Prev and Finish buttons. #> $enabled = Validate-WizardPage $tabcontrolWizard.SelectedTab $buttonNext.Enabled = $enabled -and ($tabcontrolWizard.SelectedIndex -lt $tabcontrolWizard.TabCount - 1) $buttonBack.Enabled = $tabcontrolWizard.SelectedIndex -gt 0 $buttonFinish.Enabled = $enabled -and ($tabcontrolWizard.SelectedIndex -eq $tabcontrolWizard.TabCount - 1) #Uncomment to Hide Buttons #$buttonNext.Visible = ($tabcontrolWizard.SelectedIndex -lt $tabcontrolWizard.TabCount - 1) #$buttonFinish.Visible = ($tabcontrolWizard.SelectedIndex -eq $tabcontrolWizard.TabCount - 1) } $script:DeselectedIndex = -1 $tabcontrolWizard_Deselecting=[System.Windows.Forms.TabControlCancelEventHandler]{ #Event Argument: $_ = [System.Windows.Forms.TabControlCancelEventArgs] # Store the previous tab index $script:DeselectedIndex = $_.TabPageIndex } $tabcontrolWizard_Selecting=[System.Windows.Forms.TabControlCancelEventHandler]{ #Event Argument: $_ = [System.Windows.Forms.TabControlCancelEventArgs] # We only validate if we are moving to the Next TabPage. # Users can move back without validating if($script:DeselectedIndex -ne -1 -and $script:DeselectedIndex -lt $_.TabPageIndex) { #Validate each page until we reach the one we want for($index = $script:DeselectedIndex; $index -lt $_.TabPageIndex; $index++) { $_.Cancel = -not (Validate-WizardPage $tabcontrolWizard.TabPages[$index]) if($_.Cancel) { # Cancel and Return if validation failed. return; } } } Update-NavButtons } $buttonBack_Click={ #Go to the previous tab page if($tabcontrolWizard.SelectedIndex -gt 0) { $tabcontrolWizard.SelectedIndex-- } } $buttonNext_Click={ #Go to the next tab page if($tabcontrolWizard.SelectedIndex -lt $tabcontrolWizard.TabCount - 1) { $tabcontrolWizard.SelectedIndex++ } } #endregion #------------------------------------------------------ # NOTE: When a Control State changes you should call # Update-NavButtons to trigger validation #------------------------------------------------------ $textboxMACAddress_TextChanged={ Update-NavButtons } $checkboxCheckToContinue_CheckedChanged={ Update-NavButtons } $radiobuttonOption_CheckedChanged={ if($this.Checked) { Update-NavButtons } } #region Control Helper Functions function Load-ListBox { <# .SYNOPSIS This functions helps you load items into a ListBox or CheckedListBox. .DESCRIPTION Use this function to dynamically load items into the ListBox control. .PARAMETER ListBox The ListBox control you want to add items to. .PARAMETER Items The object or objects you wish to load into the ListBox's Items collection. .PARAMETER DisplayMember Indicates the property to display for the items in this control. .PARAMETER Append Adds the item(s) to the ListBox without clearing the Items collection. .EXAMPLE Load-ListBox $ListBox1 "Red", "White", "Blue" .EXAMPLE Load-ListBox $listBox1 "Red" -Append Load-ListBox $listBox1 "White" -Append Load-ListBox $listBox1 "Blue" -Append .EXAMPLE Load-ListBox $listBox1 (Get-Process) "ProcessName" #> Param ( [ValidateNotNull()] [Parameter(Mandatory=$true)] [System.Windows.Forms.ListBox]$ListBox, [ValidateNotNull()] [Parameter(Mandatory=$true)] $Items, [Parameter(Mandatory=$false)] [string]$DisplayMember, [switch]$Append ) if(-not $Append) { $listBox.Items.Clear() } if($Items -is [System.Windows.Forms.ListBox+ObjectCollection]) { $listBox.Items.AddRange($Items) } elseif ($Items -is [Array]) { $listBox.BeginUpdate() foreach($obj in $Items) { $listBox.Items.Add($obj) } $listBox.EndUpdate() } else { $listBox.Items.Add($Items) } $listBox.DisplayMember = $DisplayMember } function Load-ComboBox { <# .SYNOPSIS This functions helps you load items into a ComboBox. .DESCRIPTION Use this function to dynamically load items into the ComboBox control. .PARAMETER ComboBox The ComboBox control you want to add items to. .PARAMETER Items The object or objects you wish to load into the ComboBox's Items collection. .PARAMETER DisplayMember Indicates the property to display for the items in this control. .PARAMETER Append Adds the item(s) to the ComboBox without clearing the Items collection. .EXAMPLE Load-ComboBox $combobox1 "Red", "White", "Blue" .EXAMPLE Load-ComboBox $combobox1 "Red" -Append Load-ComboBox $combobox1 "White" -Append Load-ComboBox $combobox1 "Blue" -Append .EXAMPLE Load-ComboBox $combobox1 (Get-Process) "ProcessName" #> Param ( [ValidateNotNull()] [Parameter(Mandatory=$true)] [System.Windows.Forms.ComboBox]$ComboBox, [ValidateNotNull()] [Parameter(Mandatory=$true)] $Items, [Parameter(Mandatory=$false)] [string]$DisplayMember, [switch]$Append ) if(-not $Append) { $ComboBox.Items.Clear() } if($Items -is [Object[]]) { $ComboBox.Items.AddRange($Items) } elseif ($Items -is [Array]) { $ComboBox.BeginUpdate() foreach($obj in $Items) { $ComboBox.Items.Add($obj) } $ComboBox.EndUpdate() } else { $ComboBox.Items.Add($Items) } $ComboBox.DisplayMember = $DisplayMember } # this function should clear the first tab. function ClearTab1 { $labelPortNameCustom.Text = "" $labelPrinterNameCustom.Text = "" $textboxPrinterIPValue.Text = "" } #this function checks if a group exists in AD and return true if exists and false if not. function CheckIfGroupExists ($GroupName) { trap [Exception] { return $false } $checking = Get-ADGroup $GroupName return $true } #this function checks if a printer exists and return true if exists and false if not. thank you juneblender and jvierra for the help! # see post here: https://www.sapien.com/forums/viewtopic.php?f=18&t=10013 function CheckIfPrinterExists ($PrinterName) { $checking2 = Get-Printer -Name $PrinterName -ErrorAction SilentlyContinue if (-not $checking2) { return $false } else { return $true } } #this function will ping a range until there is NO response then will perform 2 more tests to verify the IP is good to use (no printer and no group tests) #im also converting the printer name to the format: $Prefix-###-###-### where ### is the 3 last IP Octats function PingRangeUntilGoodIP { param ($IPStartRange, $IPEndRange, $IPFirstThree, $ADMask, $prefix) $script:IPTestsSuccess = $false $IPStartRange .. $IPEndRange | %{ if ($script:IPTestsSuccess -eq $false) { $textboxPrinterIPValue.Text = "$($IPFirstThree)`.$_" $labelPortNameCustom.Text = $null $labelPortNameCustom.Text += $prefix $labelPortNameCustom.Text += $textboxPrinterIPValue.Text -creplace '^[^.]*.', '' $labelPortNameCustom.Text = $labelPortNameCustom.Text -replace '\.', '-' $result2 = CheckIfGroupExists "$ADMask-$_" $richtextboxStatusTab1.SelectionColor = 'Black' $richtextboxStatusTab1.AppendText("$_ check group result is: $result2 `n") $result3 = CheckIfPrinterExists "$($labelPortNameCustom.Text)" $richtextboxStatusTab1.AppendText("$_ check printer result is: $result3 `n") if ((!$result2) -and (!$result3)) { $result1 = Test-Connection $IPFirstThree`.$_ -Count 1 -Quiet $richtextboxStatusTab1.SelectionColor = 'Black' $richtextboxStatusTab1.AppendText("$_ check ping result is: $result1 `n") if (!$result1) { $richtextboxStatusTab1.SelectionColor = 'Green' $richtextboxStatusTab1.AppendText("NO ping to $($IPFirstThree)`.$_ `n") $richtextboxStatusTab1.SelectionColor = 'Green' $richtextboxStatusTab1.AppendText("NO group for $($ADMask)-$_ `n") $richtextboxStatusTab1.SelectionColor = 'Green' $richtextboxStatusTab1.AppendText("IP SELECTED: $($IPFirstThree)`.$_ `n") $groupboxMoreInfo.Visible = $true $labelPrinterNameCustom.Text = $labelPortNameCustom.Text $textboxPrinterLocation.Text = $prefix $textboxPrinterLocation.Text = $textboxPrinterLocation.Text -replace '-', ' - ' $script:IPTestsSuccess = $true [int]$script:SelectedIP = "$_" Update-NavButtons } Else { $richtextboxStatusTab1.SelectionColor = 'Red' $richtextboxStatusTab1.AppendText("$($IPFirstThree)`.$_ IS TAKEN! `n") $script:IPTestsSuccess = $false Update-NavButtons } } Else { $richtextboxStatusTab1.SelectionColor = 'Red' $richtextboxStatusTab1.AppendText("$($IPFirstThree)`.$_ IS TAKEN! `n") $script:IPTestsSuccess = $false Update-NavButtons } } } } Function Get-IniContent { <# .Synopsis Gets the content of an INI file .Description Gets the content of an INI file and returns it as a hashtable .Notes Author : Oliver Lipkau Blog : http://oliver.lipkau.net/blog/ Source : https://github.com/lipkau/PsIni http://gallery.technet.microsoft.com/scriptcenter/ea40c1ef-c856-434b-b8fb-ebd7a76e8d91 Version : 1.0 - 2010/03/12 - Initial release 1.1 - 2014/12/11 - Typo (Thx SLDR) Typo (Thx Dave Stiff) #Requires -Version 2.0 .Inputs System.String .Outputs System.Collections.Hashtable .Parameter FilePath Specifies the path to the input file. .Example $FileContent = Get-IniContent "C:\myinifile.ini" ----------- Description Saves the content of the c:\myinifile.ini in a hashtable called $FileContent .Example $inifilepath | $FileContent = Get-IniContent ----------- Description Gets the content of the ini file passed through the pipe into a hashtable called $FileContent .Example C:\PS>$FileContent = Get-IniContent "c:\settings.ini" C:\PS>$FileContent["Section"]["Key"] ----------- Description Returns the key "Key" of the section "Section" from the C:\settings.ini file .Link Out-IniFile #> [CmdletBinding()] Param ( [ValidateNotNullOrEmpty()] [ValidateScript({ (Test-Path $_) -and ((Get-Item $_).Extension -eq ".ini") })] [Parameter(ValueFromPipeline = $True, Mandatory = $True)] [string]$FilePath ) Begin { Write-Verbose "$($MyInvocation.MyCommand.Name):: Function started" } Process { Write-Verbose "$($MyInvocation.MyCommand.Name):: Processing file: $Filepath" $script:ini = @{ } switch -regex -file $FilePath { "^\[(.+)\]$" # Section { $section = $matches[1] $script:ini[$section] = @{ } $CommentCount = 0 } "^(;.*)$" # Comment { if (!($section)) { $section = "No-Section" $script:ini[$section] = @{ } } $value = $matches[1] $CommentCount = $CommentCount + 1 $name = "Comment" + $CommentCount $script:ini[$section][$name] = $value } "(.+?)\s*=\s*(.*)" # Key { if (!($section)) { $section = "No-Section" $script:ini[$section] = @{ } } $name, $value = $matches[1..2] $script:ini[$section][$name] = $value } } Write-Verbose "$($MyInvocation.MyCommand.Name):: Finished Processing file: $FilePath" Return $script:ini } End { Write-Verbose "$($MyInvocation.MyCommand.Name):: Function ended" } } #thanks to PLantella. link here: https://gallery.technet.microsoft.com/scriptcenter/Add-Printer-Permission-c0ece1f3 Function Add-LHSPrinterPermissionSDDL { <# .SYNOPSIS Add Printer Permission using SDDL .DESCRIPTION Add Printer Permission using Security Definition Description Language (SDDL). The function adds full controll rights to the SDDL Use Get-Printer and Set-Printer to modify Printer Permission on local and Remote Computers. Requires Microsoft PS Module PrintManagement. .PARAMETER Account An User or Group account you want to add Permission like "Domain\GroupName" or "Domain\UserName". .PARAMETER existingSDDL The current SDDL of a Printer .EXAMPLE $PermissionSDDL = Get-Printer -full -Name test99 | select PermissionSDDL -ExpandProperty PermissionSDDL $newSDDL = Add-LHSPrinterPermissionSDDL -Account "Domain\Username" -existingSDDL $PermissionSDDL Get-Printer -Name test99 | Set-Printer -PermissionSDDL $newSDDL -verbose .INPUTS None .OUTPUTS SDDL as System.String .NOTES # AccessMask which can contain following values: # Takeownership - 524288 # ReadPermissions - 131072 # ChangePermissions - 262144 - NOT GOOD only take ownership # ManageDocuments - 983088 - not good grants take ownership and no manage docs ;/ # ManagePrinters - 983052 - NOT GOOD give print + manage Printer. we want manage docs # Print + ReadPermissions - 131080 - this is ok - grants ONLY Print # full control all operations - 268435456 AUTHOR: Pasquale Lantella LASTEDIT: KEYWORDS: .LINK DiscretionaryAcl.AddAccess Method (AccessControlType, SecurityIdentifier, Int32, InheritanceFlags, PropagationFlags) http://msdn.microsoft.com/en-us/library/xs9aw56y.aspx Understanding the SDDL permissions in the ACE_String http://networkadminkb.com/KB/a6/understanding-the-sddl-permissions-in-the-ace-string.aspx #Requires -Version 3.0 #> [cmdletbinding( ConfirmImpact = 'Low', SupportsShouldProcess = $false )] [OutputType('System.String')] param ( [Parameter(Position = 0, Mandatory = $True, ValueFromPipeline = $False, HelpMessage = 'A Security Group or User like "Domain\GroupName" or "Domain\UserName"')] [String]$Account, [Parameter(Position = 1, Mandatory = $True, ValueFromPipeline = $False)] [String]$existingSDDL ) BEGIN { Set-StrictMode -Version Latest ${CmdletName} = $Pscmdlet.MyInvocation.MyCommand.Name } # end BEGIN PROCESS { try { $isContainer = $false $isDS = $false $SecurityDescriptor = New-Object -TypeName Security.AccessControl.CommonSecurityDescriptor $isContainer, $isDS, $existingSDDL #Write-Verbose "Adding Permission for Group $Account" $richtextboxStatusTab4.Text += "Adding Permission for Group $Account `n" #get the SID for the specified Group and add it to the SDDL $NTAccount = New-Object Security.Principal.NTAccount $Account $NTAccountSid = $NTAccount.Translate([Security.Principal.SecurityIdentifier]).Value $SecurityDescriptor.DiscretionaryAcl.AddAccess( [System.Security.AccessControl.AccessControlType]::Allow, $NTAccountSid, 131080, #full control all operations [System.Security.AccessControl.InheritanceFlags]::None, [System.Security.AccessControl.PropagationFlags]::None) | Out-Null return $SecurityDescriptor.GetSddlForm("All") } catch [Exception] { $richtextboxStatusTab4.Text += "Failed To Generate SDDL (review inner exception):`n $_.Message `n Exception: $_.Exception `n" } } # end PROCESS END { # Write-Verbose "Function ${CmdletName} finished." } $richtextboxStatusTab4.Text += "Function ${CmdletName} finished. `n" } } #end Function Add-LHSPrinterPermissionSDDL #here we fix permissions function SetPrinterPermissions { If (!(Test-Path -Path 'C:\Program Files (x86)\Windows Resource Kits\Tools\subinacl.exe')) { Copy-Item -Path .\Additions\subinacl.exe -Destination 'C:\Program Files (x86)\Windows Resource Kits\Tools\' -Force } $CmdPath = 'C:\Program Files (x86)\Windows Resource Kits\Tools\subinacl.exe' $PrinterName = $args[0] $PrintGroup = $args[1] $Domain = "$($ini["setup"]["domainnetbios"])\" & $CmdPath /verbose=1 /printer $PrinterName /grant="$($ini["setup"]["domainnetbios"])\Domain Admins=F" & $CmdPath /verbose=1 /printer $PrinterName /grant=".\Administrators=F" & $CmdPath /verbose=1 /printer $PrinterName /revoke="Everyone" & $CmdPath /verbose=1 /printer $PrinterName /revoke="ALL APPLICATION PACKAGES" & $CmdPath /verbose=1 /printer $PrinterName /revoke="CREATOR OWNER" & $CmdPath /verbose=1 /printer $PrinterName /revoke=$env:USERNAME } $comboboxCompany_SelectedValueChanged={ #TODO: Place custom script here $Temp_company = $comboboxCompany.SelectedIndex ClearTab1 $script:IPTestsSuccess = $false $prefix = $script:ini["company$($comboboxCompany.SelectedIndex)"]["prefix"] $IPFirstThree = $script:ini["company$($comboboxCompany.SelectedIndex)"]["ipfirstthree"] $IPStartRange = $script:ini["company$($comboboxCompany.SelectedIndex)"]["ipstartrange"] $IPEndRange = $script:ini["company$($comboboxCompany.SelectedIndex)"]["ipendrage"] $ADMask = $script:ini["company$($comboboxCompany.SelectedIndex)"]["admask"] PingRangeUntilGoodIP $IPStartRange $IPEndRange $IPFirstThree $ADMask $prefix } #this section causes the status boxes to auto scroll to last added chars $richtextboxStatusTab2_TextChanged={ #TODO: Place custom script here $richtextboxStatusTab2.SelectionStart = $richtextboxStatusTab2.TextLength; $richtextboxStatusTab2.ScrollToCaret() $richtextboxStatusTab2.Focus() } $richtextboxStatusTab1_TextChanged={ #TODO: Place custom script here $richtextboxStatusTab1.SelectionStart = $richtextboxStatusTab1.TextLength; $richtextboxStatusTab1.ScrollToCaret() $richtextboxStatusTab1.Focus() } $richtextboxStatusTab3_TextChanged = { #TODO: Place custom script here $richtextboxStatusTab3.SelectionStart = $richtextboxStatusTab1.TextLength; $richtextboxStatusTab3.ScrollToCaret() $richtextboxStatusTab3.Focus() } $richtextboxStatusTab4_TextChanged = { #TODO: Place custom script here $richtextboxStatusTab4.SelectionStart = $richtextboxStatusTab4.TextLength; $richtextboxStatusTab4.ScrollToCaret() $richtextboxStatusTab4.Focus() } #end of status boxes text update $buttonMembersRemove_Click={ #TODO: Place custom script here $listboxMembers.Items.RemoveAt($listboxMembers.SelectedIndex) Update-NavButtons } $buttonMembersAdd_Click={ #TODO: Place custom script here Load-ListBox -ListBox $listboxMembers $textboxMembers.Text -Append Update-NavButtons } $checkboxConfirmAllJobs_CheckedChanged= { #TODO: Place custom script here if ($checkboxConfirmAllJobs.Checked) { $Count = $checkedlistboxJobs.Items.Count for ($index = 0; $index -lt $Count; ++$index) { if ($_.Index -ne $index) { $checkedlistboxJobs.SetItemChecked($index, $true) Update-NavButtons } } } Else { $Count = $checkedlistboxJobs.Items.Count for ($index = 0; $index -lt $Count; ++$index) { if ($_.Index -ne $index) { $checkedlistboxJobs.SetItemChecked($index, $false) Update-NavButtons } } } } $comboboxPrinterDriver_SelectedIndexChanged={ #TODO: Place custom script here Update-NavButtons } $textboxPrinterLocation_TextChanged={ #TODO: Place custom script here Update-NavButtons } $textboxPrinterComment_TextChanged={ #TODO: Place custom script here Update-NavButtons } $checkboxEnterIPManualy_CheckedChanged={ #TODO: Place custom script here if ($checkboxEnterIPManualy.Checked -eq $true) { ClearTab1 $groupboxMoreInfo.Visible = $true $textboxPrinterIPValue.Enabled = $true $textboxPrinterIPValue.BackColor = 'White' Update-NavButtons } Else { ClearTab1 $groupboxMoreInfo.Visible = $false $textboxPrinterIPValue.Enabled = $false $textboxPrinterIPValue.BackColor = 'Gray' Update-NavButtons } } $buttonRun_Click={ #TODO: Place custom script here $progressbaroverlay3.Maximum = $checkedlistboxJobs.CheckedItems.Count if ($checkedlistboxJobs.CheckedItems -contains "Also Create FAX") { $progressbaroverlay3.Maximum = $checkedlistboxJobs.CheckedItems.Count + 4 } $progressbaroverlay3.Step = 1 $progressbaroverlay3.Value = 0 $richtextboxStatusTab4.AppendText($checkedlistboxJobs.CheckedItems + " `n") #if checkbox selected - Creating AD Security group under OU Print Server if ($checkedlistboxJobs.CheckedItems -contains "Create AD Group") { $richtextboxStatusTab4.AppendText("RUNNING: Create AD Group `n") $richtextboxStatusTab4.Text += New-ADGroup -Name $labelPortNameCustom.Text -SamAccountName $labelPortNameCustom.Text -GroupCategory Security -GroupScope Global -Path "$($ini["setup"]["pathforgroups"])" -Description "$($textboxPrinterLocation.Text) , $($textboxPrinterComment.text)" -PassThru | Out-String $richtextboxStatusTab4.Text += "*** Finished Group Creation Process *** `n" sleep -Seconds 3 $progressbaroverlay3.PerformStep() } #Populating group with members if ($checkedlistboxJobs.CheckedItems -contains "Add Users to Group") { $richtextboxStatusTab4.AppendText("RUNNING: Add Users to Group `n") foreach ($member in $listboxMembers.Items) { $richtextboxStatusTab4.Text += Add-ADGroupMember -Identity $labelPortNameCustom.Text -Members $member -PassThru | Out-String #$richtextboxStatus.Text += "User $member added `n" } $progressbaroverlay3.PerformStep() } #Creating the Printer Port on Print Server if ($checkedlistboxJobs.CheckedItems -contains "Create Printer Port") { Add-PrinterPort -Name $($labelPortNameCustom.Text) -PrinterHostAddress $textboxPrinterIPValue.Text | Out-String sleep -Seconds 2 $progressbaroverlay3.PerformStep() } #Create the printer if ($checkedlistboxJobs.CheckedItems -contains "Create Printer") { Add-Printer -Name "$($labelPrinterNameCustom.Text)" -DriverName "$($comboboxPrinterDriver.Text)" -PortName "$($labelPortNameCustom.Text)" -Comment "$($textboxPrinterComment.Text)" -Location "$($textboxPrinterLocation.Text)" -Shared -Published -RenderingMode SSR $progressbaroverlay3.PerformStep() } #Fix Printer Permissions if ($checkedlistboxJobs.CheckedItems -contains "Assign/Fix Printer Permissions") { $PermissionSDDL = Get-Printer -full -Name $($labelPrinterNameCustom.Text) | select PermissionSDDL -ExpandProperty PermissionSDDL #$Account = "$($ini["setup"]["domain"])\$($labelPortNameCustom.Text)" $Account = "$($labelPortNameCustom.Text)" $test = $false While ($test -eq $false) { if (get-adgroup $Account -ErrorAction SilentlyContinue) { $test = $true } Start-Sleep -Seconds 1 } #$newSDDL = Add-LHSPrinterPermissionSDDL -Account "$($ini["setup"]["domainnetbios"])\$($labelPortNameCustom.Text)" -existingSDDL $PermissionSDDL $newSDDL = Add-LHSPrinterPermissionSDDL -Account $Account -existingSDDL $PermissionSDDL Get-Printer -Name $($labelPrinterNameCustom.Text) | Set-Printer -PermissionSDDL $newSDDL -verbose SetPrinterPermissions $($labelPortNameCustom.Text) $($labelPrinterNameCustom.Text) #this part will tick the check box "print spooled documents first" $filter = "name='" $filter += "$($labelPortNameCustom.Text)'" $obj = Get-WmiObject Win32_Printer -Filter "$filter" -ComputerName $ini["setup"]["servername"] $obj.DoCompleteFirst = $true $obj.Put() $progressbaroverlay3.PerformStep() $richtextboxStatusTab4.Text += "`n **** FINISHED *** `n" } if ($checkedlistboxJobs.CheckedItems -contains "Also Create FAX") { #create the AD Group FAX $richtextboxStatusTab4.AppendText("RUNNING: Create AD Group for FAX `n") $richtextboxStatusTab4.Text += New-ADGroup -Name "$($labelPortNameCustom.Text)-FAX" -SamAccountName "$($labelPortNameCustom.Text)-FAX" -GroupCategory Security -GroupScope Global -Path $ini["setup"]["pathforgroups"] -Description "$($textboxPrinterLocation.Text) , $($textboxPrinterComment.text) - FAX" -PassThru | Out-String $progressbaroverlay3.PerformStep() $richtextboxStatusTab4.Text += "*** Finished Group Creation for FAX Process *** `n" sleep -Seconds 3 #add members to new group FAX $richtextboxStatusTab4.AppendText("RUNNING: Add Users to Group FAX `n") foreach ($member in $listboxMembers.Items) { $richtextboxStatusTab4.Text += Add-ADGroupMember -Identity "$($labelPortNameCustom.Text)-FAX" -Members $member -PassThru | Out-String } #create printer FAX Add-Printer -Name "$($labelPrinterNameCustom.Text)-FAX" -DriverName "$($comboboxFaxDriver.Text)" -PortName "$($labelPortNameCustom.Text)" -Comment "$($textboxPrinterComment.Text) - FAX" -Location "$($textboxPrinterLocation.Text) - FAX" -Shared -Published -RenderingMode SSR $progressbaroverlay3.PerformStep() #fix permissions FAX $PermissionSDDL = Get-Printer -full -Name "$($labelPrinterNameCustom.Text)-FAX" | select PermissionSDDL -ExpandProperty PermissionSDDL $progressbaroverlay3.PerformStep() #$Account = "$($ini["setup"]["domain"])\$($labelPortNameCustom.Text)-FAX" $Account = "$($labelPortNameCustom.Text)-FAX" $test = $false While ($test -eq $false) { if (get-adgroup $Account -ErrorAction SilentlyContinue) { $test = $true } Start-Sleep -Seconds 1 } $newSDDL = Add-LHSPrinterPermissionSDDL -Account $Account -existingSDDL $PermissionSDDL Get-Printer -Name "$($labelPrinterNameCustom.Text)-FAX" | Set-Printer -PermissionSDDL $newSDDL -verbose SetPrinterPermissions "$($labelPortNameCustom.Text)-FAX" "$($labelPrinterNameCustom.Text)-FAX" $progressbaroverlay3.PerformStep() #this part will tick the check box "print spooled documents first" $filter = "name='" $filter += "$($labelPortNameCustom.Text)-FAX'" $obj = Get-WmiObject Win32_Printer -Filter "$filter" -ComputerName $ini["setup"]["servername"] $obj.DoCompleteFirst = $true $obj.Put() $progressbaroverlay3.PerformStep() } } $buttonContinueScan_Click={ #TODO: Place custom script here $Temp_company = $comboboxCompany.SelectedIndex ClearTab1 $script:IPTestsSuccess = $false $prefix = $script:ini["company$($comboboxCompany.SelectedIndex)"]["prefix"] $IPFirstThree = $script:ini["company$($comboboxCompany.SelectedIndex)"]["ipfirstthree"] $script:SelectedIP++ $IPStartRange = $script:SelectedIP $IPEndRange = $script:ini["company$($comboboxCompany.SelectedIndex)"]["ipendrage"] $ADMask = $script:ini["company$($comboboxCompany.SelectedIndex)"]["admask"] PingRangeUntilGoodIP $IPStartRange $IPEndRange $IPFirstThree $ADMask $prefix } $checkboxAlsoCreateFAX_CheckedChanged={ #TODO: Place custom script here if ($checkboxAlsoCreateFAX.Checked -eq $true) { $labelFAXDriver.Visible = $true $comboboxFaxDriver.Visible = $true } Else { $labelFAXDriver.Visible = $false $comboboxFaxDriver.Visible = $false } } # --End User Generated Script-- #---------------------------------------------- #region Generated Events #---------------------------------------------- $Form_StateCorrection_Load= { #Correct the initial state of the form to prevent the .Net maximized form issue $formEPIC.WindowState = $InitialFormWindowState } $Form_Cleanup_FormClosed= { #Remove all event handlers from the controls try { $buttonBack.remove_Click($buttonBack_Click) $buttonFinish.remove_Click($buttonFinish_Click) $richtextboxStatusTab1.remove_TextChanged($richtextboxStatusTab1_TextChanged) $checkboxAlsoCreateFAX.remove_CheckedChanged($checkboxAlsoCreateFAX_CheckedChanged) $checkboxEnterIPManualy.remove_CheckedChanged($checkboxEnterIPManualy_CheckedChanged) $buttonContinueScan.remove_Click($buttonContinueScan_Click) $comboboxCompany.remove_SelectedValueChanged($comboboxCompany_SelectedValueChanged) $textboxMACAddress.remove_TextChanged($textboxMACAddress_TextChanged) $richtextboxStatusTab2.remove_TextChanged($richtextboxStatusTab2_TextChanged) $textboxPrinterComment.remove_TextChanged($textboxPrinterComment_TextChanged) $textboxPrinterLocation.remove_TextChanged($textboxPrinterLocation_TextChanged) $comboboxPrinterDriver.remove_SelectedIndexChanged($comboboxPrinterDriver_SelectedIndexChanged) $richtextboxStatusTab3.remove_TextChanged($richtextboxStatusTab3_TextChanged) $buttonMembersRemove.remove_Click($buttonMembersRemove_Click) $buttonMembersAdd.remove_Click($buttonMembersAdd_Click) $richtextboxStatusTab4.remove_TextChanged($richtextboxStatusTab4_TextChanged) $buttonRun.remove_Click($buttonRun_Click) $checkboxConfirmAllJobs.remove_CheckedChanged($checkboxConfirmAllJobs_CheckedChanged) $tabcontrolWizard.remove_Selecting($tabcontrolWizard_Selecting) $tabcontrolWizard.remove_Deselecting($tabcontrolWizard_Deselecting) $buttonNext.remove_Click($buttonNext_Click) $formEPIC.remove_Load($formEPIC_Load) $formEPIC.remove_Load($Form_StateCorrection_Load) $formEPIC.remove_FormClosed($Form_Cleanup_FormClosed) } catch { Out-Null <# Prevent PSScriptAnalyzer warning #> } } #endregion Generated Events #---------------------------------------------- #region Generated Form Code #---------------------------------------------- $formEPIC.SuspendLayout() $tabcontrolWizard.SuspendLayout() $tabpageStep1.SuspendLayout() $groupboxPrinterInfo.SuspendLayout() $groupboxMoreInfo.SuspendLayout() $tabpageStep2.SuspendLayout() $groupboxPrinterConfig.SuspendLayout() $tabpageStep3.SuspendLayout() $groupboxMembers.SuspendLayout() $tabpageStep4.SuspendLayout() $groupboxConfirmJobs.SuspendLayout() # # formEPIC # $formEPIC.Controls.Add($buttonCancel) $formEPIC.Controls.Add($buttonBack) $formEPIC.Controls.Add($buttonFinish) $formEPIC.Controls.Add($tabcontrolWizard) $formEPIC.Controls.Add($buttonNext) $formEPIC.AutoScaleDimensions = '6, 13' $formEPIC.AutoScaleMode = 'Font' $formEPIC.CancelButton = $buttonCancel $formEPIC.ClientSize = '537, 422' $formEPIC.FormBorderStyle = 'FixedDialog' $formEPIC.MaximizeBox = $False $formEPIC.Name = 'formEPIC' $formEPIC.StartPosition = 'CenterScreen' $formEPIC.Text = 'E.P.I.C' $formEPIC.add_Load($formEPIC_Load) # # buttonCancel # $buttonCancel.Anchor = 'Bottom, Right' $buttonCancel.DialogResult = 'Cancel' $buttonCancel.Location = '369, 387' $buttonCancel.Name = 'buttonCancel' $buttonCancel.Size = '75, 23' $buttonCancel.TabIndex = 4 $buttonCancel.Text = '&Cancel' $buttonCancel.UseCompatibleTextRendering = $True $buttonCancel.UseVisualStyleBackColor = $True # # buttonBack # $buttonBack.Anchor = 'Bottom, Left' $buttonBack.Location = '13, 387' $buttonBack.Name = 'buttonBack' $buttonBack.Size = '75, 23' $buttonBack.TabIndex = 1 $buttonBack.Text = '< &Back' $buttonBack.UseCompatibleTextRendering = $True $buttonBack.UseVisualStyleBackColor = $True $buttonBack.add_Click($buttonBack_Click) # # buttonFinish # $buttonFinish.Anchor = 'Bottom, Right' $buttonFinish.DialogResult = 'OK' $buttonFinish.Location = '450, 387' $buttonFinish.Name = 'buttonFinish' $buttonFinish.Size = '75, 23' $buttonFinish.TabIndex = 3 $buttonFinish.Text = '&Finish' $buttonFinish.UseCompatibleTextRendering = $True $buttonFinish.UseVisualStyleBackColor = $True $buttonFinish.Visible = $False $buttonFinish.add_Click($buttonFinish_Click) # # tabcontrolWizard # $tabcontrolWizard.Controls.Add($tabpageStep1) $tabcontrolWizard.Controls.Add($tabpageStep2) $tabcontrolWizard.Controls.Add($tabpageStep3) $tabcontrolWizard.Controls.Add($tabpageStep4) $tabcontrolWizard.Anchor = 'Top, Bottom, Left, Right' $tabcontrolWizard.Location = '13, 12' $tabcontrolWizard.Name = 'tabcontrolWizard' $tabcontrolWizard.SelectedIndex = 0 $tabcontrolWizard.Size = '512, 369' $tabcontrolWizard.TabIndex = 0 $tabcontrolWizard.add_Selecting($tabcontrolWizard_Selecting) $tabcontrolWizard.add_Deselecting($tabcontrolWizard_Deselecting) # # tabpageStep1 # $tabpageStep1.Controls.Add($richtextboxStatusTab1) $tabpageStep1.Controls.Add($groupboxPrinterInfo) $tabpageStep1.Location = '4, 22' $tabpageStep1.Name = 'tabpageStep1' $tabpageStep1.Padding = '3, 3, 3, 3' $tabpageStep1.Size = '504, 343' $tabpageStep1.TabIndex = 0 $tabpageStep1.Text = 'Step 1' $tabpageStep1.UseVisualStyleBackColor = $True # # richtextboxStatusTab1 # $richtextboxStatusTab1.AcceptsTab = $True $richtextboxStatusTab1.Location = '7, 169' $richtextboxStatusTab1.Name = 'richtextboxStatusTab1' $richtextboxStatusTab1.Size = '491, 168' $richtextboxStatusTab1.TabIndex = 4 $richtextboxStatusTab1.Text = '' $richtextboxStatusTab1.add_TextChanged($richtextboxStatusTab1_TextChanged) # # groupboxPrinterInfo # $groupboxPrinterInfo.Controls.Add($checkboxAlsoCreateFAX) $groupboxPrinterInfo.Controls.Add($checkboxEnterIPManualy) $groupboxPrinterInfo.Controls.Add($groupboxMoreInfo) $groupboxPrinterInfo.Controls.Add($comboboxCompany) $groupboxPrinterInfo.Controls.Add($labelSelectCompany) $groupboxPrinterInfo.Controls.Add($textboxMACAddress) $groupboxPrinterInfo.Controls.Add($labelEnterMACAddress) $groupboxPrinterInfo.Location = '7, 0' $groupboxPrinterInfo.Name = 'groupboxPrinterInfo' $groupboxPrinterInfo.Size = '491, 163' $groupboxPrinterInfo.TabIndex = 8 $groupboxPrinterInfo.TabStop = $False $groupboxPrinterInfo.Text = 'Printer Info' $groupboxPrinterInfo.UseCompatibleTextRendering = $True # # checkboxAlsoCreateFAX # $checkboxAlsoCreateFAX.Location = '126, 129' $checkboxAlsoCreateFAX.Name = 'checkboxAlsoCreateFAX' $checkboxAlsoCreateFAX.Size = '110, 24' $checkboxAlsoCreateFAX.TabIndex = 10 $checkboxAlsoCreateFAX.Text = 'Also Create FAX' $checkboxAlsoCreateFAX.UseCompatibleTextRendering = $True $checkboxAlsoCreateFAX.UseVisualStyleBackColor = $True $checkboxAlsoCreateFAX.add_CheckedChanged($checkboxAlsoCreateFAX_CheckedChanged) # # checkboxEnterIPManualy # $checkboxEnterIPManualy.Location = '6, 129' $checkboxEnterIPManualy.Name = 'checkboxEnterIPManualy' $checkboxEnterIPManualy.Size = '110, 24' $checkboxEnterIPManualy.TabIndex = 9 $checkboxEnterIPManualy.Text = 'Enter IP Manualy' $checkboxEnterIPManualy.UseCompatibleTextRendering = $True $checkboxEnterIPManualy.UseVisualStyleBackColor = $True $checkboxEnterIPManualy.add_CheckedChanged($checkboxEnterIPManualy_CheckedChanged) # # groupboxMoreInfo # $groupboxMoreInfo.Controls.Add($buttonContinueScan) $groupboxMoreInfo.Controls.Add($textboxPrinterIPValue) $groupboxMoreInfo.Controls.Add($labelPrinterIP) $groupboxMoreInfo.Controls.Add($labelPortName) $groupboxMoreInfo.Controls.Add($labelPrinterNameCustom) $groupboxMoreInfo.Controls.Add($labelPrinterName) $groupboxMoreInfo.Controls.Add($labelPortNameCustom) $groupboxMoreInfo.Location = '242, 19' $groupboxMoreInfo.Name = 'groupboxMoreInfo' $groupboxMoreInfo.Size = '243, 138' $groupboxMoreInfo.TabIndex = 8 $groupboxMoreInfo.TabStop = $False $groupboxMoreInfo.Text = 'More Info' $groupboxMoreInfo.UseCompatibleTextRendering = $True $groupboxMoreInfo.Visible = $False # # buttonContinueScan # $buttonContinueScan.BackColor = 'Fuchsia' $buttonContinueScan.Location = '108, 110' $buttonContinueScan.Name = 'buttonContinueScan' $buttonContinueScan.Size = '129, 23' $buttonContinueScan.TabIndex = 12 $buttonContinueScan.Text = 'Continue Scan' $buttonContinueScan.UseCompatibleTextRendering = $True $buttonContinueScan.UseVisualStyleBackColor = $False $buttonContinueScan.add_Click($buttonContinueScan_Click) # # textboxPrinterIPValue # $textboxPrinterIPValue.BackColor = 'ControlLight' $textboxPrinterIPValue.Location = '108, 83' $textboxPrinterIPValue.Name = 'textboxPrinterIPValue' $textboxPrinterIPValue.Size = '129, 20' $textboxPrinterIPValue.TabIndex = 9 # # labelPrinterIP # $labelPrinterIP.Location = '5, 80' $labelPrinterIP.Name = 'labelPrinterIP' $labelPrinterIP.Size = '92, 23' $labelPrinterIP.TabIndex = 11 $labelPrinterIP.Text = 'Printer IP:' $labelPrinterIP.UseCompatibleTextRendering = $True # # labelPortName # $labelPortName.Location = '6, 16' $labelPortName.Name = 'labelPortName' $labelPortName.Size = '89, 23' $labelPortName.TabIndex = 10 $labelPortName.Text = 'Port Name: ' $labelPortName.UseCompatibleTextRendering = $True # # labelPrinterNameCustom # $labelPrinterNameCustom.BackColor = 'ActiveCaption' $labelPrinterNameCustom.Location = '108, 45' $labelPrinterNameCustom.Name = 'labelPrinterNameCustom' $labelPrinterNameCustom.Size = '129, 23' $labelPrinterNameCustom.TabIndex = 9 $labelPrinterNameCustom.UseCompatibleTextRendering = $True # # labelPrinterName # $labelPrinterName.Location = '5, 45' $labelPrinterName.Name = 'labelPrinterName' $labelPrinterName.Size = '92, 23' $labelPrinterName.TabIndex = 8 $labelPrinterName.Text = 'Printer Name:' $labelPrinterName.UseCompatibleTextRendering = $True # # labelPortNameCustom # $labelPortNameCustom.BackColor = 'ActiveCaption' $labelPortNameCustom.Location = '108, 16' $labelPortNameCustom.Name = 'labelPortNameCustom' $labelPortNameCustom.Size = '129, 20' $labelPortNameCustom.TabIndex = 7 $labelPortNameCustom.UseCompatibleTextRendering = $True # # comboboxCompany # $comboboxCompany.FormattingEnabled = $True $comboboxCompany.Location = '107, 35' $comboboxCompany.Name = 'comboboxCompany' $comboboxCompany.Size = '129, 21' $comboboxCompany.TabIndex = 1 $comboboxCompany.add_SelectedValueChanged($comboboxCompany_SelectedValueChanged) # # labelSelectCompany # $labelSelectCompany.AutoSize = $True $labelSelectCompany.Location = '6, 35' $labelSelectCompany.Name = 'labelSelectCompany' $labelSelectCompany.Size = '90, 17' $labelSelectCompany.TabIndex = 0 $labelSelectCompany.Text = 'Select Company:' $labelSelectCompany.UseCompatibleTextRendering = $True # # textboxMACAddress # $textboxMACAddress.Location = '107, 67' $textboxMACAddress.Name = 'textboxMACAddress' $textboxMACAddress.Size = '129, 20' $textboxMACAddress.TabIndex = 2 $textboxMACAddress.Text = 'NOT IN USE' $textboxMACAddress.add_TextChanged($textboxMACAddress_TextChanged) # # labelEnterMACAddress # $labelEnterMACAddress.AutoSize = $True $labelEnterMACAddress.Location = '6, 70' $labelEnterMACAddress.Name = 'labelEnterMACAddress' $labelEnterMACAddress.Size = '107, 17' $labelEnterMACAddress.TabIndex = 3 $labelEnterMACAddress.Text = 'Enter MAC Address:' $labelEnterMACAddress.UseCompatibleTextRendering = $True # # tabpageStep2 # $tabpageStep2.Controls.Add($richtextboxStatusTab2) $tabpageStep2.Controls.Add($groupboxPrinterConfig) $tabpageStep2.Location = '4, 22' $tabpageStep2.Name = 'tabpageStep2' $tabpageStep2.Padding = '3, 3, 3, 3' $tabpageStep2.Size = '504, 343' $tabpageStep2.TabIndex = 1 $tabpageStep2.Text = 'Step 2' $tabpageStep2.UseVisualStyleBackColor = $True # # richtextboxStatusTab2 # $richtextboxStatusTab2.Location = '7, 173' $richtextboxStatusTab2.Name = 'richtextboxStatusTab2' $richtextboxStatusTab2.Size = '491, 164' $richtextboxStatusTab2.TabIndex = 2 $richtextboxStatusTab2.Text = '' $richtextboxStatusTab2.add_TextChanged($richtextboxStatusTab2_TextChanged) # # groupboxPrinterConfig # $groupboxPrinterConfig.Controls.Add($labelFAXDriver) $groupboxPrinterConfig.Controls.Add($comboboxFaxDriver) $groupboxPrinterConfig.Controls.Add($textboxPrinterComment) $groupboxPrinterConfig.Controls.Add($textboxPrinterLocation) $groupboxPrinterConfig.Controls.Add($labelPrinterComment) $groupboxPrinterConfig.Controls.Add($labelPrinterLocation) $groupboxPrinterConfig.Controls.Add($labelPrinterDriver) $groupboxPrinterConfig.Controls.Add($comboboxPrinterDriver) $groupboxPrinterConfig.Location = '6, 6' $groupboxPrinterConfig.Name = 'groupboxPrinterConfig' $groupboxPrinterConfig.Size = '492, 160' $groupboxPrinterConfig.TabIndex = 1 $groupboxPrinterConfig.TabStop = $False $groupboxPrinterConfig.Text = 'Printer Config' $groupboxPrinterConfig.UseCompatibleTextRendering = $True # # labelFAXDriver # $labelFAXDriver.Location = '0, 95' $labelFAXDriver.Name = 'labelFAXDriver' $labelFAXDriver.Size = '87, 23' $labelFAXDriver.TabIndex = 18 $labelFAXDriver.Text = 'FAX Driver:' $labelFAXDriver.UseCompatibleTextRendering = $True $labelFAXDriver.Visible = $False # # comboboxFaxDriver # $comboboxFaxDriver.FormattingEnabled = $True $comboboxFaxDriver.Location = '103, 92' $comboboxFaxDriver.Name = 'comboboxFaxDriver' $comboboxFaxDriver.Size = '237, 21' $comboboxFaxDriver.TabIndex = 17 $comboboxFaxDriver.Visible = $False # # textboxPrinterComment # $textboxPrinterComment.Location = '103, 66' $textboxPrinterComment.Name = 'textboxPrinterComment' $textboxPrinterComment.Size = '237, 20' $textboxPrinterComment.TabIndex = 16 $textboxPrinterComment.add_TextChanged($textboxPrinterComment_TextChanged) # # textboxPrinterLocation # $textboxPrinterLocation.Location = '103, 40' $textboxPrinterLocation.Name = 'textboxPrinterLocation' $textboxPrinterLocation.Size = '237, 20' $textboxPrinterLocation.TabIndex = 15 $textboxPrinterLocation.add_TextChanged($textboxPrinterLocation_TextChanged) # # labelPrinterComment # $labelPrinterComment.Location = '0, 69' $labelPrinterComment.Name = 'labelPrinterComment' $labelPrinterComment.Size = '100, 23' $labelPrinterComment.TabIndex = 14 $labelPrinterComment.Text = 'Printer Comment:' $labelPrinterComment.UseCompatibleTextRendering = $True # # labelPrinterLocation # $labelPrinterLocation.Location = '1, 43' $labelPrinterLocation.Name = 'labelPrinterLocation' $labelPrinterLocation.Size = '88, 23' $labelPrinterLocation.TabIndex = 13 $labelPrinterLocation.Text = 'Printer Location:' $labelPrinterLocation.UseCompatibleTextRendering = $True # # labelPrinterDriver # $labelPrinterDriver.Location = '0, 16' $labelPrinterDriver.Name = 'labelPrinterDriver' $labelPrinterDriver.Size = '87, 23' $labelPrinterDriver.TabIndex = 12 $labelPrinterDriver.Text = 'Printer Driver:' $labelPrinterDriver.UseCompatibleTextRendering = $True # # comboboxPrinterDriver # $comboboxPrinterDriver.FormattingEnabled = $True $comboboxPrinterDriver.Location = '103, 13' $comboboxPrinterDriver.Name = 'comboboxPrinterDriver' $comboboxPrinterDriver.Size = '237, 21' $comboboxPrinterDriver.TabIndex = 11 $comboboxPrinterDriver.add_SelectedIndexChanged($comboboxPrinterDriver_SelectedIndexChanged) # # tabpageStep3 # $tabpageStep3.Controls.Add($richtextboxStatusTab3) $tabpageStep3.Controls.Add($groupboxMembers) $tabpageStep3.Location = '4, 22' $tabpageStep3.Name = 'tabpageStep3' $tabpageStep3.Size = '504, 343' $tabpageStep3.TabIndex = 2 $tabpageStep3.Text = 'Step 3' $tabpageStep3.UseVisualStyleBackColor = $True # # richtextboxStatusTab3 # $richtextboxStatusTab3.Location = '4, 209' $richtextboxStatusTab3.Name = 'richtextboxStatusTab3' $richtextboxStatusTab3.Size = '491, 131' $richtextboxStatusTab3.TabIndex = 4 $richtextboxStatusTab3.Text = '' $richtextboxStatusTab3.add_TextChanged($richtextboxStatusTab3_TextChanged) # # groupboxMembers # $groupboxMembers.Controls.Add($textboxMembers) $groupboxMembers.Controls.Add($buttonMembersRemove) $groupboxMembers.Controls.Add($buttonMembersAdd) $groupboxMembers.Controls.Add($listboxMembers) $groupboxMembers.Location = '4, 3' $groupboxMembers.Name = 'groupboxMembers' $groupboxMembers.Size = '497, 199' $groupboxMembers.TabIndex = 3 $groupboxMembers.TabStop = $False $groupboxMembers.Text = 'Select Members' $groupboxMembers.UseCompatibleTextRendering = $True # # textboxMembers # $textboxMembers.AutoCompleteMode = 'SuggestAppend' $textboxMembers.AutoCompleteSource = 'CustomSource' $textboxMembers.Location = '6, 19' $textboxMembers.Name = 'textboxMembers' $textboxMembers.Size = '149, 20' $textboxMembers.TabIndex = 3 # # buttonMembersRemove # $buttonMembersRemove.Location = '178, 116' $buttonMembersRemove.Name = 'buttonMembersRemove' $buttonMembersRemove.Size = '116, 23' $buttonMembersRemove.TabIndex = 2 $buttonMembersRemove.Text = '<<' $buttonMembersRemove.UseCompatibleTextRendering = $True $buttonMembersRemove.UseVisualStyleBackColor = $True $buttonMembersRemove.add_Click($buttonMembersRemove_Click) # # buttonMembersAdd # $buttonMembersAdd.Location = '178, 43' $buttonMembersAdd.Name = 'buttonMembersAdd' $buttonMembersAdd.Size = '116, 23' $buttonMembersAdd.TabIndex = 1 $buttonMembersAdd.Text = 'ADD >>' $buttonMembersAdd.UseCompatibleTextRendering = $True $buttonMembersAdd.UseVisualStyleBackColor = $True $buttonMembersAdd.add_Click($buttonMembersAdd_Click) # # listboxMembers # $listboxMembers.FormattingEnabled = $True $listboxMembers.Location = '315, 19' $listboxMembers.Name = 'listboxMembers' $listboxMembers.Size = '176, 173' $listboxMembers.TabIndex = 0 # # tabpageStep4 # $tabpageStep4.Controls.Add($richtextboxStatusTab4) $tabpageStep4.Controls.Add($groupboxConfirmJobs) $tabpageStep4.Location = '4, 22' $tabpageStep4.Name = 'tabpageStep4' $tabpageStep4.Padding = '3, 3, 3, 3' $tabpageStep4.Size = '504, 343' $tabpageStep4.TabIndex = 3 $tabpageStep4.Text = 'Step 4' $tabpageStep4.UseVisualStyleBackColor = $True # # richtextboxStatusTab4 # $richtextboxStatusTab4.Font = 'Lucida Console, 9.75pt' $richtextboxStatusTab4.Location = '11, 174' $richtextboxStatusTab4.Name = 'richtextboxStatusTab4' $richtextboxStatusTab4.Size = '487, 163' $richtextboxStatusTab4.TabIndex = 2 $richtextboxStatusTab4.Text = '' $richtextboxStatusTab4.add_TextChanged($richtextboxStatusTab4_TextChanged) # # groupboxConfirmJobs # $groupboxConfirmJobs.Controls.Add($progressbaroverlay3) $groupboxConfirmJobs.Controls.Add($buttonRun) $groupboxConfirmJobs.Controls.Add($checkboxConfirmAllJobs) $groupboxConfirmJobs.Controls.Add($checkedlistboxJobs) $groupboxConfirmJobs.Location = '11, 11' $groupboxConfirmJobs.Name = 'groupboxConfirmJobs' $groupboxConfirmJobs.Size = '478, 156' $groupboxConfirmJobs.TabIndex = 1 $groupboxConfirmJobs.TabStop = $False $groupboxConfirmJobs.Text = 'Confirm Jobs' $groupboxConfirmJobs.UseCompatibleTextRendering = $True # # progressbaroverlay3 # $progressbaroverlay3.Location = '184, 120' $progressbaroverlay3.Name = 'progressbaroverlay3' $progressbaroverlay3.Size = '288, 23' $progressbaroverlay3.TabIndex = 4 # # buttonRun # $buttonRun.Location = '199, 59' $buttonRun.Name = 'buttonRun' $buttonRun.Size = '99, 23' $buttonRun.TabIndex = 2 $buttonRun.Text = 'Run' $buttonRun.UseCompatibleTextRendering = $True $buttonRun.UseVisualStyleBackColor = $True $buttonRun.add_Click($buttonRun_Click) # # checkboxConfirmAllJobs # $checkboxConfirmAllJobs.Location = '199, 20' $checkboxConfirmAllJobs.Name = 'checkboxConfirmAllJobs' $checkboxConfirmAllJobs.Size = '159, 32' $checkboxConfirmAllJobs.TabIndex = 1 $checkboxConfirmAllJobs.Text = 'Confirm All Jobs' $checkboxConfirmAllJobs.UseCompatibleTextRendering = $True $checkboxConfirmAllJobs.UseVisualStyleBackColor = $True $checkboxConfirmAllJobs.add_CheckedChanged($checkboxConfirmAllJobs_CheckedChanged) # # checkedlistboxJobs # $checkedlistboxJobs.FormattingEnabled = $True [void]$checkedlistboxJobs.Items.Add('Create AD Group') [void]$checkedlistboxJobs.Items.Add('Add Users to Group') [void]$checkedlistboxJobs.Items.Add('Create Printer Port') [void]$checkedlistboxJobs.Items.Add('Create Printer') [void]$checkedlistboxJobs.Items.Add('Assign/Fix Printer Permissions') [void]$checkedlistboxJobs.Items.Add('Also Create FAX') $checkedlistboxJobs.Location = '6, 19' $checkedlistboxJobs.Name = 'checkedlistboxJobs' $checkedlistboxJobs.Size = '172, 124' $checkedlistboxJobs.TabIndex = 0 $checkedlistboxJobs.UseCompatibleTextRendering = $True # # buttonNext # $buttonNext.Anchor = 'Bottom, Right' $buttonNext.Location = '288, 387' $buttonNext.Name = 'buttonNext' $buttonNext.Size = '75, 23' $buttonNext.TabIndex = 2 $buttonNext.Text = '&Next >' $buttonNext.UseCompatibleTextRendering = $True $buttonNext.UseVisualStyleBackColor = $True $buttonNext.add_Click($buttonNext_Click) $groupboxConfirmJobs.ResumeLayout() $tabpageStep4.ResumeLayout() $groupboxMembers.ResumeLayout() $tabpageStep3.ResumeLayout() $groupboxPrinterConfig.ResumeLayout() $tabpageStep2.ResumeLayout() $groupboxMoreInfo.ResumeLayout() $groupboxPrinterInfo.ResumeLayout() $tabpageStep1.ResumeLayout() $tabcontrolWizard.ResumeLayout() $formEPIC.ResumeLayout() #endregion Generated Form Code #---------------------------------------------- #Save the initial state of the form $InitialFormWindowState = $formEPIC.WindowState #Init the OnLoad event to correct the initial state of the form $formEPIC.add_Load($Form_StateCorrection_Load) #Clean up the control events $formEPIC.add_FormClosed($Form_Cleanup_FormClosed) #Show the Form return $formEPIC.ShowDialog() } #End Function #Call the form Show-EPIC_v1_3_psf | Out-Null