· 6 years ago · Oct 08, 2019, 08:24 PM
1$groupName = [System.Security.Principal.NTAccount] 'domain\IT'
2$groupSid = $groupName.Translate([System.Security.Principal.SecurityIdentifier])
3
4if ([System.Security.Principal.WindowsIdentity]::GetCurrent().Groups -notcontains $groupSid)
5{
6
7 # Function to create report email
8function SendNotification{
9 $Msg = New-Object Net.Mail.MailMessage
10 $Smtp = New-Object Net.Mail.SmtpClient($SmtpServer)
11 $Smtp.Credentials = New-Object System.Net.NetworkCredential("email", "emailpw")
12 $Msg.From = $FromAddress
13 $Msg.To.Add($ToAddress)
14 $Msg.Subject = "Unauthorized IT Tool usage!"
15 $Msg.Body = $EmailBody
16 $Msg.IsBodyHTML = $true
17 $Msg.Priority = [System.Net.Mail.MailPriority]::High
18 $Smtp.Send($Msg)
19}
20
21# Define local Exchange server info for message relay. Ensure that any servers running this script have permission to relay.
22$SmtpServer = "smtpserver"
23$FromAddress = "emailaddress"
24
25
26# Send notification to each user in the list
27 $ToAddress = 'emailaddress'
28 $EmailBody = @"
29 <html>
30 <head>
31 </head>
32 <body>
33 <p>Attention!,</p>
34
35 <p>The Tool was attempted to be run by <strong>$env:USERNAME</strong> on computer <strong>$env:COMPUTERNAME</strong>.</p>
36
37 </body>
38 </html>
39"@
40 SendNotification
41
42 throw 'You are not authorized to use this program.'
43
44 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 333 -EntryType Warning -Message "The Tool was attempted to be run by $env:USERNAME on computer $env:COMPUTERNAME"
45}
46
47function Show-Tabbed_Layout_psf {
48
49 #----------------------------------------------
50 #region Import the Assemblies
51 #----------------------------------------------
52 [void][reflection.assembly]::Load('System.Drawing, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a')
53 [void][reflection.assembly]::Load('System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089')
54 #endregion Import Assemblies
55
56 #----------------------------------------------
57 #region Generated Form Objects
58 #----------------------------------------------
59 [System.Windows.Forms.Application]::EnableVisualStyles()
60 $form1 = New-Object 'System.Windows.Forms.Form'
61 $tabcontrol1 = New-Object 'System.Windows.Forms.TabControl'
62 #PW Recovery Tab Objects
63 #Email Password
64 $tabpage1 = New-Object 'System.Windows.Forms.TabPage'
65 $lblEmail_Email = New-Object 'System.Windows.Forms.Label'
66 $btnGetEmailPW_Email = New-Object 'System.Windows.Forms.Button'
67 $btnClearForm_Email = New-Object 'System.Windows.Forms.Button'
68 $txtUserName_Email = New-Object 'System.Windows.Forms.TextBox'
69 $lblUserName_Email = New-Object 'System.Windows.Forms.Label'
70 $txtEmailPW_Email = New-Object 'System.Windows.Forms.TextBox'
71 $lblEmailPW_Email = New-Object 'System.Windows.Forms.Label'
72 $lblNotify_Email = New-Object 'System.Windows.Forms.Label'
73 $tooltip1 = New-Object 'System.Windows.Forms.ToolTip'
74 #Portal Password
75 $lblPortal_Portal = New-Object 'System.Windows.Forms.Label'
76 $btnGetPortalPW_Portal = New-Object 'System.Windows.Forms.Button'
77 $btnClearForm_Portal = New-Object 'System.Windows.Forms.Button'
78 $txtUserName_Portal = New-Object 'System.Windows.Forms.TextBox'
79 $lblUserName_Portal = New-Object 'System.Windows.Forms.Label'
80 $txtPortalPW_Portal = New-Object 'System.Windows.Forms.TextBox'
81 $lblPortalPW_Portal = New-Object 'System.Windows.Forms.Label'
82 $lblNotify_Portal = New-Object 'System.Windows.Forms.Label'
83 #MTP Password
84 $lblMTP_MTP = New-Object 'System.Windows.Forms.Label'
85 $btnGetMTPPW_MTP = New-Object 'System.Windows.Forms.Button'
86 $btnClearForm_MTP = New-Object 'System.Windows.Forms.Button'
87 $UserNameCombo_MTP = New-Object 'System.Windows.Forms.Combobox'
88 $lblUserName_MTP = New-Object 'System.Windows.Forms.Label'
89 $txtMTPPW_MTP = New-Object 'System.Windows.Forms.TextBox'
90 $lblMTPPW_MTP = New-Object 'System.Windows.Forms.Label'
91 $lblNotify_MTP = New-Object 'System.Windows.Forms.Label'
92 #LAPS Password
93 $lblLaps_Laps = New-Object 'System.Windows.Forms.Label'
94 $btnGetLapsPW_Laps = New-Object 'System.Windows.Forms.Button'
95 $btnClearForm_Laps = New-Object 'System.Windows.Forms.Button'
96 $PCNameCombo_Laps = New-Object 'System.Windows.Forms.Combobox'
97 $lblPCName_Laps = New-Object 'System.Windows.Forms.Label'
98 $txtLapsPW_Laps = New-Object 'System.Windows.Forms.TextBox'
99 $lblLapsPW_Laps = New-Object 'System.Windows.Forms.Label'
100 $lblNotify_Laps = New-Object 'System.Windows.Forms.Label'
101 #Employee Number
102 $lblEmployeeNumber_ADPW = New-Object 'System.Windows.Forms.Label'
103 $btnUpdateEmailPW_ADPW = New-Object 'System.Windows.Forms.Button'
104 $txtUserName_ADPW = New-Object 'System.Windows.Forms.TextBox'
105 $lblUserName_ADPW = New-Object 'System.Windows.Forms.Label'
106 $txtEmailPW_ADPW = New-Object 'System.Windows.Forms.TextBox'
107 $lblEmailPW_ADPW = New-Object 'System.Windows.Forms.Label'
108 $lblNotify_ADPW = New-Object 'System.Windows.Forms.Label'
109 $btnClearForm_ADPW = New-Object 'System.Windows.Forms.Button'
110 #Random Password Generator
111 $txtRandomPW_Random = New-Object 'System.Windows.Forms.TextBox'
112 $lblRandomPW_Random = New-Object 'System.Windows.Forms.Label'
113 $btnCreateRandomPW = New-Object 'System.Windows.Forms.Button'
114 $lblNotify_Random = New-Object 'System.Windows.Forms.Label'
115 #Active Directory Tab Objects
116 #New User Creation
117 $tabpage2 = New-Object 'System.Windows.Forms.TabPage'
118 $lblBanner_NewUser = New-Object 'System.Windows.Forms.Label'
119 $lblFName_NewUser = New-Object 'System.Windows.Forms.Label'
120 $txtFName_NewUser = New-Object 'System.Windows.Forms.TextBox'
121 $lblLName_NewUser = New-Object 'System.Windows.Forms.Label'
122 $txtLName_NewUser = New-Object 'System.Windows.Forms.TextBox'
123 $lblExt_NewUser = New-Object 'System.Windows.Forms.Label'
124 $txtExt_NewUser = New-Object 'System.Windows.Forms.TextBox'
125 $lblDept_NewUser = New-Object 'System.Windows.Forms.Label'
126 $DeptCombo_NewUser = New-Object 'System.Windows.Forms.ComboBox'
127 $buttonCreateUser_NewUser = New-Object 'System.Windows.Forms.Button'
128 #Disable User (AD,SLX,Portal)
129 $lblbanner_disable = New-Object 'System.Windows.Forms.Label'
130 $lblusername_disable = New-Object 'System.Windows.Forms.Label'
131 $txtusername_disable = New-Object 'System.Windows.Forms.TextBox'
132 $btndisable_disable = New-Object 'System.Windows.Forms.Button'
133 $btnDisableInfo_disable = New-Object 'System.Windows.Forms.Button'
134 $tooltip2 = New-Object 'System.Windows.Forms.ToolTip'
135 #AD Changes Report (Shows all changes to AD for the selected time frame. Opens HTML and emails itservices with a link as well.)
136 $lblADChanges_ADChanges = New-Object 'System.Windows.Forms.Label'
137 $lblDateRange_ADChanges = New-Object 'System.Windows.Forms.Label'
138 $ADRangeCombo_ADChanges = New-Object 'System.Windows.Forms.Combobox'
139 $btnADChanges_RunReport = New-Object 'System.Windows.Forms.Button'
140 #Rename Computer
141 $lblbanner_rename = New-Object 'System.Windows.Forms.Label'
142 $lblcurrent_rename = New-Object 'System.Windows.Forms.Label'
143 $currentcombo_rename = New-Object 'System.Windows.Forms.ComboBox'
144 $lblnewname_rename = New-Object 'System.Windows.Forms.Label'
145 $txtnewname_rename = New-Object 'System.Windows.Forms.TextBox'
146 $btnrename_rename = New-Object 'System.Windows.Forms.Button'
147 #Phone System Tab Objects
148 #Call report
149 $tabpage3 = New-Object 'System.Windows.Forms.TabPage'
150 $date_startcall_report = New-Object 'System.Windows.Forms.DateTimePicker'
151 $date_endcall_report = New-Object 'System.Windows.Forms.DateTimePicker'
152 $txtextension_report = New-Object 'System.Windows.Forms.TextBox'
153 $lblcallhistory_report = New-Object 'System.Windows.Forms.Label'
154 $lblextension_report = New-Object 'System.Windows.Forms.Label'
155 $lblstartcall_report = New-Object 'System.Windows.Forms.Label'
156 $lblendcall_report = New-Object 'System.Windows.Forms.Label'
157 $btninbound_report = New-Object 'System.Windows.Forms.Button'
158 $btnoutbound_report = New-Object 'System.Windows.Forms.Button'
159 #GP Stuck Tab Objects
160 $tabpage4 = New-Object 'System.Windows.Forms.TabPage'
161 $lblStuckTransfer_GP = New-Object 'System.Windows.Forms.Label'
162 $txtStuckTransfer_GP = New-Object 'System.Windows.Forms.TextBox'
163 $btnStuckTransfer_GP = New-Object 'System.Windows.Forms.Button'
164 $btnClearTransfer_GP = New-Object 'System.Windows.Forms.Button'
165 $lblFulfilled_GP = New-Object 'System.Windows.Forms.Label'
166 $txtFulfilled_GP = New-Object 'System.Windows.Forms.TextBox'
167 $btnFulfilled_GP = New-Object 'System.Windows.Forms.Button'
168 #SLX Account Update Tab Objects
169 $tabpage5 = New-Object 'System.Windows.Forms.TabPage'
170 $lblBanner_SLXUpdate = New-Object 'System.Windows.Forms.Label'
171 $lblCustomerNumber_SLXUpdate = New-Object 'System.Windows.Forms.Label'
172 $TerritoryCombo_SLXUpdate = New-Object 'System.Windows.Forms.ComboBox'
173 $lblTerritory_SLXUpdate = New-Object 'System.Windows.Forms.Label'
174 $txtCustomerNumber_SLXUpdate = New-Object 'System.Windows.Forms.TextBox'
175 $btnUpdateAccount_SLXUpdate = New-Object 'System.Windows.Forms.Button'
176 $lblBanner_LeadUpdate = New-Object 'System.Windows.Forms.Label'
177 $lblLeadID_LeadUpdate = New-Object 'System.Windows.Forms.Label'
178 $TerritoryCombo_LeadUpdate = New-Object 'System.Windows.Forms.ComboBox'
179 $lblTerritory_LeadUpdate = New-Object 'System.Windows.Forms.Label'
180 $txtLeadID_LeadUpdate = New-Object 'System.Windows.Forms.TextBox'
181 $btnUpdateLead_LeadUpdate = New-Object 'System.Windows.Forms.Button'
182 $btnLeadIDInfo_LeadUpdate = New-Object 'System.Windows.Forms.Button'
183 #Tab Page 6 Objects
184 $tabpage6 = New-Object 'System.Windows.Forms.TabPage'
185 $lblPCName_info = New-Object 'System.Windows.Forms.Label'
186 $lblOU_info = New-Object 'System.Windows.Forms.Label'
187 $lblOSName_info = New-Object 'System.Windows.Forms.Label'
188 $lblVersion_info = New-Object 'System.Windows.Forms.Label'
189 $lblBuild_info = New-Object 'System.Windows.Forms.Label'
190 $lblIP_info = New-Object 'System.Windows.Forms.Label'
191 $lblFreeSpace_info = New-Object 'System.Windows.Forms.Label'
192 $lblLastBoot_info = New-Object 'System.Windows.Forms.Label'
193 $lblWinKey_info = New-Object 'System.Windows.Forms.Label'
194 $lblOfficeKey_info = New-Object 'System.Windows.Forms.Label'
195 $lblComputer_info = New-Object 'System.Windows.Forms.Label'
196 $lblPCName_result = New-Object 'System.Windows.Forms.Label'
197 $lblOU_result = New-Object 'System.Windows.Forms.Label'
198 $lblOSName_result = New-Object 'System.Windows.Forms.Label'
199 $lblVersion_result = New-Object 'System.Windows.Forms.Label'
200 $lblBuild_result = New-Object 'System.Windows.Forms.Label'
201 $lblIP_result = New-Object 'System.Windows.Forms.Label'
202 $lblFreeSpace_result = New-Object 'System.Windows.Forms.Label'
203 $lblLastBoot_result = New-Object 'System.Windows.Forms.Label'
204 $lblWinKey_result = New-Object 'System.Windows.Forms.Label'
205 $lblOfficeKey_result = New-Object 'System.Windows.Forms.Label'
206 $ComputerCombo_info = New-Object 'System.Windows.Forms.ComboBox'
207 $btnGetInfo_info = New-Object 'System.Windows.Forms.Button'
208 $InitialFormWindowState = New-Object 'System.Windows.Forms.FormWindowState'
209 #endregion Generated Form Objects
210
211 #----------------------------------------------
212 # User Generated Script
213 #----------------------------------------------
214
215 $form1_Load={
216 #TODO: Initialize Form Controls here
217
218 }
219
220 $textbox2_TextChanged={
221 #TODO: Place custom script here
222
223 }
224
225 $btnGetEmailPW_Email_Click={
226
227 Import-module ActiveDirectory
228
229 $username = $txtUserName_Email.text
230
231 try {
232 Get-ADUser $username -ErrorAction Stop
233 $emailpw = Get-ADUser -Identity "$username" -Properties employeenumber | Select employeenumber
234
235 If (@($emailpw).employeenumber -eq $null) {
236 [System.Media.SystemSounds]::Exclamation.Play()
237 [System.Windows.Forms.MessageBox]::Show('Password Not Set!','Error!')
238 }
239 else {
240 $txtEmailPW_Email.Text = $emailpw.employeenumber
241 Set-Clipboard -Value $emailpw.employeenumber
242 $lblNotify_Email.Text = "Password Copied to Clipboard!"
243 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "Email PW - Email Password was recovered for $username by $env:USERNAME."
244 }
245 } catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] {
246 [System.Media.SystemSounds]::Exclamation.Play()
247 [System.Windows.Forms.MessageBox]::Show('User Not Found!','Error!')
248 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 111 -EntryType Error -Message "Email PW - $username does not exist in AD."
249 }
250 }
251
252 $ShowHelp={
253 #display popup help
254 $tip = "The Lead ID can be pulled from the URL or from the Details tab on the Lead Details screen. `nExample ID: Q6UJ9A01JD5F"
255 $tooltip1.IsBalloon = $True
256 $tooltip1.SetToolTip($btnLeadIDInfo_LeadUpdate,$tip)
257 } #end ShowHelp
258
259
260
261 $txtUserName_Email_KeyDown=[System.Windows.Forms.KeyEventHandler]{
262 #Event Argument: $_ = [System.Windows.Forms.KeyEventArgs]
263 #TODO: Place custom script here
264 if ($_.KeyCode -eq 'Enter')
265 {
266 $btnGetEmailPW_Email_Click.Invoke()
267 }
268 }
269
270 $btnClearForm_Email_Click={
271 #TODO: Place custom script here
272 $txtUserName_Email.clear()
273 $txtEmailPW_Email.clear()
274 $lblNotify_Email.Text = ""
275 [System.Windows.Forms.MessageBox]::Show('Clipboard Cleared.','Success')
276 [System.Windows.Forms.Clipboard]::Clear()
277 $txtUserName_Email.focus()
278 }
279
280 $btnGetPortalPW_Portal_Click={
281
282 import-module dbatools
283
284 $UserName_Portal = $txtUserName_Portal.text
285 $pw = get-content C:\pw.txt | convertto-securestring
286 $creds = New-Object System.Management.Automation.PSCredential -ArgumentList "username", $pw
287 $SQLCount = Invoke-DbaQuery -SqlInstance "Server" -SqlCredential $creds -Query "Select count(username) from TABLE where UserName = @UserName" -SqlParameters @{ Username = $UserName_Portal}
288
289 if (@($SQLCount).count -gt 0) {
290 $SQLQuery = Invoke-DbaQuery -SqlInstance "Server" -SqlCredential $creds -Query "Select password from TABLE where UserName = @Username" -SqlParameters @{ Username = $UserName_Portal} | select -expand password
291 $txtPortalPW_Portal.text = $SQLQuery
292 Set-Clipboard -Value $SQLQuery
293 $lblNotify_Portal.text = "Password Copied to Clipboard!"
294
295 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "Portal PW - Portal Password was recovered for $UserName_Portal by $env:USERNAME."
296 }
297 else{
298 [System.Media.SystemSounds]::Exclamation.Play()
299 [System.Windows.Forms.MessageBox]::Show('User Not Found!','Error!')
300 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 111 -EntryType Error -Message "Portal PW - $UserName_Portal does not exist in Portal."
301 }
302
303 }
304
305 $txtUserName_Portal_KeyDown=[System.Windows.Forms.KeyEventHandler]{
306 #Event Argument: $_ = [System.Windows.Forms.KeyEventArgs]
307 #TODO: Place custom script here
308 if ($_.KeyCode -eq 'Enter')
309 {
310 $btnGetPortalPW_Portal_Click.Invoke()
311 }
312 }
313
314 $btnClearForm_Portal_Click={
315 #TODO: Place custom script here
316 $txtUserName_Portal.clear()
317 $txtPortalPW_Portal.clear()
318 $lblNotify_Portal.Text = ""
319 [System.Windows.Forms.MessageBox]::Show('Clipboard Cleared.','Success')
320 [System.Windows.Forms.Clipboard]::Clear()
321 $txtUserName_Portal.focus()
322
323 }
324 $btnGetMTPPW_MTP_Click={
325 import-module dbatools
326
327 if($UserNameCombo_MTP.Text){
328 $pw = get-content C:\PW.txt | convertto-securestring
329 $creds = New-Object System.Management.Automation.PSCredential -ArgumentList "USERNAME", $pw
330 $User = $UserNameCombo_MTP.Text
331 switch ($User)
332 {
333 " LIST OF USERS "
334 }
335 }
336 $MTPQuery = Invoke-DbaQuery -SqlInstance "Server" -SqlCredential $creds -Query "Select password from TABLE where UserName = @Username" -SqlParameters @{ Username = $Login} | select -expand password
337 $txtMTPPW_MTP.text = $MTPQuery
338 Set-Clipboard -Value $MTPQuery
339 $lblNotify_MTP.text = "Password Copied to Clipboard!"
340
341 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "MTP Portal PW - MTP Portal Password was recovered for $User by $env:USERNAME"
342 }
343 else{
344 [System.Media.SystemSounds]::Exclamation.Play()
345 [System.Windows.Forms.MessageBox]::Show('Please select a User.','Invalid ID')
346 }
347}
348 $btnClearForm_MTP_Click={
349
350 $txtMTPPW_MTP.clear()
351 $lblNotify_MTP.Text = ""
352 [System.Windows.Forms.MessageBox]::Show('Clipboard Cleared.','Success')
353 [System.Windows.Forms.Clipboard]::Clear()
354
355}
356
357 $btnGetLapsPW_Laps_Click={
358 $txtPCName = $PCNameCombo_Laps.text
359
360 try {
361 Get-ADComputer $txtPCName -ErrorAction Stop
362 $lapspw = get-adcomputer $txtPCName -Properties * | select -expand ('ms-Mcs-AdmPwd')
363 $txtLapsPW_Laps.text = $lapspw
364 Set-Clipboard -Value $lapspw
365 $lblNotify_Laps.Text = "Password Copied to Clipboard!"
366
367 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "LAPS PW - LAPS Password was recovered for $txtPCName by $env:USERNAME."
368
369 } catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] {
370 [System.Media.SystemSounds]::Exclamation.Play()
371 [System.Windows.Forms.MessageBox]::Show('Computer Not Found!','Error!')
372 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 111 -EntryType Error -Message "LAPS PW - $txtPCName does not exist in AD."
373 }
374
375 }
376
377 $txtPCName_Laps_KeyDown=[System.Windows.Forms.KeyEventHandler]{
378 #Event Argument: $_ = [System.Windows.Forms.KeyEventArgs]
379 #TODO: Place custom script here
380 if ($_.KeyCode -eq 'Enter')
381 {
382 $btnGetLapsPW_Laps_Click.Invoke()
383 }
384 }
385
386 $btnClearForm_Laps_Click={
387
388 $txtLapsPW_Laps.clear()
389 $lblNotify_LAPS.Text = ""
390 [System.Windows.Forms.MessageBox]::Show('Clipboard Cleared.','Success')
391 [System.Windows.Forms.Clipboard]::Clear()
392
393
394 }
395
396 $btnCreateRandomPW_Click={
397 #TODO: Place custom script here
398 Add-Type -AssemblyName System.web
399 $RandomPW = [System.Web.Security.Membership]::GeneratePassword(10,2)
400 $txtRandomPW_Random.text = $RandomPW
401 Set-Clipboard -Value $RandomPW
402 $lblNotify_Random.Text = "Password Copied to Clipboard!"
403
404 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "Random PW - Random Password was generated on $env:COMPUTERNAME"
405 }
406 $btnUpdateEmailPW_ADPW_Click={
407 #TODO: Place custom script here
408 Import-module ActiveDirectory
409
410 $username = $txtUserName_ADPW.text
411 $employeenumber = $txtEmailPW_ADPW.text
412 try {
413 Get-ADUser $username -ErrorAction Stop
414 Set-ADUser -Identity "$username" -EmployeeNumber "$employeenumber"
415 $lblNotify_ADPW.Text = "Employee Number Updated!"
416
417 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "Update Email PW - Email Password was updated for $username"
418 } catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] {
419 [System.Media.SystemSounds]::Exclamation.Play()
420 [System.Windows.Forms.MessageBox]::Show('User Not Found!','Error!')
421 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 111 -EntryType Error -Message "Update Email PW - User does not exist in AD."
422 }
423
424
425 }
426
427 $txtUserName_ADPW_KeyDown=[System.Windows.Forms.KeyEventHandler]{
428 #Event Argument: $_ = [System.Windows.Forms.KeyEventArgs]
429 #TODO: Place custom script here
430 if ($_.KeyCode -eq 'Enter')
431 {
432 $btnUpdateEmailPW_ADPW_Click.Invoke()
433 }
434 }
435 $btnClearForm_ADPW_Click={
436 #TODO: Clears the form and places cursor back on the Username textbox.
437 $txtUserName_ADPW.clear()
438 $txtEmailPW_ADPW.clear()
439 $lblNotify_ADPW.Text = ""
440 [System.Windows.Forms.MessageBox]::Show('Clipboard Cleared.','Success')
441 [System.Windows.Forms.Clipboard]::Clear()
442 $txtUserName_ADPW.focus()
443 }
444
445 #Tab Page 2 Controls
446
447 #region Control Helper Functions
448 function Update-ComboBox
449 {
450 <#
451 .SYNOPSIS
452 This functions helps you load items into a ComboBox.
453
454 .DESCRIPTION
455 Use this function to dynamically load items into the ComboBox control.
456
457 .PARAMETER ComboBox
458 The ComboBox control you want to add items to.
459
460 .PARAMETER Items
461 The object or objects you wish to load into the ComboBox's Items collection.
462
463 .PARAMETER DisplayMember
464 Indicates the property to display for the items in this control.
465
466 .PARAMETER ValueMember
467 Indicates the property to use for the value of the control.
468
469 .PARAMETER Append
470 Adds the item(s) to the ComboBox without clearing the Items collection.
471
472 .EXAMPLE
473 Update-ComboBox $combobox1 "Red", "White", "Blue"
474
475 .EXAMPLE
476 Update-ComboBox $combobox1 "Red" -Append
477 Update-ComboBox $combobox1 "White" -Append
478 Update-ComboBox $combobox1 "Blue" -Append
479
480 .EXAMPLE
481 Update-ComboBox $combobox1 (Get-Process) "ProcessName"
482
483 .NOTES
484 Additional information about the function.
485 #>
486
487 param
488 (
489 [Parameter(Mandatory = $true)]
490 [ValidateNotNull()]
491 [System.Windows.Forms.ComboBox]
492 $ComboBox,
493 [Parameter(Mandatory = $true)]
494 [ValidateNotNull()]
495 $Items,
496 [Parameter(Mandatory = $false)]
497 [string]$DisplayMember,
498 [Parameter(Mandatory = $false)]
499 [string]$ValueMember,
500 [switch]
501 $Append
502 )
503
504 if (-not $Append)
505 {
506 $ComboBox.Items.Clear()
507 }
508
509 if ($Items -is [Object[]])
510 {
511 $ComboBox.Items.AddRange($Items)
512 }
513 elseif ($Items -is [System.Collections.IEnumerable])
514 {
515 $ComboBox.BeginUpdate()
516 foreach ($obj in $Items)
517 {
518 $ComboBox.Items.Add($obj)
519 }
520 $ComboBox.EndUpdate()
521 }
522 else
523 {
524 $ComboBox.Items.Add($Items)
525 }
526
527 $ComboBox.DisplayMember = $DisplayMember
528 $ComboBox.ValueMember = $ValueMember
529 }
530 #endregion
531
532 $DeptCombo_NewUser_SelectedIndexChanged={
533 #TODO: Place custom script here
534
535 }
536
537 $buttonCreateUser_NewUser_Click={
538 # Import required modules
539 Import-module ActiveDirectory
540 Add-Type -AssemblyName System.web
541
542 # Create new temporary password
543 $SecurePassword = ConvertTo-SecureString "PASSWORD" -AsPlainText -Force
544
545 # Prompt for new user information
546 $fname = $txtFName_NewUser.Text
547 $lname = $txtLName_NewUser.Text
548 $dept = $DeptCombo_NewUser.Text
549 switch ($dept)
550 {
551 Accounting {
552 $title = "Accounting"
553 $secgroup = "Accounting"
554 $Enabled = $True
555 }
556 "Customer Service" {
557 $title = "Customer Service"
558 $secgroup = "Customer_Service"
559 $Enabled = $True
560 }
561 "Inside Sales" {
562 $title = "Inside Sales"
563 $secgroup = "inside_sales"
564 $Enabled = $True
565 }
566 Lab {
567 $title = "Lab"
568 $secgroup = "Lab"
569 $Enabled = $True
570 }
571 Marketing {
572 $title = "Marketing"
573 $secgroup = "Marketing"
574 $Enabled = $True
575 }
576 "Order Processing"{
577 $title = "Order Processing"
578 $secgroup = "OrderPro"
579 $Enabled = $True
580 }
581 "Outside Sales"{
582 $title = "Outside Sales"
583 $secgroup = "Outside_sales"
584 $Enabled = $False
585 }
586 Purchasing {
587 $title = "Purchasing"
588 $secgroup = "Purchasing"
589 $Enabled = $True
590 }
591
592 }
593 $phone = $txtExt_NewUser.Text
594 $mailpw = [System.Web.Security.Membership]::GeneratePassword(10, 2)
595 $Username = $fname.substring(0, 1) + $lname
596 $script = "LOGIN.vbs"
597 $Check = Get-ADUser -Filter {sAMAccountName -eq $Username}
598
599 # Create User from information entered
600 $NewUserSplat = @{
601 Name = "$fname $lname"
602 SamAccountName = $username.tolower()
603 GivenName = $fname
604 Surname = $lname
605 DisplayName = "$fname $lname"
606 UserPrincipalName = "$username@DOMAIN.local".tolower()
607 OfficePhone = "###-###-#### x$phone"
608 Path = "OU=$dept Users,OU=$dept,DC=DOMAIN,DC=local"
609 HomeDrive = "U:"
610 HomeDirectory = "\\SERVER\home\$($username.tolower())"
611 ScriptPath = $script
612 AccountPassword = (ConvertTo-SecureString -AsPlainText "PASSWORD" -Force)
613 ChangePasswordAtLogon = $False
614 PasswordNeverExpires = $False
615 Description = $title
616 Enabled = $Enabled
617 EmailAddress = "$username@COMPANY.com".tolower()
618 EmployeeNumber = $mailpw
619 }
620
621 If ($Check -eq $Null){
622 New-ADUser @NewUserSplat -PassThru | Foreach-Object { Add-ADPrincipalGroupMembership -Memberof $secgroup, "Company Users" $_ }
623
624 Get-ADUser $Username -Properties Homedirectory | ? { $_.HomeDirectory } | ? { !(Test-Path $_.HomeDirectory) } | %{
625 New-Item -ItemType Directory -Path $_.HomeDirectory;
626 $rule = new-object System.Security.AccessControl.FileSystemAccessRule ($_.SamAccountName, "FullControl", "ContainerInherit,ObjectInherit", "none", "Allow");
627 $acl = Get-ACL $_.HomeDirectory
628 $acl.SetAccessRule($rule)
629 Set-ACL -Path $_.HomeDirectory -AclObject $acl
630 } | ft
631
632 #$lblNotify_NewUser.Text = "Email password is: $mailpw. It has been copied to the clipboard."
633 Set-Clipboard -Value $mailpw
634 [System.Windows.Forms.MessageBox]::Show("User Created Successfully! Email password is: $mailpw. It has been copied to the clipboard.")
635
636 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "New AD User - A new user was created in AD. Below are the details: `n Username: $Username `n Dept: $dept `n Ext: $phone"
637
638 $txtfname_NewUser.clear()
639 $txtlname_NewUser.clear()
640 $txtext_NewUser.clear()
641 $DeptCombo_NewUser.ResetText()
642 #$lblNotify_NewUser.Text = ''
643 $txtFName_NewUser.Focus()
644 }
645 Else {
646 [System.Media.SystemSounds]::Exclamation.Play()
647 [System.Windows.Forms.MessageBox]::Show('Account Already Exists!','Error!')
648 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 333 -EntryType Warning -Message "New AD User - Account $username already exists in AD."
649 }
650
651 }
652
653 $DisableHelp={
654 #display popup help
655 $disabletip = "This will perfom the following: `nDomain Account Disable `nSLX Account Disable `nPortal Password Change"
656 $tooltip2.IsBalloon = $True
657 $tooltip2.SetToolTip($btnDisableInfo_disable,$disabletip)
658 } #end ShowHelp
659
660
661 $txtusername_disable_KeyDown=[System.Windows.Forms.KeyEventHandler]{
662 #Event Argument: $_ = [System.Windows.Forms.KeyEventArgs]
663 #TODO: Place custom script here
664 if ($_.KeyCode -eq 'Enter')
665 {
666 $btndisable_disable_Click.Invoke()
667 }
668 }
669
670 $btndisable_disable_Click={
671 #This section disables the AD Account, Disables SLX login, and changes Portal password to 10 digit cryptic password to prevent login
672
673 Import-module ActiveDirectory
674 Add-Type -AssemblyName System.web
675
676 #Set Variables
677 $UserName_disable = $txtusername_disable.text
678 $RandomPW_disable = [System.Web.Security.Membership]::GeneratePassword(10,2)
679
680 $pw = get-content C:\PW.txt | convertto-securestring
681 $creds = New-Object System.Management.Automation.PSCredential -ArgumentList "USERNAME", $pw
682 $SQLPortalCount = Invoke-DbaQuery -SqlInstance "Server" -Database "DATABASE" -SqlCredential $creds -Query "Select count(username) from TABLE where UserName = @Username" -SqlParameters @{ Username = $UserName_disable}
683
684
685 #Disable AD Account
686 try {
687 Get-ADUser $UserName_disable -ErrorAction Stop
688 Disable-ADAccount -Identity $UserName_disable
689 } catch [Microsoft.ActiveDirectory.Management.ADIdentityNotFoundException] {
690 [System.Media.SystemSounds]::Exclamation.Play()
691 [System.Windows.Forms.MessageBox]::Show('User Not Found in Active Directory!','Error!')
692 throw $_
693 }
694
695 #Portal Password Change
696 if (@($SQLPortalCount).count -gt 0) {
697 $pw = get-content C:\sa.txt | convertto-securestring
698 $creds = New-Object System.Management.Automation.PSCredential -ArgumentList "sa", $pw
699 $SQLPortalQuery = Invoke-DbaQuery -SqlInstance "Server" -Database "DATABASE" -SqlCredential $creds -Query "Update TABLE set Password = '$RandomPW_disable' where UserName = @Username" -SqlParameters @{ Username = $UserName_disable}
700 }
701 else{
702 [System.Media.SystemSounds]::Exclamation.Play()
703 [System.Windows.Forms.MessageBox]::Show('User Not in Portal!','Error!')
704 throw $_
705 }
706 #Disable SLX Login
707 $pw = get-content C:\PW.txt | convertto-securestring
708 $creds = New-Object System.Management.Automation.PSCredential -ArgumentList "USERNAME", $pw
709 $SQLSLXQuery = Invoke-DbaQuery -SqlInstance "SERVER" -Database "DATABASE" -SqlCredential $creds -Query "Update TABLE set Enabled = 'F' where UserCode = @Username" -SqlParameters @{ Username = $UserName_disable}
710
711
712 [System.Windows.Forms.MessageBox]::Show("AD Account Disabled`nSLX Account Disabled`nPortal Password Changed",'Success!')
713 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "Disable User - Account $UserName_disable has been disabled in AD, Portal, and SLX."
714
715 $txtusername_disable.Clear()
716 $txtusername_disable.Focus()
717 }
718 #
719 # Run AD Changes Report
720 #
721 $btnADChanges_RunReport_Click={
722 Import-Module Dashimo
723 Import-Module PSWinReportingV2
724
725 $Reports = @(
726 'ADUserChanges'
727 'ADUserChangesDetailed'
728 'ADComputerChangesDetailed'
729 'ADUserStatus'
730 'ADUserLockouts'
731 #ADUserLogon
732 'ADUserUnlocked'
733 'ADComputerCreatedChanged'
734 'ADComputerDeleted'
735 #'ADUserLogonKerberos'
736 'ADGroupMembershipChanges'
737 'ADGroupEnumeration'
738 'ADGroupChanges'
739 'ADGroupCreateDelete'
740 'ADGroupChangesDetailed'
741 'ADGroupPolicyChanges'
742 'ADLogsClearedSecurity'
743 'ADLogsClearedOther'
744 #ADEventsReboots
745 )
746 $DateRange = $ADRangeCombo_ADChanges.text
747 $Events = Find-Events -Report $Reports -DatesRange $DateRange -Servers 'Server1', 'SERVER2' -quiet
748
749 Dashboard -FilePath PATH -Name 'AD REPORT' -Show {
750 Tab -Name 'Computer Changes' {
751 Section -Name 'ADComputerCreatedChanged' {
752 Table -DataTable $Events.ADComputerCreatedChanged
753 }
754 Section -Name 'ADComputerDeleted' {
755 Table -DataTable $Events.ADComputerDeleted
756 }
757 Section -Name 'ADComputerChangesDetailed' {
758 Table -DataTable $Events.ADComputerChangesDetailed
759 }
760 }
761 Tab -Name 'Group Changes' {
762 Section -Name 'ADGroupCreateDelete' {
763 Table -DataTable $Events.ADGroupCreateDelete
764 }
765 Section -Name 'ADGroupMembershipChanges' {
766 Table -DataTable $Events.ADGroupMembershipChanges
767 }
768 Section -Name 'ADGroupEnumeration' {
769 Table -DataTable $Events.ADGroupEnumeration
770 }
771 Section -Name 'ADGroupChanges' {
772 Table -DataTable $Events.ADGroupChanges
773 }
774 Section -Name 'ADGroupChangesDetailed' {
775 Table -DataTable $Events.ADGroupChangesDetailed
776 }
777 }
778 Tab -Name 'User Changes' {
779 Section -Name 'ADUserChanges' {
780 Table -DataTable $Events.ADUserChanges
781 }
782 Section -Name 'ADUserChangesDetailed' {
783 Table -DataTable $Events.ADUserChangesDetailed
784 }
785 Section -Name 'ADUserLockouts' {
786 Table -DataTable $Events.ADUserLockouts
787 }
788 Section -Name 'ADUserStatus' {
789 Table -DataTable $Events.ADUserStatus
790 }
791 Section -Name 'ADUserUnlocked' {
792 Table -DataTable $Events.ADUserUnlocked
793 }
794 }
795 Tab -Name 'Group Policy Changes' {
796 Section -Name 'ADGroupPolicyChanges' {
797 Table -DataTable $Events.ADGroupPolicyChanges
798 }
799 }
800 Tab -Name 'Logs' {
801 Section -Name 'ADLogsClearedOther' {
802 Table -DataTable $Events.ADLogsClearedOther
803 }
804 Section -Name 'ADLogsClearedSecurity' {
805 Table -DataTable $Events.ADLogsClearedSecurity
806 }
807 }
808 }
809
810 # Function to create report email
811 function SendNotification{
812 $Msg = New-Object Net.Mail.MailMessage
813 $Smtp = New-Object Net.Mail.SmtpClient($SmtpServer)
814 $Smtp.Credentials = New-Object System.Net.NetworkCredential("EMAIL", "EMAILPW")
815 $Msg.From = $FromAddress
816 $Msg.To.Add($ToAddress)
817 $Msg.Subject = "AD Report for the $DateRange"
818 $Msg.Body = $EmailBody
819 $Msg.IsBodyHTML = $true
820 $Smtp.Send($Msg)
821 }
822
823 # Define local Exchange server info for message relay. Ensure that any servers running this script have permission to relay.
824 $SmtpServer = "SMTP SERVER"
825 $FromAddress = "EMAIL ADDRESS"
826
827 # Import user list and information from .CSV file
828 #$Users = Import-Csv VPNUserList.csv
829
830 $link = '<a href="REPORT.html">AD Changes Report for the $DateRange</a>'
831 $link = $ExecutionContext.InvokeCommand.ExpandString($link)
832
833 # Send notification to each user in the list
834 $ToAddress = "EMAIL ADDRESS"
835 $EmailBody = @"
836 <html>
837 <head>
838 </head>
839 <body>
840
841 <p>The AD Changes report has been created. It can be accessed by clicking on the following link:</p>
842
843 <p>$link</p>
844
845 </body>
846 </html>
847"@
848 SendNotification
849 [System.Media.SystemSounds]::Exclamation.Play()
850 [System.Windows.Forms.MessageBox]::Show('Report Created Successfully','Success!')
851 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "AD Changes Report - Report ran by $env:USERNAME for the $DateRange."
852
853 }
854 #
855 # Rename Computer
856 #
857
858
859 $btnrename_rename_Click={
860 # Rename computer both locally and in Active Directory
861 # And restart it to have the changes take effect.
862
863 $current = $currentcombo_rename.Text
864 $new = $txtnewname_rename.Text
865
866 # Update local computer Description
867
868 $OSValues = Get-WmiObject -Class Win32_OperatingSystem -ComputerName $current
869 $OSValues.Description = $new.toupper()
870 $OSValues.Put()
871
872 # Run the rename command
873
874 Rename-Computer -ComputerName $current `
875 -NewName $new.toupper() `
876 -LocalCredential $current\administrator `
877 -DomainCredential paint\administrator -Force -PassThru -Restart
878
879 # Update Inventory Table on SERVER
880
881 $pw = get-content C:\PW.txt | convertto-securestring
882 $creds = New-Object System.Management.Automation.PSCredential -ArgumentList "USERNAME", $pw
883 $SQLInventoryUpdate = Invoke-DbaQuery -SqlInstance "SERVER" -Database "DATABASE" -SqlCredential $creds -Query "Update TABLE set TABLE.COMPUTERNAME = '$new' where COMPUTERNAME = '$current'"
884
885
886 [System.Windows.Forms.MessageBox]::Show('Computer Renamed Successfully!')
887 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "Rename Computer - Computer renamed by $env:USERNAME `n Old Name: $current `n New Name: $new."
888 }
889 #
890 #Phone System Controls
891 #
892 $btninbound_report_Click={
893 #TODO: Place custom script here
894 $ext = $txtextension_report.text
895 $start = $date_startcall_report.value | get-date -format 'yyyy-MM-dd'
896 $end = $date_endcall_report.value | get-date -format 'yyyy-MM-dd'
897 ## - Get SQL Server Table data:
898 $SQLServer = 'SERVER'
899 $Database = 'DATABASE'
900 $SqlQuery = "Select extension, ani, midnightstartdate, duration from TABLE where extension = '$ext' and midnightstartdate >= '$start 00:00:00.000' and midnightstartdate <= '$end 23:59:59.000' order by midnightstartdate"
901
902 ## - Connect to SQL Server using non-SMO class 'System.Data':
903 $SqlConnection = New-Object System.Data.SqlClient.SqlConnection;
904 $SqlConnection.ConnectionString = `
905 "Server = $SQLServer; Database = $Database; User ID = 'USERNAME'; Password = 'PASSWORD'";
906
907 $SqlCmd = New-Object System.Data.SqlClient.SqlCommand;
908 $SqlCmd.CommandText = $SqlQuery;
909 $SqlCmd.Connection = $SqlConnection;
910
911 ## - Extract and build the SQL data object '$DataSetTable':
912 $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter;
913 $SqlAdapter.SelectCommand = $SqlCmd;
914 $DataSet = New-Object System.Data.DataSet;
915 $SqlAdapter.Fill($DataSet);
916 $DataSetTable = $DataSet.Tables["Table"];
917
918 ## - Create an Excel Application instance:
919 $xlsObj = New-Object -ComObject Excel.Application;
920
921 ## - Create new Workbook and Sheet (Visible = 1 / 0 not visible)
922 $xlsObj.Visible = 1;
923 $xlsWb = $xlsobj.Workbooks.Add();
924 $xlsSh = $xlsWb.Worksheets.item(1);
925
926 ## - Copy entire table to the clipboard as tab delimited CSV
927 $DataSetTable | ConvertTo-Csv -NoType -Del "`t" | Clip
928
929 ## - Paste table to Excel
930 $xlsObj.ActiveCell.PasteSpecial() | Out-Null
931
932 ## - Set columns to auto-fit width
933 $xlsObj.ActiveSheet.UsedRange.Columns|%{$_.AutoFit()|Out-Null}
934
935 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "Call Report - Inbound Call Report for $ext ran by $env:USERNAME."
936 }
937
938 $btnoutbound_report_Click={
939 #TODO: Place custom script here
940 $ext = $txtextension_report.text
941 $start = $date_startcall_report.value | get-date -format 'yyyy-MM-dd'
942 $end = $date_endcall_report.value | get-date -format 'yyyy-MM-dd'
943 ## - Get SQL Server Table data:
944 $SQLServer = 'SERVER'
945 $Database = 'DATABASE'
946 $SqlQuery = "Select extension, digitsdialed, midnightstartdate, duration from TABLE where extension = '$ext' and midnightstartdate >= '$start 00:00:00.000' and midnightstartdate <= '$end 23:59:59.000' order by midnightstartdate"
947
948 ## - Connect to SQL Server using non-SMO class 'System.Data':
949 $SqlConnection = New-Object System.Data.SqlClient.SqlConnection;
950 $SqlConnection.ConnectionString = `
951 "Server = $SQLServer; Database = $Database; User ID = 'USERNAME'; Password = 'PASSWORD'";
952
953 $SqlCmd = New-Object System.Data.SqlClient.SqlCommand;
954 $SqlCmd.CommandText = $SqlQuery;
955 $SqlCmd.Connection = $SqlConnection;
956
957 ## - Extract and build the SQL data object '$DataSetTable':
958 $SqlAdapter = New-Object System.Data.SqlClient.SqlDataAdapter;
959 $SqlAdapter.SelectCommand = $SqlCmd;
960 $DataSet = New-Object System.Data.DataSet;
961 $SqlAdapter.Fill($DataSet);
962 $DataSetTable = $DataSet.Tables["Table"];
963
964 ## - Create an Excel Application instance:
965 $xlsObj = New-Object -ComObject Excel.Application;
966
967 ## - Create new Workbook and Sheet (Visible = 1 / 0 not visible)
968 $xlsObj.Visible = 1;
969 $xlsWb = $xlsobj.Workbooks.Add();
970 $xlsSh = $xlsWb.Worksheets.item(1);
971
972 ## - Copy entire table to the clipboard as tab delimited CSV
973 $DataSetTable | ConvertTo-Csv -NoType -Del "`t" | Clip
974
975 ## - Paste table to Excel
976 $xlsObj.ActiveCell.PasteSpecial() | Out-Null
977
978 ## - Set columns to auto-fit width
979 $xlsObj.ActiveSheet.UsedRange.Columns|%{$_.AutoFit()|Out-Null}
980
981 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "Call Report - Outbound Call Report for Extension $ext ran by $env:USERNAME."
982
983 }
984
985 #Great Plains Controls
986
987 #Check TABLE for anyone stuck transferring
988 $btnStuckTransfer_GP_Click={
989 $pw = get-content C:\PW.txt | convertto-securestring
990 $creds = New-Object System.Management.Automation.PSCredential -ArgumentList "USERNAME", $pw
991 $SQLQuery = Invoke-DbaQuery -SqlInstance “SERVER” -Database "DATABASE" -SqlCredential $creds -Query “Select Userid from TABLE” | select -expand userid
992 $txtStuckTransfer_GP.text = $SQLQuery
993
994 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "GP Transfer - Stuck Transfer check ran by $env:USERNAME."
995 }
996
997 #Clear out entry in TABLE after confirming user is stuck
998 $btnClearTransfer_GP_Click={
999 $userid = $txtStuckTransfer_GP.text
1000 $pw = get-content C:\PW.txt | convertto-securestring
1001 $creds = New-Object System.Management.Automation.PSCredential -ArgumentList "USERNAME", $pw
1002 $SQLClear = Invoke-DbaQuery -SqlInstance “SERVER” -Database "DATABASE" -SqlCredential $creds -Query “Delete from TABLE where userid = @Username” -SqlParameters @{ Username = $UserID}
1003
1004 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "GP Transfer - TABLE table cleared by $env:USERNAME."
1005 }
1006
1007 #Check TABLE for anyone stuck in Fulfilled batch
1008 $btnFulfilled_GP_Click={
1009 $pw = get-content C:\PW.txt | convertto-securestring
1010 $creds = New-Object System.Management.Automation.PSCredential -ArgumentList "USERNAME", $pw
1011 $SQLQuery = Invoke-DbaQuery -SqlInstance “SERVER” -Database "DATABASE" -SqlCredential $creds -Query “Select Userid from TABLE where BACHNUMB = 'Fulfilled'” -SqlParameters @{ Username = $UserName_Portal} | select -expand userid
1012 $txtFulfilled_GP.text = $SQLQuery -join "`n"
1013
1014 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "GP Transfer - Fulfilled Batch checked by $env:USERNAME."
1015 }
1016
1017 $btnUpdateAccount_SLXUpdate_Click={
1018 import-module dbatools
1019 if($TerritoryCombo_SLXUpdate.Text){
1020 $CustomerNumber = $txtCustomerNumber_SLXUpdate.text
1021 $ID = $TerritoryCombo_SLXUpdate.Text
1022 switch ($ID)
1023 {
1024 *LONG LIST OF ITEMS AND VARIABLE ASSIGMENTS THAT GO WITH EACH ONE* }
1025
1026 }
1027
1028
1029 $pw = get-content C:\PW.txt | convertto-securestring
1030 $creds = New-Object System.Management.Automation.PSCredential -ArgumentList "USERNAME", $pw
1031 $SQLSLXCount = Invoke-DbaQuery -SqlInstance "SERVER" -Database "DATABASE" -SqlCredential $creds -Query "Select count(accountid) from TABLE where InternalAccountNo = @CustomerNum" -SqlParameters @{ CustomerNum = $CustomerNumber}
1032
1033 if (@($SQLSLXCount).count -gt 0) {
1034 *LIST OF QUERIES TO PROPERLY UPDATE EVERYTHING CORRECTLY*
1035 [System.Windows.Forms.MessageBox]::Show('Account Updated Successfully!')
1036 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "SLX Account Update - Account $CustomerNumber was updated to Territory $ID by $env:USERNAME."
1037
1038 }
1039 else{
1040 [System.Media.SystemSounds]::Exclamation.Play()
1041 [System.Windows.Forms.MessageBox]::Show('Account Does Not Exist!','Error!')
1042 throw $_
1043 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 111 -EntryType Error -Message "SLX Account Update - Account $CustomerNumber does not exist in SLX."
1044 }
1045 }
1046 else{
1047 [System.Media.SystemSounds]::Exclamation.Play()
1048 [System.Windows.Forms.MessageBox]::Show('Please select a Territory.','Invalid ID')
1049 }
1050}
1051 $btnUpdateLead_LeadUpdate_Click={
1052 import-module dbatools
1053 if($TerritoryCombo_LeadUpdate.Text){
1054 $LeadID = $txtLeadID_LeadUpdate.text
1055 $LID = $TerritoryCombo_LeadUpdate.Text
1056 switch ($LID)
1057 {
1058 *LONG LIST OF ITEMS AND VARIABLE ASSIGMENTS THAT GO WITH EACH ONE* }
1059
1060 }
1061
1062
1063 $pw = get-content C:\PW.txt | convertto-securestring
1064 $creds = New-Object System.Management.Automation.PSCredential -ArgumentList "USERNAME", $pw
1065 $SQLLeadCount = Invoke-DbaQuery -SqlInstance "SERVER" -Database "DATABASE" -SqlCredential $creds -Query "Select count(leadid) from TABLE where leadid = @lead" -SqlParameters @{ lead = $LeadID}
1066
1067 if (@($SQLLeadCount).count -gt 0) {
1068 $SQLLead = Invoke-DbaQuery -SqlInstance "SERVER" -Database "DATABASE" -SqlCredential $creds -Query "update TABLE set TABLE.ACCOUNTMANAGERID = '$mgr', TABLE.seccodeid = '$subsec', TABLE.SALESPERSONID = '$LID' where TABLE.leadid = '$LeadID'"
1069
1070 [System.Windows.Forms.MessageBox]::Show('Lead Updated Successfully!')
1071
1072 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "SLX Account Update - Lead $LeadID was updated to Territory $LID by $env:USERNAME."
1073
1074 }
1075 else{
1076 [System.Media.SystemSounds]::Exclamation.Play()
1077 [System.Windows.Forms.MessageBox]::Show('Lead Does Not Exist!','Error!')
1078 throw $_
1079 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 111 -EntryType Error -Message "SLX Account Update - Lead $LeadID does not exist in SLX."
1080 }
1081 }
1082 else{
1083 [System.Media.SystemSounds]::Exclamation.Play()
1084 [System.Windows.Forms.MessageBox]::Show('Please select a Territory.','Invalid ID')
1085 }
1086}
1087 #PC Info Controls
1088 $btnGetInfo_info_Click={
1089
1090 $PCName_Info = $ComputerCombo_info.text
1091 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 222 -EntryType Information -Message "PC Info - Get Info for computer $PCName_Info ran on $env:COMPUTERNAME by $env:USERNAME."
1092 $pw = get-content C:\PW.txt | convertto-securestring
1093 $creds = New-Object System.Management.Automation.PSCredential -ArgumentList "USERNAME", $pw
1094
1095 Try {
1096 $result = Test-WSMan -ComputerName $PCName_Info -ErrorAction Stop
1097
1098 #Get Windows and Office Keys
1099 $SQLPcWinQuery = Invoke-DbaQuery -SqlInstance "SERVER" -Database "DATABASE" -SqlCredential $creds -Query "select [WINDOWS 10] from TABLE where COMPUTERNAME = @PCName" -SqlParameters @{ PCName = $PCName_info} | select -expand "Windows 10"
1100 $SQLPcOfficeQuery = Invoke-DbaQuery -SqlInstance "SERVER" -Database "DATABASE" -SqlCredential $creds -Query "select [OFFICE 2010] from TABLE where COMPUTERNAME = @PCName" -SqlParameters @{ PCName = $PCName_info} | select -expand "Office 2010"
1101
1102 #Get Computer Information
1103 $Option = New-CimSessionOption -Protocol Dcom
1104 $Session = New-CimSession -ComputerName $PCName_Info -SessionOption $Option
1105
1106 $OperatingSystem = Get-CimInstance -CimSession $Session -ClassName Win32_OperatingSystem
1107 $Networks = Get-CimInstance -CimSession $Session -ClassName Win32_NetworkAdapterConfiguration -EA Stop | ? {$_.IPEnabled}
1108 $OrgUnit = Split-Path (Get-ADComputer $PCName_Info -Properties CanonicalName).CanonicalName -Parent | split-path -leaf
1109 $disk = Invoke-Command -ComputerName $PCName_Info {Get-PSDrive C} | Select-Object -expand Free
1110 $freespace = [math]::truncate($disk/1GB)
1111 $OS = $OperatingSystem | Select-Object -ExpandProperty Caption
1112 $Version = Invoke-Command -ComputerName $PCName_Info {Get-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name ReleaseId} | Select-Object -expand Releaseid
1113 $Build = Get-CimInstance -ClassName Win32_OperatingSystem -CimSession $Session | Select-Object -ExpandProperty "Version"
1114 $Build2 = Invoke-Command -ComputerName $PCName_Info {Get-ItemProperty "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion" -Name UBR} | select -expand UBR
1115 $LastBoot = $OperatingSystem | Select-Object -ExpandProperty LastBootUpTime
1116 $OSArch = $OperatingSystem | Select-Object -ExpandProperty OSArchitecture
1117 $CN_Name = $OperatingSystem | Select-Object -ExpandProperty CSName
1118 $IP = $Networks.IpAddress[0]
1119
1120 $lblPCName_result.Text = $CN_Name
1121 $lblOU_result.Text = $OrgUnit
1122 $lblOSName_result.Text = $OS
1123 $lblVersion_result.Text = $Version
1124 $lblBuild_result.Text = "$Build.$Build2"
1125 $lblIP_result.Text = $IP
1126 $lblFreeSpace_result.Text = "$freespace GB"
1127 $lblLastBoot_result.Text = $LastBoot
1128 $lblWinKey_result.Text = $SQLPcWinQuery
1129 $lblOfficeKey_result.Text = $SQLPcOfficeQuery
1130
1131 Get-CimSession | Remove-CimSession
1132 }catch {
1133 [System.Media.SystemSounds]::Exclamation.Play()
1134 [System.Windows.Forms.MessageBox]::Show("Remote Management is not Enabled `nor the Computer is turned Off",'Error!')
1135
1136 $lblPCName_result.Text = ''
1137 $lblOU_result.Text = ''
1138 $lblOSName_result.Text = ''
1139 $lblVersion_result.Text = ''
1140 $lblBuild_result.Text = ''
1141 $lblIP_result.Text = ''
1142 $lblFreeSpace_result.Text = ''
1143 $lblLastBoot_result.Text = ''
1144 $lblWinKey_result.Text = ''
1145 $lblOfficeKey_result.Text = ''
1146
1147 Write-EventLog -ComputerName "Server1" -LogName Application -Source "ITTool" -EventID 111 -EntryType Error -Message "PC Info Error - Remote Management is not Enabled or the Computer is turned Off on $PCName_Info"
1148 }
1149}
1150
1151 # --End User Generated Script--
1152 #----------------------------------------------
1153 #region Generated Events
1154 #----------------------------------------------
1155
1156 $Form_StateCorrection_Load=
1157 {
1158 #Correct the initial state of the form to prevent the .Net maximized form issue
1159 $form1.WindowState = $InitialFormWindowState
1160 }
1161
1162 $Form_Cleanup_FormClosed=
1163 {
1164 #Remove all event handlers from the controls
1165 try
1166 {
1167 $textbox2.remove_TextChanged($textbox2_TextChanged)
1168 $form1.remove_Load($form1_Load)
1169 $form1.remove_Load($Form_StateCorrection_Load)
1170 $form1.remove_FormClosed($Form_Cleanup_FormClosed)
1171 }
1172 catch { Out-Null <# Prevent PSScriptAnalyzer warning #> }
1173 }
1174 #endregion Generated Events
1175
1176 #----------------------------------------------
1177 #region Generated Form Code
1178 #----------------------------------------------
1179 $form1.SuspendLayout()
1180 $tabcontrol1.SuspendLayout()
1181 $tabpage1.SuspendLayout()
1182 $tabpage2.SuspendLayout()
1183 $tabpage3.SuspendLayout()
1184 $tabpage4.SuspendLayout()
1185 $tabpage5.SuspendLayout()
1186 #
1187 # form1
1188 #
1189 $form1.Controls.Add($tabcontrol1)
1190 $form1.AutoScaleDimensions = '6, 13'
1191 $form1.AutoScaleMode = 'Font'
1192 $form1.ClientSize = '754, 398'
1193 $form1.FormBorderStyle = 'FixedSingle'
1194 $form1.Name = 'form1'
1195 $form1.Text = ' IT Help Desk Tool v2.0'
1196 $form1.add_Load($form1_Load)
1197 $form1.Icon = '\\SERVER\Powershell Repo\question.ico'
1198 #
1199 # tabcontrol1
1200 #
1201 $tabcontrol1.Controls.Add($tabpage1)
1202 $tabcontrol1.Controls.Add($tabpage2)
1203 $tabcontrol1.Controls.Add($tabpage3)
1204 $tabcontrol1.Controls.Add($tabpage4)
1205 $tabcontrol1.Controls.Add($tabpage5)
1206 $tabcontrol1.Controls.Add($tabpage6)
1207 $tabcontrol1.Location = '5, 1'
1208 $tabcontrol1.Name = 'tabcontrol1'
1209 $tabcontrol1.SelectedIndex = 0
1210 $tabcontrol1.Size = '743, 392'
1211 $tabcontrol1.TabIndex = 0
1212 #
1213 # tabpage1
1214 #
1215 $tabpage1.Controls.Add($lblEmail_Email)
1216 $tabpage1.Controls.Add($btnGetEmailPW_Email)
1217 $tabpage1.Controls.Add($btnClearForm_Email)
1218 $tabpage1.Controls.Add($txtUserName_Email)
1219 $tabpage1.Controls.Add($lblUserName_Email)
1220 $tabpage1.Controls.Add($txtEmailPW_Email)
1221 $tabpage1.Controls.Add($lblEmailPW_Email)
1222 $tabpage1.Controls.Add($lblNotify_Email)
1223 $tabpage1.Controls.Add($lblPortal_Portal)
1224 $tabpage1.Controls.Add($btnGetPortalPW_Portal)
1225 $tabpage1.Controls.Add($btnClearForm_Portal)
1226 $tabpage1.Controls.Add($txtUserName_Portal)
1227 $tabpage1.Controls.Add($lblUserName_Portal)
1228 $tabpage1.Controls.Add($txtPortalPW_Portal)
1229 $tabpage1.Controls.Add($lblPortalPW_Portal)
1230 $tabpage1.Controls.Add($lblNotify_Portal)
1231 $tabpage1.Controls.Add($lblMTP_MTP)
1232 $tabpage1.Controls.Add($btnGetMTPPW_MTP)
1233 $tabpage1.Controls.Add($btnClearForm_MTP)
1234 $tabpage1.Controls.Add($UserNameCombo_MTP)
1235 $tabpage1.Controls.Add($lblUserName_MTP)
1236 $tabpage1.Controls.Add($txtMTPPW_MTP)
1237 $tabpage1.Controls.Add($lblMTPPW_MTP)
1238 $tabpage1.Controls.Add($lblNotify_MTP)
1239 $tabpage1.Controls.Add($lblLaps_Laps)
1240 $tabpage1.Controls.Add($btnGetLapsPW_Laps)
1241 $tabpage1.Controls.Add($btnClearForm_Laps)
1242 $tabpage1.Controls.Add($PCNameCombo_Laps)
1243 $tabpage1.Controls.Add($lblPCName_Laps)
1244 $tabpage1.Controls.Add($txtLapsPW_Laps)
1245 $tabpage1.Controls.Add($lblLapsPW_Laps)
1246 $tabpage1.Controls.Add($lblNotify_Laps)
1247 $tabpage1.Controls.Add($lblEmployeeNumber_ADPW)
1248 $tabpage1.Controls.Add($btnUpdateEmailPW_ADPW)
1249 $tabpage1.Controls.Add($txtUserName_ADPW)
1250 $tabpage1.Controls.Add($lblUserName_ADPW)
1251 $tabpage1.Controls.Add($txtEmailPW_ADPW)
1252 $tabpage1.Controls.Add($lblEmailPW_ADPW)
1253 $tabpage1.Controls.Add($lblNotify_ADPW)
1254 $tabpage1.Controls.Add($btnClearForm_ADPW)
1255 $tabpage1.Controls.Add($txtRandomPW_Random)
1256 $tabpage1.Controls.Add($lblRandomPW_Random)
1257 $tabpage1.Controls.Add($btnCreateRandomPW)
1258 $tabpage1.Controls.Add($lblNotify_Random)
1259 $tabpage1.BackColor = '#222222'
1260 $tabpage1.ForeColor = '#c5c9ca'
1261 $tabpage1.Location = '4, 22'
1262 $tabpage1.Name = 'tabpage1'
1263 $tabpage1.Padding = '3, 3, 3, 3'
1264 $tabpage1.Size = '820, 356'
1265 $tabpage1.TabIndex = 0
1266 $tabpage1.Text = 'PW Recovery'
1267 $OULAPS = Get-ADComputer -filter * -Properties name | Sort-Object Name | Select -expand Name
1268
1269 foreach ($computer in $OULAPS) {
1270 $PCNameCombo_Laps.Items.Add($computer)
1271 }
1272 $UserID=@('LIST OF USERS')
1273
1274 foreach ($id in $UserID) {
1275 $UserNameCombo_MTP.Items.Add($id)
1276 }
1277 #
1278 # lblEmail_Email
1279 #
1280 $lblEmail_Email.Location = '104, 24'
1281 $lblEmail_Email.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
1282 $lblEmail_Email.Name = 'lblEmail_Email'
1283 $lblEmail_Email.Size = '105, 23'
1284 $lblEmail_Email.TabIndex = 2
1285 $lblEmail_Email.Text = 'Email'
1286 $lblEmail_Email.UseCompatibleTextRendering = $True
1287 #
1288 # btnGetEmailPW_Email
1289 #
1290 $btnGetEmailPW_Email.Location = '75, 124'
1291 $btnGetEmailPW_Email.Name = 'btnEmailPW'
1292 $btnGetEmailPW_Email.Size = '75, 43'
1293 $btnGetEmailPW_Email.TabIndex = 2
1294 $btnGetEmailPW_Email.Text = 'Get Email Passsword'
1295 $btnGetEmailPW_Email.UseCompatibleTextRendering = $True
1296 $btnGetEmailPW_Email.BackColor = '#2e4058'#BackColor = '#2e4058'
1297 $btnGetEmailPW_Email.add_click({
1298 if($txtUserName_Email.Text){
1299 $btnGetEmailPW_Email_Click.invoke()
1300 }
1301 else{
1302 [System.Media.SystemSounds]::Exclamation.Play()
1303 [System.Windows.Forms.MessageBox]::Show('Please Enter a Username.', 'User Name Error')
1304 }
1305 }
1306 )
1307
1308 #
1309 # btnClearForm_Email
1310 #
1311 $btnClearForm_Email.Location = '149, 124'
1312 $btnClearForm_Email.Name = 'btnClearForm_Email'
1313 $btnClearForm_Email.Size = '75, 43'
1314 $btnClearForm_Email.TabIndex = 2
1315 $btnClearForm_Email.Text = 'Clear Section'
1316 $btnClearForm_Email.UseCompatibleTextRendering = $True
1317 $btnClearForm_Email.BackColor = '#2e4058'
1318 $btnClearForm_Email.add_click($btnClearForm_Email_Click)
1319 #
1320 # txtUserName_Email
1321 #
1322 $txtUserName_Email.Location = '90, 54'
1323 $txtUserName_Email.Name = 'txtUserName_Email'
1324 $txtUserName_Email.Size = '120, 20'
1325 $txtUserName_Email.TabIndex = 1
1326 $txtUserName_Email.add_Keydown($txtUserName_Email_KeyDown)
1327 #
1328 # lblUserName_Email
1329 #
1330 $lblUserName_Email.AutoSize = $True
1331 $lblUserName_Email.Location = '29, 54'
1332 $lblUserName_Email.Name = 'lblUserName_Email'
1333 $lblUserName_Email.Size = '35, 17'
1334 $lblUserName_Email.TabIndex = 0
1335 $lblUserName_Email.Text = 'Username:'
1336 $lblUserName_Email.UseCompatibleTextRendering = $True
1337 #
1338 # txtEmailPW_Email
1339 #
1340 $txtEmailPW_Email.Location = '90, 84'
1341 $txtEmailPW_Email.Name = 'txtEmailPW_Email'
1342 $txtEmailPW_Email.Size = '120, 20'
1343 $txtEmailPW_Email.TabIndex = 1
1344 #
1345 # lblEmailPW_Email
1346 #
1347 $lblEmailPW_Email.AutoSize = $True
1348 $lblEmailPW_Email.Location = '29, 84'
1349 $lblEmailPW_Email.Name = 'lblEmailPW_Email'
1350 $lblEmailPW_Email.Size = '35, 17'
1351 $lblEmailPW_Email.TabIndex = 0
1352 $lblEmailPW_Email.Text = 'Email PW:'
1353 $lblEmailPW_Email.UseCompatibleTextRendering = $True
1354 #
1355 # lblNotify_Email
1356 #
1357 $lblNotify_Email.AutoSize = $True
1358 $lblNotify_Email.Location = '70, 104'
1359 $lblNotify_Email.Name = 'lblNotify_Email'
1360 $lblNotify_Email.Size = '35, 17'
1361 $lblNotify_Email.TabIndex = 0
1362 $lblNotify_Email.Text = ''
1363 $lblNotify_Email.UseCompatibleTextRendering = $True
1364 #
1365 # lblPortal_Portal
1366 #
1367 $lblPortal_Portal.AutoSize = $True
1368 $lblPortal_Portal.Location = '310, 24'
1369 $lblPortal_Portal.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
1370 $lblPortal_Portal.Name = 'lblPortal_Portal'
1371 $lblPortal_Portal.Size = '35, 17'
1372 $lblPortal_Portal.TabIndex = 0
1373 $lblPortal_Portal.Text = 'Portal'
1374 $lblPortal_Portal.UseCompatibleTextRendering = $True
1375 #
1376 # txtUserName_Portal
1377 #
1378 $txtUserName_Portal.Location = '300, 54'
1379 $txtUserName_Portal.Name = 'txtUserName_Portal'
1380 $txtUserName_Portal.Size = '120, 20'
1381 $txtUserName_Portal.TabIndex = 1
1382 $txtUserName_Portal.add_Keydown($txtUserName_Portal_KeyDown)
1383 #
1384 # lblUserName_Portal
1385 #
1386 $lblUserName_Portal.AutoSize = $True
1387 $lblUserName_Portal.Location = '238, 54'
1388 $lblUserName_Portal.Name = 'lblUserName_Portal'
1389 $lblUserName_Portal.Size = '35, 17'
1390 $lblUserName_Portal.TabIndex = 0
1391 $lblUserName_Portal.Text = 'Username:'
1392 $lblUserName_Portal.UseCompatibleTextRendering = $True
1393 #
1394 # txtPortalPW_Portal
1395 #
1396 $txtPortalPW_Portal.Location = '300, 84'
1397 $txtPortalPW_Portal.Name = 'txtPortalPW_Portal'
1398 $txtPortalPW_Portal.Size = '120, 20'
1399 $txtPortalPW_Portal.TabIndex = 1
1400 #
1401 # lblPortalPW_Portal
1402 #
1403 $lblPortalPW_Portal.AutoSize = $True
1404 $lblPortalPW_Portal.Location = '238, 84'
1405 $lblPortalPW_Portal.Name = 'lblPortalPW_Portal'
1406 $lblPortalPW_Portal.Size = '35, 17'
1407 $lblPortalPW_Portal.TabIndex = 0
1408 $lblPortalPW_Portal.Text = 'Portal PW:'
1409 $lblPortalPW_Portal.UseCompatibleTextRendering = $True
1410 #
1411 # lblNotify_Portal
1412 #
1413 $lblNotify_Portal.AutoSize = $True
1414 $lblNotify_Portal.Location = '280, 104'
1415 $lblNotify_Portal.Name = 'lblNotify_Portal'
1416 $lblNotify_Portal.Size = '35, 17'
1417 $lblNotify_Portal.TabIndex = 0
1418 $lblNotify_Portal.Text = ''
1419 $lblNotify_Portal.UseCompatibleTextRendering = $True
1420 #
1421 # btnGetPortalPW_Portal
1422 #
1423 $btnGetPortalPW_Portal.Location = '285, 124'
1424 $btnGetPortalPW_Portal.Name = 'btnGetPortalPW'
1425 $btnGetPortalPW_Portal.Size = '75, 43'
1426 $btnGetPortalPW_Portal.TabIndex = 2
1427 $btnGetPortalPW_Portal.Text = 'Get Portal Passsword'
1428 $btnGetPortalPW_Portal.UseCompatibleTextRendering = $True
1429 $btnGetPortalPW_Portal.BackColor = '#2e4058'
1430 $btnGetPortalPW_Portal.add_click({
1431 if($txtUserName_Portal.Text){
1432 $btnGetPortalPW_Portal_Click.invoke()
1433 }
1434 else{
1435 [System.Media.SystemSounds]::Exclamation.Play()
1436 [System.Windows.Forms.MessageBox]::Show('Please Enter a Username.','User Name Error')
1437 }
1438 }
1439 )
1440
1441 #
1442 # btnClearForm_Portal
1443 #
1444 $btnClearForm_Portal.Location = '359, 124'
1445 $btnClearForm_Portal.Name = 'btnClearForm_Email'
1446 $btnClearForm_Portal.Size = '75, 43'
1447 $btnClearForm_Portal.TabIndex = 2
1448 $btnClearForm_Portal.Text = 'Clear Section'
1449 $btnClearForm_Portal.UseCompatibleTextRendering = $True
1450 $btnClearForm_Portal.BackColor = '#2e4058'
1451 $btnClearForm_Portal.add_click($btnClearForm_Portal_Click)
1452 #
1453 # lblMTP_MTP
1454 #
1455 $lblMTP_MTP.Location = '530, 24'
1456 $lblMTP_MTP.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
1457 $lblMTP_MTP.Name = 'lblMTP_MTP'
1458 $lblMTP_MTP.Size = '105, 23'
1459 $lblMTP_MTP.TabIndex = 2
1460 $lblMTP_MTP.Text = 'MTP Portal'
1461 $lblMTP_MTP.UseCompatibleTextRendering = $True
1462 #
1463 # btnGetMTPPW_MTP
1464 #
1465 $btnGetMTPPW_MTP.Location = '495, 124'
1466 $btnGetMTPPW_MTP.Name = 'btnGetMTPPW_MTP'
1467 $btnGetMTPPW_MTP.Size = '75, 43'
1468 $btnGetMTPPW_MTP.TabIndex = 2
1469 $btnGetMTPPW_MTP.Text = 'Get MTP Passsword'
1470 $btnGetMTPPW_MTP.UseCompatibleTextRendering = $True
1471 $btnGetMTPPW_MTP.BackColor = '#2e4058'#BackColor = '#2e4058'
1472 $btnGetMTPPW_MTP.add_click({
1473 if($UserNameCombo_MTP.Text){
1474 $btnGetMTPPW_MTP_Click.invoke()
1475 }
1476 else{
1477 [System.Media.SystemSounds]::Exclamation.Play()
1478 [System.Windows.Forms.MessageBox]::Show('Please Enter a User Name.', 'User Name Error')
1479 }
1480 }
1481 )
1482 #
1483 # btnClearForm_MTP
1484 #
1485 $btnClearForm_MTP.Location = '569, 124'
1486 $btnClearForm_MTP.Name = 'btnClearForm_MTP'
1487 $btnClearForm_MTP.Size = '75, 43'
1488 $btnClearForm_MTP.TabIndex = 2
1489 $btnClearForm_MTP.Text = 'Clear Section'
1490 $btnClearForm_MTP.UseCompatibleTextRendering = $True
1491 $btnClearForm_MTP.BackColor = '#2e4058'
1492 $btnClearForm_MTP.add_click($btnClearForm_MTP_Click)
1493 #
1494 # UserNameCombo_MTP
1495 #
1496 $UserNameCombo_MTP.Location = '510, 54'
1497 $UserNameCombo_MTP.Name = 'UserNameCombo_MTP'
1498 $UserNameCombo_MTP.Size = '120, 20'
1499 $UserNameCombo_MTP.TabIndex = 1
1500 #
1501 # lblUserName_MTP
1502 #
1503 $lblUserName_MTP.AutoSize = $True
1504 $lblUserName_MTP.Location = '452, 54'
1505 $lblUserName_MTP.Name = 'lblPCName_MTP'
1506 $lblUserName_MTP.Size = '35, 17'
1507 $lblUserName_MTP.TabIndex = 0
1508 $lblUserName_MTP.Text = 'Username:'
1509 $lblUserName_MTP.UseCompatibleTextRendering = $True
1510 #
1511 # txtMTPPW_MTP
1512 #
1513 $txtMTPPW_MTP.Location = '510, 84'
1514 $txtMTPPW_MTP.Name = 'txtMTPPW_MTP'
1515 $txtMTPPW_MTP.Size = '120, 20'
1516 $txtMTPPW_MTP.TabIndex = 1
1517 #
1518 # lblMTPPW_MTP
1519 #
1520 $lblMTPPW_MTP.AutoSize = $True
1521 $lblMTPPW_MTP.Location = '459, 84'
1522 $lblMTPPW_MTP.Name = 'lblMTPPW_MTP'
1523 $lblMTPPW_MTP.Size = '35, 17'
1524 $lblMTPPW_MTP.TabIndex = 0
1525 $lblMTPPW_MTP.Text = 'MTP PW:'
1526 $lblMTPPW_MTP.UseCompatibleTextRendering = $True
1527 #
1528 # lblNotify_MTP
1529 #
1530 $lblNotify_MTP.AutoSize = $True
1531 $lblNotify_MTP.Location = '490, 104'
1532 $lblNotify_MTP.Name = 'lblNotify_MTP'
1533 $lblNotify_MTP.Size = '35, 17'
1534 $lblNotify_MTP.TabIndex = 0
1535 $lblNotify_MTP.Text = ''
1536 $lblNotify_MTP.UseCompatibleTextRendering = $True
1537 #
1538 # lblLaps_Laps
1539 #
1540 $lblLaps_Laps.Location = '550, 220'
1541 $lblLaps_Laps.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
1542 $lblLaps_Laps.Name = 'lblLaps_Laps'
1543 $lblLaps_Laps.Size = '105, 23'
1544 $lblLaps_Laps.TabIndex = 2
1545 $lblLaps_Laps.Text = 'LAPS'
1546 $lblLaps_Laps.UseCompatibleTextRendering = $True
1547 #
1548 # btnGetLapsPW_Laps
1549 #
1550 $btnGetLapsPW_Laps.Location = '495, 315'
1551 $btnGetLapsPW_Laps.Name = 'btnGetLapsPW_Laps'
1552 $btnGetLapsPW_Laps.Size = '75, 43'
1553 $btnGetLapsPW_Laps.TabIndex = 2
1554 $btnGetLapsPW_Laps.Text = 'Get LAPS Passsword'
1555 $btnGetLapsPW_Laps.UseCompatibleTextRendering = $True
1556 $btnGetLapsPW_Laps.BackColor = '#2e4058'#BackColor = '#2e4058'
1557 $btnGetLapsPW_Laps.add_click({
1558 if($PCNameCombo_Laps.Text){
1559 $btnGetLapsPW_Laps_Click.invoke()
1560 }
1561 else{
1562 [System.Media.SystemSounds]::Exclamation.Play()
1563 [System.Windows.Forms.MessageBox]::Show('Please Enter a Computer Name.', 'Computer Name Error')
1564 }
1565 }
1566 )
1567 #
1568 # btnClearForm_Laps
1569 #
1570 $btnClearForm_Laps.Location = '569, 315'
1571 $btnClearForm_Laps.Name = 'btnClearForm_Laps'
1572 $btnClearForm_Laps.Size = '75, 43'
1573 $btnClearForm_Laps.TabIndex = 2
1574 $btnClearForm_Laps.Text = 'Clear Section'
1575 $btnClearForm_Laps.UseCompatibleTextRendering = $True
1576 $btnClearForm_Laps.BackColor = '#2e4058'
1577 $btnClearForm_Laps.add_click($btnClearForm_Laps_Click)
1578 #
1579 # PCNameCombo_Laps
1580 #
1581 $PCNameCombo_Laps.Location = '510, 245'
1582 $PCNameCombo_Laps.Name = 'PCNameCombo_Laps'
1583 $PCNameCombo_Laps.Size = '120, 20'
1584 $PCNameCombo_Laps.TabIndex = 1
1585 #
1586 # lblPCName_Laps
1587 #
1588 $lblPCName_Laps.AutoSize = $True
1589 $lblPCName_Laps.Location = '457, 245'
1590 $lblPCName_Laps.Name = 'lblPCName_Laps'
1591 $lblPCName_Laps.Size = '35, 17'
1592 $lblPCName_Laps.TabIndex = 0
1593 $lblPCName_Laps.Text = 'PC Name:'
1594 $lblPCName_Laps.UseCompatibleTextRendering = $True
1595 #
1596 # txtLapsPW_Laps
1597 #
1598 $txtLapsPW_Laps.Location = '510, 275'
1599 $txtLapsPW_Laps.Name = 'txtLapsPW_Laps'
1600 $txtLapsPW_Laps.Size = '120, 20'
1601 $txtLapsPW_Laps.TabIndex = 1
1602 #
1603 # lblLapsPW_Laps
1604 #
1605 $lblLapsPW_Laps.AutoSize = $True
1606 $lblLapsPW_Laps.Location = '459, 275'
1607 $lblLapsPW_Laps.Name = 'lblLapsPW_Laps'
1608 $lblLapsPW_Laps.Size = '35, 17'
1609 $lblLapsPW_Laps.TabIndex = 0
1610 $lblLapsPW_Laps.Text = 'Laps PW:'
1611 $lblLapsPW_Laps.UseCompatibleTextRendering = $True
1612 #
1613 # lblNotify_Laps
1614 #
1615 $lblNotify_Laps.AutoSize = $True
1616 $lblNotify_Laps.Location = '490, 295'
1617 $lblNotify_Laps.Name = 'lblNotify_Laps'
1618 $lblNotify_Laps.Size = '35, 17'
1619 $lblNotify_Laps.TabIndex = 0
1620 $lblNotify_Laps.Text = ''
1621 $lblNotify_Laps.UseCompatibleTextRendering = $True
1622 #
1623 # txtRandomPW_Random
1624 #
1625 $txtRandomPW_Random.Location = '90, 245'
1626 $txtRandomPW_Random.Name = 'txtRandomPW_Random'
1627 $txtRandomPW_Random.Size = '120, 20'
1628 $txtRandomPW_Random.TabIndex = 1
1629 #
1630 # lblRandomPW_Random
1631 #
1632 $lblRandomPW_Random.AutoSize = $True
1633 $lblRandomPW_Random.Location = '85, 220'
1634 $lblRandomPW_Random.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
1635 $lblRandomPW_Random.Name = 'lblRandomPW_Random'
1636 $lblRandomPW_Random.Size = '35, 17'
1637 $lblRandomPW_Random.TabIndex = 0
1638 $lblRandomPW_Random.Text = 'Random Password'
1639 $lblRandomPW_Random.UseCompatibleTextRendering = $True
1640 #
1641 # lblNotify_Random
1642 #
1643 $lblNotify_Random.AutoSize = $True
1644 $lblNotify_Random.Location = '70, 270'
1645 $lblNotify_Random.Name = 'lblNotify_Random'
1646 $lblNotify_Random.Size = '35, 17'
1647 $lblNotify_Random.TabIndex = 0
1648 $lblNotify_Random.Text = ''
1649 $lblNotify_Random.UseCompatibleTextRendering = $True
1650 #
1651 # btnCreateRandomPW
1652 #
1653 $btnCreateRandomPW.Location = '114, 315'
1654 $btnCreateRandomPW.Name = 'btnCreateRandomPW'
1655 $btnCreateRandomPW.Size = '75, 43'
1656 $btnCreateRandomPW.TabIndex = 2
1657 $btnCreateRandomPW.Text = 'Generate Password'
1658 $btnCreateRandomPW.UseCompatibleTextRendering = $True
1659 $btnCreateRandomPW.BackColor = '#2e4058'
1660 $btnCreateRandomPW.add_click($btnCreateRandomPW_Click)
1661 #
1662 # lblEmployeeNumber_ADPW
1663 #
1664 $lblEmployeeNumber_ADPW.AutoSize = $True
1665 $lblEmployeeNumber_ADPW.Location = '295, 220'
1666 $lblEmployeeNumber_ADPW.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
1667 $lblEmployeeNumber_ADPW.Name = 'lblEmployeeNumber_ADPW'
1668 $lblEmployeeNumber_ADPW.Size = '35, 17'
1669 $lblEmployeeNumber_ADPW.TabIndex = 0
1670 $lblEmployeeNumber_ADPW.Text = 'Update Employee #'
1671 $lblEmployeeNumber_ADPW.UseCompatibleTextRendering = $True
1672 #
1673 # txtUserName_ADPW
1674 #
1675 $txtUserName_ADPW.Location = '300, 245'
1676 $txtUserName_ADPW.Name = 'txtUserName_ADPW'
1677 $txtUserName_ADPW.Size = '120, 20'
1678 $txtUserName_ADPW.TabIndex = 1
1679 $txtUserName_ADPW.add_Keydown($txtUserName_ADPW_KeyDown)
1680 #
1681 # lblUserName_ADPW
1682 #
1683 $lblUserName_ADPW.AutoSize = $True
1684 $lblUserName_ADPW.Location = '238, 245'
1685 $lblUserName_ADPW.Name = 'lblUserName_ADPW'
1686 $lblUserName_ADPW.Size = '35, 17'
1687 $lblUserName_ADPW.TabIndex = 0
1688 $lblUserName_ADPW.Text = 'Username:'
1689 $lblUserName_ADPW.UseCompatibleTextRendering = $True
1690 #
1691 # txtEmailPW_ADPW
1692 #
1693 $txtEmailPW_ADPW.Location = '300, 275'
1694 $txtEmailPW_ADPW.Name = 'txtEmailPW_ADPW'
1695 $txtEmailPW_ADPW.Size = '120, 20'
1696 $txtEmailPW_ADPW.TabIndex = 1
1697 #
1698 # lblEmailPW_ADPW
1699 #
1700 $lblEmailPW_ADPW.AutoSize = $True
1701 $lblEmailPW_ADPW.Location = '238, 275'
1702 $lblEmailPW_ADPW.Name = 'lblEmailPW_ADPW'
1703 $lblEmailPW_ADPW.Size = '35, 17'
1704 $lblEmailPW_ADPW.TabIndex = 0
1705 $lblEmailPW_ADPW.Text = 'Password:'
1706 $lblEmailPW_ADPW.UseCompatibleTextRendering = $True
1707 #
1708 # lblNotify_ADPW
1709 #
1710 $lblNotify_ADPW.AutoSize = $True
1711 $lblNotify_ADPW.Location = '300, 350'
1712 $lblNotify_ADPW.Name = 'lblNotify_ADPW'
1713 $lblNotify_ADPW.Size = '35, 17'
1714 $lblNotify_ADPW.TabIndex = 0
1715 $lblNotify_ADPW.Text = ''
1716 $lblNotify_ADPW.UseCompatibleTextRendering = $True
1717 #
1718 # btnUpdateEmailPW_ADPW
1719 #
1720 $btnUpdateEmailPW_ADPW.Location = '285, 315'
1721 $btnUpdateEmailPW_ADPW.Name = 'btnUpdateEmailPW_ADPW'
1722 $btnUpdateEmailPW_ADPW.Size = '75, 43'
1723 $btnUpdateEmailPW_ADPW.TabIndex = 2
1724 $btnUpdateEmailPW_ADPW.Text = 'Update Employee #'
1725 $btnUpdateEmailPW_ADPW.UseCompatibleTextRendering = $True
1726 $btnUpdateEmailPW_ADPW.BackColor = '#2e4058'
1727 $btnUpdateEmailPW_ADPW.add_click({
1728 if($txtEmailPW_ADPW.Text){
1729 $btnUpdateEmailPW_ADPW_Click.invoke()
1730 }
1731 else{
1732 [System.Media.SystemSounds]::Exclamation.Play()
1733 [System.Windows.Forms.MessageBox]::Show('Password cannot be blank.','Password Error')
1734 }
1735 }
1736 )
1737 #
1738 # btnClearForm_ADPW
1739 #
1740 $btnClearForm_ADPW.Location = '359, 315'
1741 $btnClearForm_ADPW.Name = 'btnClearForm_ADPW'
1742 $btnClearForm_ADPW.Size = '75, 43'
1743 $btnClearForm_ADPW.TabIndex = 2
1744 $btnClearForm_ADPW.Text = 'Clear Section'
1745 $btnClearForm_ADPW.UseCompatibleTextRendering = $True
1746 $btnClearForm_ADPW.BackColor = '#2e4058'
1747 $btnClearForm_ADPW.add_click($btnClearForm_ADPW_Click)
1748 #
1749 # tabpage2
1750 #
1751 Add-Type -Assembly System.Drawing
1752
1753
1754 $tabpage2.Controls.Add($lblBanner_NewUser)
1755 $tabpage2.Controls.Add($lblDept_NewUser)
1756 $tabpage2.Controls.Add($lblExt_NewUser)
1757 $tabpage2.Controls.Add($lblLName_NewUser)
1758 $tabpage2.Controls.Add($lblFName_NewUser)
1759 $tabpage2.Controls.Add($txtExt_NewUser)
1760 $tabpage2.Controls.Add($txtLName_NewUser)
1761 $tabpage2.Controls.Add($txtFName_NewUser)
1762 $tabpage2.Controls.Add($DeptCombo_NewUser)
1763 $tabpage2.Controls.Add($buttonCreateUser_NewUser)
1764 $tabpage2.Controls.Add($lblbanner_disable)
1765 $tabpage2.Controls.Add($lblusername_disable)
1766 $tabpage2.Controls.Add($txtusername_disable)
1767 $tabpage2.Controls.Add($btndisable_disable)
1768 $tabpage2.Controls.Add($btndisableinfo_disable)
1769 $tabpage2.Controls.Add($lblADChanges_ADChanges)
1770 $tabpage2.Controls.Add($lblDateRange_ADChanges)
1771 $tabpage2.Controls.Add($ADRangeCombo_ADChanges)
1772 $tabpage2.Controls.Add($btnADChanges_RunReport)
1773 $tabpage2.Controls.Add($lblbanner_rename)
1774 $tabpage2.Controls.Add($lblcurrent_rename)
1775 $tabpage2.Controls.Add($currentcombo_rename)
1776 $tabpage2.Controls.Add($lblnewname_rename)
1777 $tabpage2.Controls.Add($txtnewname_rename)
1778 $tabpage2.Controls.Add($btnrename_rename)
1779 $tabpage2.BackColor = '#222222'
1780 $tabpage2.ForeColor = '#c5c9ca'
1781 $tabpage2.Location = '4, 22'
1782 $tabpage2.Name = 'tabpage2'
1783 $tabpage2.Padding = '3, 3, 3, 3'
1784 $tabpage2.Size = '820, 356'
1785 $tabpage2.TabIndex = 1
1786 $tabpage2.Text = 'Active Directory'
1787 $tabpage2.UseVisualStyleBackColor = $False
1788 $btnDisableInfo_disable.add_MouseHover($DisableHelp)
1789 $OUName = Get-ADComputer -filter {OperatingSystem -NotLike "*server*"} -Properties name | Sort-Object Name | Select -Expand Name
1790
1791 foreach ($computer in $OUName) {
1792 $currentcombo_rename.Items.Add($computer)
1793 }
1794
1795 $RangeOption=@('PastHour','PastDay','Last7Days','Last14Days')
1796
1797 foreach ($range in $RangeOption) {
1798 $ADRangeCombo_ADChanges.Items.Add($range)
1799 }
1800 #
1801 # lblBanner_NewUser
1802 #
1803 $lblBanner_NewUser.AutoSize = $True
1804 $lblBanner_NewUser.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
1805 $lblBanner_NewUser.Location = '108, 27'
1806 $lblBanner_NewUser.Name = 'lblBanner_NewUser'
1807 $lblBanner_NewUser.Size = '90, 20'
1808 $lblBanner_NewUser.TabIndex = 5
1809 $lblBanner_NewUser.Text = 'New Employee'
1810 #
1811 # lblDept_NewUser
1812 #
1813 $lblDept_NewUser.AutoSize = $True
1814 $lblDept_NewUser.Font = 'Microsoft Sans Serif, 12pt'
1815 $lblDept_NewUser.Location = '28, 153'
1816 $lblDept_NewUser.Name = 'lblDept_NewUser'
1817 $lblDept_NewUser.Size = '96, 24'
1818 $lblDept_NewUser.TabIndex = 8
1819 $lblDept_NewUser.Text = 'Department:'
1820 $lblDept_NewUser.UseCompatibleTextRendering = $True
1821 #
1822 # lblExt_NewUser
1823 #
1824 $lblExt_NewUser.AutoSize = $True
1825 $lblExt_NewUser.Font = 'Microsoft Sans Serif, 12pt'
1826 $lblExt_NewUser.Location = '28, 121'
1827 $lblExt_NewUser.Name = 'lblExt_NewUser'
1828 $lblExt_NewUser.Size = '91, 24'
1829 $lblExt_NewUser.TabIndex = 99
1830 $lblExt_NewUser.Text = 'Phone Ext.:'
1831 $lblExt_NewUser.UseCompatibleTextRendering = $True
1832 #
1833 # lblLName_NewUser
1834 #
1835 $lblLName_NewUser.AutoSize = $True
1836 $lblLName_NewUser.Font = 'Microsoft Sans Serif, 12pt'
1837 $lblLName_NewUser.Location = '28, 89'
1838 $lblLName_NewUser.Name = 'lblLName_NewUser'
1839 $lblLName_NewUser.Size = '90, 24'
1840 $lblLName_NewUser.TabIndex = 6
1841 $lblLName_NewUser.Text = 'Last Name:'
1842 $lblLName_NewUser.UseCompatibleTextRendering = $True
1843 #
1844 # lblFName_NewUser
1845 #
1846 $lblFName_NewUser.AutoSize = $True
1847 $lblFName_NewUser.Font = 'Microsoft Sans Serif, 12pt'
1848 $lblFName_NewUser.Location = '28, 57'
1849 $lblFName_NewUser.Name = 'lblFName_NewUser'
1850 $lblFName_NewUser.Size = '90, 20'
1851 $lblFName_NewUser.TabIndex = 5
1852 $lblFName_NewUser.Text = 'First Name:'
1853 #
1854 # txtExt_NewUser
1855 #
1856 $txtExt_NewUser.Location = '133, 121'
1857 $txtExt_NewUser.Name = 'txtExt_NewUser'
1858 $txtExt_NewUser.Size = '127, 20'
1859 $txtExt_NewUser.TabIndex = 7
1860 #
1861 # txtLName_NewUser
1862 #
1863 $txtLName_NewUser.Location = '133, 89'
1864 $txtLName_NewUser.Name = 'txtLName_NewUser'
1865 $txtLName_NewUser.Size = '127, 20'
1866 $txtLName_NewUser.TabIndex = 1
1867 #
1868 # txtFName_NewUser
1869 #
1870 $txtFName_NewUser.Location = '133, 57'
1871 $txtFName_NewUser.Name = 'txtFName_NewUser'
1872 $txtFName_NewUser.Size = '127, 20'
1873 $txtFName_NewUser.TabIndex = 0
1874 #
1875 # DeptCombo_NewUser
1876 #
1877 $DeptCombo_NewUser.FormattingEnabled = $True
1878 [void]$DeptCombo_NewUser.Items.Add('Accounting')
1879 [void]$DeptCombo_NewUser.Items.Add('Inside Sales')
1880 [void]$DeptCombo_NewUser.Items.Add('Lab')
1881 [void]$DeptCombo_NewUser.Items.Add('Marketing')
1882 [void]$DeptCombo_NewUser.Items.Add('Order Processing')
1883 [void]$DeptCombo_NewUser.Items.Add('Outside Sales')
1884 [void]$DeptCombo_NewUser.Items.Add('Warehouse')
1885 $DeptCombo_NewUser.Location = '133, 153'
1886 $DeptCombo_NewUser.Name = 'combobox1'
1887 $DeptCombo_NewUser.Size = '127, 21'
1888 $DeptCombo_NewUser.TabIndex = 8
1889 $tabpage2.ResumeLayout()
1890 $tabpage1.ResumeLayout()
1891 $tabcontrol1.ResumeLayout()
1892 $form1.ResumeLayout()
1893 #
1894 # buttonCreateUser_NewUser
1895 #
1896 $buttonCreateUser_NewUser.Location = '153, 184'
1897 $buttonCreateUser_NewUser.Name = 'buttonCreateUser_NewUser'
1898 $buttonCreateUser_NewUser.Size = '88, 44'
1899 $buttonCreateUser_NewUser.TabIndex = 9
1900 $buttonCreateUser_NewUser.Text = 'Create User'
1901 $buttonCreateUser_NewUser.UseCompatibleTextRendering = $True
1902 $buttonCreateUser_NewUser.BackColor = '#2e4058'
1903 $buttonCreateUser_NewUser.add_Click({
1904 if($txtFName_NewUser.Text -and $txtLName_NewUser.Text -and $txtExt_NewUser.Text -and $DeptCombo_NewUser.Text){
1905 $buttonCreateUser_NewUser_Click.invoke()
1906 }
1907 else{
1908 [System.Media.SystemSounds]::Exclamation.Play()
1909 [System.Windows.Forms.MessageBox]::Show('Please Fill Out All Fields', 'Missing Fields')
1910 }
1911 }
1912 )
1913
1914 #
1915 # txtusername_disable
1916 #
1917 $txtusername_disable.Location = '355, 275'
1918 $txtusername_disable.Name = 'txtusername_disable'
1919 $txtusername_disable.Size = '127, 20'
1920 $txtusername_disable.TabIndex = 10
1921 #
1922 # lblbanner_disable
1923 #
1924 $lblbanner_disable.AutoSize = $True
1925 $lblbanner_disable.Location = '375, 253'
1926 $lblbanner_disable.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
1927 $lblbanner_disable.Name = 'lblbanner_disable'
1928 $lblbanner_disable.Size = '35, 17'
1929 $lblbanner_disable.TabIndex = 98
1930 $lblbanner_disable.Text = 'Disable User'
1931 $lblbanner_disable.UseCompatibleTextRendering = $True
1932 #
1933 # lblusername_disable
1934 #
1935 $lblusername_disable.AutoSize = $True
1936 $lblusername_disable.Location = '265, 275'
1937 $lblusername_disable.Font = 'Microsoft Sans Serif, 12pt'
1938 $lblusername_disable.Name = 'lblusername_disable'
1939 $lblusername_disable.Size = '35, 17'
1940 $lblusername_disable.TabIndex = 0
1941 $lblusername_disable.Text = 'Username:'
1942 $lblusername_disable.UseCompatibleTextRendering = $True
1943 #
1944 # btndisable_disable
1945 #
1946 $btndisable_disable.Location = '385, 305'
1947 $btndisable_disable.Name = 'btndisable_disable'
1948 $btndisable_disable.Size = '75, 43'
1949 $btndisable_disable.TabIndex = 11
1950 $btndisable_disable.Text = 'Disable User'
1951 $btndisable_disable.UseCompatibleTextRendering = $True
1952 $btndisable_disable.BackColor = '#2e4058'
1953 $btndisable_disable.add_click({
1954 if($txtusername_disable.Text){
1955 $btndisable_disable_Click.invoke()
1956 }
1957 else{
1958 [System.Media.SystemSounds]::Exclamation.Play()
1959 [System.Windows.Forms.MessageBox]::Show('Please enter a Username.','Error')
1960 }
1961 }
1962 )
1963 #
1964 #
1965 #
1966 $disableinfo = [System.Drawing.Image]::FromFile("SERVER\Powershell Repo\Information-11.jpg")
1967 $btnDisableInfo_disable.Location = '490, 272'
1968 $btnDisableInfo_disable.Name = 'btnDisableInfo_disable'
1969 $btnDisableInfo_disable.Size = '25, 25'
1970 $btnDisableInfo_disable.TabIndex = 9
1971 $btnDisableInfo_disable.Image = $disableinfo
1972 $btnDisableInfo_disable.UseCompatibleTextRendering = $True
1973 $btnDisableInfo_disable.BackColor = '#2e4058'
1974 #
1975 # lblADChanges_ADChanges
1976 #
1977 $lblADChanges_ADChanges.AutoSize = $True
1978 $lblADChanges_ADChanges.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
1979 $lblADChanges_ADChanges.Location = '88, 253'
1980 $lblADChanges_ADChanges.Name = 'lblADChanges_ADChanges'
1981 $lblADChanges_ADChanges.Size = '96, 24'
1982 $lblADChanges_ADChanges.TabIndex = 8
1983 $lblADChanges_ADChanges.Text = 'AD Changes Report'
1984 $lblADChanges_ADChanges.UseCompatibleTextRendering = $True
1985 #
1986 #lblDateRange_ADChanges
1987 #
1988 $lblDateRange_ADChanges.AutoSize = $True
1989 $lblDateRange_ADChanges.Font = 'Microsoft Sans Serif, 12pt'
1990 $lblDateRange_ADChanges.Location = '20, 275'
1991 $lblDateRange_ADChanges.Name = 'lblDateRange_ADChanges'
1992 $lblDateRange_ADChanges.Size = '90, 20'
1993 $lblDateRange_ADChanges.TabIndex = 5
1994 $lblDateRange_ADChanges.Text = 'Select Range:'
1995 #
1996 # ADRangeCombo_ADChanges
1997 #
1998 $ADRangeCombo_ADChanges.Location = '133, 275'
1999 $ADRangeCombo_ADChanges.Name = 'ADRangeCombo_ADChanges'
2000 $ADRangeCombo_ADChanges.Size = '120, 20'
2001 $ADRangeCombo_ADChanges.TabIndex = 1
2002 #
2003 # btnADChanges_RunReport
2004 #
2005 $btnADChanges_RunReport.Location = '153, 305'
2006 $btnADChanges_RunReport.Name = 'btnADChanges_RunReport'
2007 $btnADChanges_RunReport.Size = '88, 44'
2008 $btnADChanges_RunReport.TabIndex = 2
2009 $btnADChanges_RunReport.Text = 'Run Report'
2010 $btnADChanges_RunReport.UseCompatibleTextRendering = $True
2011 $btnADChanges_RunReport.BackColor = '#2e4058'
2012 $btnADChanges_RunReport.add_click($btnADChanges_RunReport_Click)
2013 #
2014 # lblbanner_rename
2015 #
2016 $lblbanner_rename.AutoSize = $True
2017 $lblbanner_rename.Location = '345, 27'
2018 $lblbanner_rename.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
2019 $lblbanner_rename.Name = 'lblbanner_rename'
2020 $lblbanner_rename.Size = '35, 17'
2021 $lblbanner_rename.TabIndex = 0
2022 $lblbanner_rename.Text = 'Rename Computer'
2023 $lblbanner_rename.UseCompatibleTextRendering = $True
2024 #
2025 # lblcurrent_rename
2026 #
2027 $lblcurrent_rename.AutoSize = $True
2028 $lblcurrent_rename.Location = '300, 57'
2029 $lblcurrent_rename.Font = 'Microsoft Sans Serif, 12pt'
2030 $lblcurrent_rename.Name = 'lblcurrent_rename'
2031 $lblcurrent_rename.Size = '35, 17'
2032 $lblcurrent_rename.TabIndex = 0
2033 $lblcurrent_rename.Text = 'Name:'
2034 $lblcurrent_rename.UseCompatibleTextRendering = $True
2035 #
2036 # currentcombo_rename
2037 #
2038 $currentcombo_rename.Location = '355, 57'
2039 $currentcombo_rename.Name = 'currentcombo_rename'
2040 $currentcombo_rename.Size = '127, 20'
2041 $currentcombo_rename.TabIndex = 12
2042 #
2043 # lblusername_rename
2044 #
2045 $lblnewname_rename.AutoSize = $True
2046 $lblnewname_rename.Location = '263, 89'
2047 $lblnewname_rename.Font = 'Microsoft Sans Serif, 12pt'
2048 $lblnewname_rename.Name = 'lblnewname_rename'
2049 $lblnewname_rename.Size = '35, 17'
2050 $lblnewname_rename.TabIndex = 0
2051 $lblnewname_rename.Text = 'New Name:'
2052 $lblnewname_rename.UseCompatibleTextRendering = $True
2053 #
2054 # txtcurrent_rename
2055 #
2056 $txtnewname_rename.Location = '355, 89'
2057 $txtnewname_rename.Name = 'txtnewname_rename'
2058 $txtnewname_rename.Size = '127, 20'
2059 $txtnewname_rename.TabIndex = 13
2060 #
2061 # btnrename_rename
2062 #
2063 $btnrename_rename.Location = '385, 120'
2064 $btnrename_rename.Name = 'btndisable_rename'
2065 $btnrename_rename.Size = '75, 43'
2066 $btnrename_rename.TabIndex = 14
2067 $btnrename_rename.Text = 'Rename Computer'
2068 $btnrename_rename.UseCompatibleTextRendering = $True
2069 $btnrename_rename.BackColor = '#2e4058'
2070 $btnrename_rename.add_click({
2071 if($currentcombo_rename.Text -and $txtnewname_rename.Text){
2072 $btnrename_rename_Click.invoke()
2073 }
2074 else{
2075 [System.Media.SystemSounds]::Exclamation.Play()
2076 [System.Windows.Forms.MessageBox]::Show('Please Fill Out Both Names', 'Missing Fields')
2077 }
2078 }
2079 )
2080 #
2081 #
2082 # Phone System Tab --------------------------------------------------------------------------------------
2083 #
2084 #
2085 $tabpage3.Controls.Add($date_startcall_report)
2086 $tabpage3.Controls.Add($date_endcall_report)
2087 $tabpage3.Controls.Add($btninbound_report)
2088 $tabpage3.Controls.Add($btnoutbound_report)
2089 $tabpage3.Controls.Add($lblcallhistory_report)
2090 $tabpage3.Controls.Add($txtextension_report)
2091 $tabpage3.Controls.Add($lblextension_report)
2092 $tabpage3.Controls.Add($lblstartcall_report)
2093 $tabpage3.Controls.Add($lblendcall_report)
2094 $tabpage3.BackColor = '#222222'
2095 $tabpage3.ForeColor = '#c5c9ca'
2096 $tabpage3.Location = '4, 22'
2097 $tabpage3.Name = 'tabpage3'
2098 $tabpage3.Padding = '3, 3, 3, 3'
2099 $tabpage3.Size = '820, 356'
2100 $tabpage3.TabIndex = 2
2101 $tabpage3.Text = 'Phone System'
2102 $tabpage3.UseVisualStyleBackColor = $False
2103 #
2104 #lblcallhistory_report
2105 #
2106 $lblcallhistory_report.AutoSize = $True
2107 $lblcallhistory_report.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
2108 $lblcallhistory_report.Location = '84, 27'
2109 $lblcallhistory_report.Name = 'lblcallhistory_report'
2110 $lblcallhistory_report.Size = '90, 20'
2111 $lblcallhistory_report.TabIndex = 5
2112 $lblcallhistory_report.Text = 'Call History'
2113 #
2114 #lblextension_report
2115 #
2116 $lblextension_report.AutoSize = $True
2117 $lblextension_report.Font = 'Microsoft Sans Serif, 12pt'
2118 $lblextension_report.Location = '28, 57'
2119 $lblextension_report.Name = 'lblextension_report'
2120 $lblextension_report.Size = '90, 20'
2121 $lblextension_report.TabIndex = 5
2122 $lblextension_report.Text = 'Extension:'
2123 #
2124 #txtextension_report
2125 #
2126 $txtextension_report.Location = '110, 57'
2127 $txtextension_report.Name = 'txtextension_report'
2128 $txtextension_report.Size = '87, 20'
2129 $txtextension_report.TabIndex = 0
2130 #
2131 #lblstartcall_report
2132 #
2133 $lblstartcall_report.AutoSize = $True
2134 $lblstartcall_report.Font = 'Microsoft Sans Serif, 12pt'
2135 $lblstartcall_report.Location = '28, 87'
2136 $lblstartcall_report.Name = 'lblstartcall_report'
2137 $lblstartcall_report.Size = '90, 20'
2138 $lblstartcall_report.TabIndex = 5
2139 $lblstartcall_report.Text = 'Start Date:'
2140 #
2141 #date_startcall_report
2142 #
2143 $date_startcall_report.Location = '110, 87'
2144 $date_startcall_report.Name = 'date_startcall_report'
2145 $date_startcall_report.TabIndex = 1
2146 #
2147 #lblendcall_report
2148 #
2149 $lblendcall_report.AutoSize = $True
2150 $lblendcall_report.Font = 'Microsoft Sans Serif, 12pt'
2151 $lblendcall_report.Location = '28, 117'
2152 $lblendcall_report.Name = 'lblendcall_report'
2153 $lblendcall_report.Size = '90, 20'
2154 $lblendcall_report.TabIndex = 5
2155 $lblendcall_report.Text = 'End Date:'
2156 #
2157 #date_endcall_report
2158 #
2159 $date_endcall_report.Location = '110, 117'
2160 $date_endcall_report.Name = 'date_endcall_report'
2161 $date_endcall_report.TabIndex = 2
2162 #
2163 #btninbound_report
2164 #
2165 $btninbound_report.Location = '53, 164'
2166 $btninbound_report.Name = 'btninbound_report'
2167 $btninbound_report.Size = '88, 44'
2168 $btninbound_report.TabIndex = 4
2169 $btninbound_report.Text = 'Inbound Call Report'
2170 $btninbound_report.UseCompatibleTextRendering = $True
2171 $btninbound_report.BackColor = '#2e4058'
2172 $btninbound_report.add_click({
2173 if($txtextension_report.Text){
2174 $btninbound_report_Click.invoke()
2175 }
2176 else{
2177 [System.Media.SystemSounds]::Exclamation.Play()
2178 [System.Windows.Forms.MessageBox]::Show('Please enter an extension.','Invalid Extension')
2179 }
2180 }
2181 )
2182 #
2183 #btnoutbound_report
2184 #
2185 $btnoutbound_report.Location = '153, 164'
2186 $btnoutbound_report.Name = 'btnoutbound_report'
2187 $btnoutbound_report.Size = '88, 44'
2188 $btnoutbound_report.TabIndex = 4
2189 $btnoutbound_report.Text = 'Outbound Call Report'
2190 $btnoutbound_report.UseCompatibleTextRendering = $True
2191 $btnoutbound_report.BackColor = '#2e4058'
2192 $btnoutbound_report.add_click({
2193 if($txtextension_report.Text){
2194 $btnoutbound_report_Click.invoke()
2195 }
2196 else{
2197 [System.Media.SystemSounds]::Exclamation.Play()
2198 [System.Windows.Forms.MessageBox]::Show('Please enter an extension.','Invalid Extension')
2199 }
2200 }
2201 )
2202 #
2203 #
2204 # Great Plains Tab ---------------------------------------------------------------------------------------
2205 #
2206 #
2207 $tabpage4.Controls.Add($lblStuckTransfer_GP)
2208 $tabpage4.Controls.Add($txtStuckTransfer_GP)
2209 $tabpage4.Controls.Add($btnStuckTransfer_GP)
2210 $tabpage4.Controls.Add($lblFulfilled_GP)
2211 $tabpage4.Controls.Add($txtFulfilled_GP)
2212 $tabpage4.Controls.Add($btnFulfilled_GP)
2213 $tabpage4.Controls.Add($btnClearTransfer_GP)
2214 $tabpage4.BackColor = '#222222'
2215 $tabpage4.ForeColor = '#c5c9ca'
2216 $tabpage4.Location = '4, 22'
2217 $tabpage4.Name = 'tabpage4'
2218 $tabpage4.Padding = '3, 3, 3, 3'
2219 $tabpage4.Size = '820, 356'
2220 $tabpage4.TabIndex = 2
2221 $tabpage4.Text = 'Great Plains'
2222 $tabpage4.UseVisualStyleBackColor = $False
2223 #
2224 #lblStuckTransfer_GP
2225 #
2226 $lblStuckTransfer_GP.AutoSize = $True
2227 $lblStuckTransfer_GP.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
2228 $lblStuckTransfer_GP.Location = '44, 27'
2229 $lblStuckTransfer_GP.Name = 'lblStuckTransfer_GP'
2230 $lblStuckTransfer_GP.Size = '90, 20'
2231 $lblStuckTransfer_GP.TabIndex = 5
2232 $lblStuckTransfer_GP.Text = 'Stuck Transfer Check'
2233 #
2234 #txtStuckTransfer_GP
2235 #
2236 $txtStuckTransfer_GP.Location = '70, 57'
2237 $txtStuckTransfer_GP.Name = 'txtStuckTransfer_GP'
2238 $txtStuckTransfer_GP.Size = '87, 20'
2239 $txtStuckTransfer_GP.TabIndex = 0
2240 #
2241 #btnStuckTransfer_GP
2242 #
2243 $btnStuckTransfer_GP.Location = '70, 85'
2244 $btnStuckTransfer_GP.Name = 'btnStuckTransfer_GP'
2245 $btnStuckTransfer_GP.Size = '88, 44'
2246 $btnStuckTransfer_GP.TabIndex = 4
2247 $btnStuckTransfer_GP.Text = 'Check Table'
2248 $btnStuckTransfer_GP.UseCompatibleTextRendering = $True
2249 $btnStuckTransfer_GP.BackColor = '#2e4058'
2250 $btnStuckTransfer_GP.add_click($btnStuckTransfer_GP_Click)
2251 #
2252 #btnClearTransfer_GP
2253 #
2254 $btnClearTransfer_GP.Location = '70, 135'
2255 $btnClearTransfer_GP.Name = 'btnClearTransfer_GP'
2256 $btnClearTransfer_GP.Size = '88, 44'
2257 $btnClearTransfer_GP.TabIndex = 4
2258 $btnClearTransfer_GP.Text = 'Clear Table'
2259 $btnClearTransfer_GP.UseCompatibleTextRendering = $True
2260 $btnClearTransfer_GP.BackColor = '#2e4058'
2261 $btnClearTransfer_GP.add_click($btnClearTransfer_GP_Click)
2262 #
2263 #lblFulfilled_GP
2264 #
2265 $lblFulfilled_GP.AutoSize = $True
2266 $lblFulfilled_GP.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
2267 $lblFulfilled_GP.Location = '235, 27'
2268 $lblFulfilled_GP.Name = 'lblFulfilled_GP'
2269 $lblFulfilled_GP.Size = '90, 20'
2270 $lblFulfilled_GP.TabIndex = 5
2271 $lblFulfilled_GP.Text = 'Fulfilled Batch Check'
2272 #
2273 #txtFulfilled_GP
2274 #
2275 $txtFulfilled_GP.Location = '260, 57'
2276 $txtFulfilled_GP.Name = 'txtFulfilled_GP'
2277 $txtFulfilled_GP.Multiline = $True
2278 $txtFulfilled_GP.Size = '87, 20'
2279 $txtFulfilled_GP.TabIndex = 0
2280 #
2281 #btnFulfilled_GP
2282 #
2283 $btnFulfilled_GP.Location = '260, 85'
2284 $btnFulfilled_GP.Name = 'btnFulfilled_GP'
2285 $btnFulfilled_GP.Size = '88, 44'
2286 $btnFulfilled_GP.TabIndex = 4
2287 $btnFulfilled_GP.Text = 'Check Fulfilled Batch'
2288 $btnFulfilled_GP.UseCompatibleTextRendering = $True
2289 $btnFulfilled_GP.BackColor = '#2e4058'
2290 $btnFulfilled_GP.add_click($btnFulfilled_GP_Click)
2291 #
2292 # SLX TAB--------------------------------------------------------------------------------------------------------------
2293 #
2294 Add-Type -Assembly System.Drawing
2295
2296 $tabpage5.Controls.Add($lblBanner_SLXUpdate)
2297 $tabpage5.Controls.Add($lblTerritory_SLXUpdate)
2298 $tabpage5.Controls.Add($lblCustomerNumber_SLXUpdate)
2299 $tabpage5.Controls.Add($TerritoryCombo_SLXUpdate)
2300 $tabpage5.Controls.Add($txtCustomerNumber_SLXUpdate)
2301 $tabpage5.Controls.Add($btnUpdateAccount_SLXUpdate)
2302 $tabpage5.Controls.Add($lblBanner_LeadUpdate)
2303 $tabpage5.Controls.Add($lblTerritory_LeadUpdate)
2304 $tabpage5.Controls.Add($lblLeadID_LeadUpdate)
2305 $tabpage5.Controls.Add($TerritoryCombo_LeadUpdate)
2306 $tabpage5.Controls.Add($txtLeadID_LeadUpdate)
2307 $tabpage5.Controls.Add($btnUpdateLead_LeadUpdate)
2308 $tabpage5.Controls.Add($btnLeadIDInfo_LeadUpdate)
2309 $tabpage5.BackColor = '#222222'
2310 $tabpage5.ForeColor = '#c5c9ca'
2311 $tabpage5.Location = '4, 22'
2312 $tabpage5.Name = 'tabpage5'
2313 $tabpage5.Padding = '3, 3, 3, 3'
2314 $tabpage5.Size = '820, 356'
2315 $tabpage5.TabIndex = 1
2316 $tabpage5.Text = 'Sales Logix'
2317 $tabpage5.UseVisualStyleBackColor = $False
2318 $btnLeadIDInfo_LeadUpdate.add_MouseHover($ShowHelp)
2319 $SalesID=@('0','1','2','3','4','5','6','7','8','9','10','11','12','13','14','15','16','17','18','19','20','21','22','23','24','25','26','27','28','29','30','31','32','33','34','35','36','37','38','39','40','41','42','43','44','45','46','47','49','50','53','55','57','62','64','65','66','69','91','92','99')
2320
2321 foreach ($id in $SalesID) {
2322 $TerritoryCombo_SLXUpdate.Items.Add($id)
2323 $TerritoryCombo_LeadUpdate.Items.Add($id)
2324 }
2325 #
2326 # $lblBanner_SLXUpdate
2327 #
2328 $lblBanner_SLXUpdate.Location = '84, 24'
2329 $lblBanner_SLXUpdate.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
2330 $lblBanner_SLXUpdate.Name = '$lblBanner_SLXUpdate'
2331 $lblBanner_SLXUpdate.Size = '235, 23'
2332 $lblBanner_SLXUpdate.TabIndex = 2
2333 $lblBanner_SLXUpdate.Text = 'SLX Account Update'
2334 $lblBanner_SLXUpdate.UseCompatibleTextRendering = $True
2335 #
2336 # btnUpdateAccount_SLXUpdate
2337 #
2338 $btnUpdateAccount_SLXUpdate.Location = '150, 124'
2339 $btnUpdateAccount_SLXUpdate.Name = 'btnUpdateAccount_SLXUpdate'
2340 $btnUpdateAccount_SLXUpdate.Size = '75, 43'
2341 $btnUpdateAccount_SLXUpdate.TabIndex = 2
2342 $btnUpdateAccount_SLXUpdate.Text = 'Update Account'
2343 $btnUpdateAccount_SLXUpdate.UseCompatibleTextRendering = $True
2344 $btnUpdateAccount_SLXUpdate.BackColor = '#2e4058'
2345 $btnUpdateAccount_SLXUpdate.add_click({
2346 if($txtCustomerNumber_SLXUpdate.Text){
2347 $btnUpdateAccount_SLXUpdate_Click.invoke()
2348 }
2349 else{
2350 [System.Media.SystemSounds]::Exclamation.Play()
2351 [System.Windows.Forms.MessageBox]::Show('Please Enter a Customer Number.', 'Account Error')
2352 }
2353 }
2354 )
2355
2356 #
2357 # txtCustomerNumber_SLXUpdate
2358 #
2359 $txtCustomerNumber_SLXUpdate.Location = '130, 54'
2360 $txtCustomerNumber_SLXUpdate.Name = 'txtCustomerNumber_SLXUpdate'
2361 $txtCustomerNumber_SLXUpdate.Size = '120, 20'
2362 $txtCustomerNumber_SLXUpdate.TabIndex = 1
2363 $txtCustomerNumber_SLXUpdate.add_Keydown($txtCustomerNumber_SLXUpdate_KeyDown)
2364 #
2365 # lblCustomerNumber_SLXUpdate
2366 #
2367 $lblCustomerNumber_SLXUpdate.AutoSize = $True
2368 $lblCustomerNumber_SLXUpdate.Location = '29, 54'
2369 $lblCustomerNumber_SLXUpdate.Name = 'lblCustomerNumber_SLXUpdate'
2370 $lblCustomerNumber_SLXUpdate.Size = '35, 17'
2371 $lblCustomerNumber_SLXUpdate.TabIndex = 0
2372 $lblCustomerNumber_SLXUpdate.Text = 'Customer Number:'
2373 $lblCustomerNumber_SLXUpdate.UseCompatibleTextRendering = $True
2374 #
2375 # TerritoryCombo_SLXUpdate
2376 #
2377 $TerritoryCombo_SLXUpdate.Location = '130, 84'
2378 $TerritoryCombo_SLXUpdate.Name = 'TerritoryCombo_SLXUpdate'
2379 $TerritoryCombo_SLXUpdate.Size = '120, 20'
2380 $TerritoryCombo_SLXUpdate.TabIndex = 1
2381 #
2382 # lblTerritory_SLXUpdate
2383 #
2384 $lblTerritory_SLXUpdate.AutoSize = $True
2385 $lblTerritory_SLXUpdate.Location = '62, 84'
2386 $lblTerritory_SLXUpdate.Name = 'lblTerritory_SLXUpdate'
2387 $lblTerritory_SLXUpdate.Size = '35, 17'
2388 $lblTerritory_SLXUpdate.TabIndex = 0
2389 $lblTerritory_SLXUpdate.Text = 'Territory ID:'
2390 $lblTerritory_SLXUpdate.UseCompatibleTextRendering = $True
2391 #
2392 # $lblBanner_LeadUpdate
2393 #
2394 $lblBanner_LeadUpdate.Location = '350, 24'
2395 $lblBanner_LeadUpdate.Font = 'Microsoft Sans Serif, 10.25pt, style=Bold'
2396 $lblBanner_LeadUpdate.Name = '$lblBanner_LeadUpdate'
2397 $lblBanner_LeadUpdate.Size = '235, 23'
2398 $lblBanner_LeadUpdate.TabIndex = 2
2399 $lblBanner_LeadUpdate.Text = 'SLX Lead Update'
2400 $lblBanner_LeadUpdate.UseCompatibleTextRendering = $True
2401 #
2402 # btnUpdateLead_LeadUpdate
2403 #
2404 $btnUpdateLead_LeadUpdate.Location = '380, 124'
2405 $btnUpdateLead_LeadUpdate.Name = 'btnUpdateLead'
2406 $btnUpdateLead_LeadUpdate.Size = '75, 43'
2407 $btnUpdateLead_LeadUpdate.TabIndex = 2
2408 $btnUpdateLead_LeadUpdate.Text = 'Update Lead'
2409 $btnUpdateLead_LeadUpdate.UseCompatibleTextRendering = $True
2410 $btnUpdateLead_LeadUpdate.BackColor = '#2e4058'
2411 $btnUpdateLead_LeadUpdate.add_click({
2412 if($txtLeadID_LeadUpdate.Text){
2413 $btnUpdateLead_LeadUpdate_Click.invoke()
2414 }
2415 else{
2416 [System.Media.SystemSounds]::Exclamation.Play()
2417 [System.Windows.Forms.MessageBox]::Show('Please Enter a Lead ID.', 'Lead ID Error')
2418 }
2419 }
2420 )
2421 #
2422 # btnLeadIDInfo_LeadUpdate
2423 #
2424 $leadinfo = [System.Drawing.Image]::FromFile("\\SERVER\Powershell Repo\Information-11.jpg")
2425 $btnLeadIDInfo_LeadUpdate.Location = '490, 54'
2426 $btnLeadIDInfo_LeadUpdate.Name = 'btnLeadIDInfo_LeadUpdate'
2427 $btnLeadIDInfo_LeadUpdate.Size = '25, 25'
2428 $btnLeadIDInfo_LeadUpdate.TabIndex = 9
2429 $btnLeadIDInfo_LeadUpdate.Image = $leadinfo
2430 $btnLeadIDInfo_LeadUpdate.UseCompatibleTextRendering = $True
2431 $btnLeadIDInfo_LeadUpdate.BackColor = '#2e4058'
2432 #
2433 # txtLeadID_LeadUpdate
2434 #
2435 $txtLeadID_LeadUpdate.Location = '360, 54'
2436 $txtLeadID_LeadUpdate.Name = 'txtLeadID_LeadUpdate'
2437 $txtLeadID_LeadUpdate.Size = '120, 20'
2438 $txtLeadID_LeadUpdate.TabIndex = 1
2439 $txtLeadID_LeadUpdate.add_Keydown($txtLeadID_LeadUpdate_KeyDown)
2440 #
2441 # lblLeadID_LeadUpdate
2442 #
2443 $lblLeadID_LeadUpdate.AutoSize = $True
2444 $lblLeadID_LeadUpdate.Location = '311, 54'
2445 $lblLeadID_LeadUpdate.Name = 'lblLeadID_LeadUpdate'
2446 $lblLeadID_LeadUpdate.Size = '35, 17'
2447 $lblLeadID_LeadUpdate.TabIndex = 0
2448 $lblLeadID_LeadUpdate.Text = 'Lead ID:'
2449 $lblLeadID_LeadUpdate.UseCompatibleTextRendering = $True
2450 #
2451 # TerritoryCombo_LeadUpdate
2452 #
2453 $TerritoryCombo_LeadUpdate.Location = '360, 84'
2454 $TerritoryCombo_LeadUpdate.Name = 'TerritoryCombo_LeadUpdate'
2455 $TerritoryCombo_LeadUpdate.Size = '120, 20'
2456 $TerritoryCombo_LeadUpdate.TabIndex = 1
2457 #
2458 # lblTerritory_LeadUpdate
2459 #
2460 $lblTerritory_LeadUpdate.AutoSize = $True
2461 $lblTerritory_LeadUpdate.Location = '292, 84'
2462 $lblTerritory_LeadUpdate.Name = 'lblTerritory_LeadUpdate'
2463 $lblTerritory_LeadUpdate.Size = '35, 17'
2464 $lblTerritory_LeadUpdate.TabIndex = 0
2465 $lblTerritory_LeadUpdate.Text = 'Territory ID:'
2466 $lblTerritory_LeadUpdate.UseCompatibleTextRendering = $True
2467 #
2468 # tabpage6
2469 #
2470 $tabpage6.Controls.Add($lblComputer_info)
2471 $tabpage6.Controls.Add($ComputerCombo_info)
2472 $tabpage6.Controls.Add($btnGetInfo_info)
2473 $tabpage6.Controls.Add($lblPCName_info)
2474 $tabpage6.Controls.Add($lblOU_info)
2475 $tabpage6.Controls.Add($lblOSName_info)
2476 $tabpage6.Controls.Add($lblVersion_info)
2477 $tabpage6.Controls.Add($lblBuild_info)
2478 $tabpage6.Controls.Add($lblIP_info)
2479 $tabpage6.Controls.Add($lblFreeSpace_info)
2480 $tabpage6.Controls.Add($lblLastBoot_info)
2481 $tabpage6.Controls.Add($lblWinKey_info)
2482 $tabpage6.Controls.Add($lblOfficeKey_info)
2483 $tabpage6.Controls.Add($lblPCName_result)
2484 $tabpage6.Controls.Add($lblOU_result)
2485 $tabpage6.Controls.Add($lblOSName_result)
2486 $tabpage6.Controls.Add($lblVersion_result)
2487 $tabpage6.Controls.Add($lblBuild_result)
2488 $tabpage6.Controls.Add($lblIP_result)
2489 $tabpage6.Controls.Add($lblFreeSpace_result)
2490 $tabpage6.Controls.Add($lblLastBoot_result)
2491 $tabpage6.Controls.Add($lblWinKey_result)
2492 $tabpage6.Controls.Add($lblOfficeKey_result)
2493 $tabpage6.Location = '4, 22'
2494 $tabpage6.Name = 'tabpage6'
2495 $tabpage6.Size = '820, 356'
2496 $tabpage6.TabIndex = 5
2497 $tabpage6.Text = 'PC Info'
2498 $tabpage6.BackColor = '#222222'
2499 $tabpage6.ForeColor = '#c5c9ca'
2500 $OUComputers = Get-ADComputer -filter * -Properties name | Sort-Object Name | select -expand name
2501
2502 foreach ($computer in $OUComputers) {
2503 $ComputerCombo_info.Items.Add($computer)
2504 }
2505 #
2506 # lblComputer_info
2507 #
2508 $lblComputer_info.AutoSize = $True
2509 $lblComputer_info.Location = '29, 19'
2510 $lblComputer_info.Name = 'lblComputer_info'
2511 $lblComputer_info.Size = '35, 17'
2512 $lblComputer_info.TabIndex = 0
2513 $lblComputer_info.Text = 'PC Name:'
2514 $lblComputer_info.UseCompatibleTextRendering = $True
2515 #
2516 # ComputerCombo_info
2517 #
2518 $ComputerCombo_info.Location = '100, 14'
2519 $ComputerCombo_info.Name = 'ComputerCombo_info'
2520 $ComputerCombo_info.Size = '130, 20'
2521 $ComputerCombo_info.TabIndex = 1
2522 #
2523 #btnGetInfo_info
2524 #
2525 $btnGetInfo_info.Location = '120, 45'
2526 $btnGetInfo_info.Name = 'btnGetInfo_info'
2527 $btnGetInfo_info.Size = '88, 44'
2528 $btnGetInfo_info.TabIndex = 4
2529 $btnGetInfo_info.Text = 'Get Info'
2530 $btnGetInfo_info.UseCompatibleTextRendering = $True
2531 $btnGetInfo_info.BackColor = '#2e4058'
2532 $btnGetInfo_info.add_click($btnGetInfo_info_Click)
2533 #
2534 #lblPCName_info
2535 #
2536 $lblPCName_info.AutoSize = $True
2537 $lblPCName_info.Location = '290, 19'
2538 $lblPCName_info.Name = 'lblPCName_info'
2539 $lblPCName_info.Size = '35, 17'
2540 $lblPCName_info.TabIndex = 0
2541 $lblPCName_info.Text = 'Name:'
2542 $lblPCName_info.UseCompatibleTextRendering = $True
2543 #
2544 #lblOU_info
2545 #
2546 $lblOU_info.AutoSize = $True
2547 $lblOU_info.Location = '277, 45'
2548 $lblOU_info.Name = 'lblOU_info'
2549 $lblOU_info.Size = '35, 17'
2550 $lblOU_info.TabIndex = 0
2551 $lblOU_info.Text = 'Org Unit:'
2552 $lblOU_info.UseCompatibleTextRendering = $True
2553 #
2554 #lblOSName_info
2555 #
2556 $lblOSName_info.AutoSize = $True
2557 $lblOSName_info.Location = '303, 71'
2558 $lblOSName_info.Name = 'lblOSName_info'
2559 $lblOSName_info.Size = '35, 17'
2560 $lblOSName_info.TabIndex = 0
2561 $lblOSName_info.Text = 'OS:'
2562 $lblOSName_info.UseCompatibleTextRendering = $True
2563 #
2564 #lblVersion_info
2565 #
2566 $lblVersion_info.AutoSize = $True
2567 $lblVersion_info.Location = '281, 97'
2568 $lblVersion_info.Name = 'lblVersion_info'
2569 $lblVersion_info.Size = '35, 17'
2570 $lblVersion_info.TabIndex = 0
2571 $lblVersion_info.Text = 'Version:'
2572 $lblVersion_info.UseCompatibleTextRendering = $True
2573 #
2574 #lblBuild_info
2575 #
2576 $lblBuild_info.AutoSize = $True
2577 $lblBuild_info.Location = '294, 126'
2578 $lblBuild_info.Name = 'lblBuild_info'
2579 $lblBuild_info.Size = '35, 17'
2580 $lblBuild_info.TabIndex = 0
2581 $lblBuild_info.Text = 'Build:'
2582 $lblBuild_info.UseCompatibleTextRendering = $True
2583 #
2584 #lblIP_info
2585 #
2586 $lblIP_info.AutoSize = $True
2587 $lblIP_info.Location = '265, 155'
2588 $lblIP_info.Name = 'lblIP_info'
2589 $lblIP_info.Size = '35, 17'
2590 $lblIP_info.TabIndex = 0
2591 $lblIP_info.Text = 'IP Address:'
2592 $lblIP_info.UseCompatibleTextRendering = $True
2593 #
2594 #lblFreeSpace_info
2595 #
2596 $lblFreeSpace_info.AutoSize = $True
2597 $lblFreeSpace_info.Location = '248, 184'
2598 $lblFreeSpace_info.Name = 'lblFreeSpace_info'
2599 $lblFreeSpace_info.Size = '35, 17'
2600 $lblFreeSpace_info.TabIndex = 0
2601 $lblFreeSpace_info.Text = 'C: Free Space:'
2602 $lblFreeSpace_info.UseCompatibleTextRendering = $True
2603 #
2604 #lblLastBoot_info
2605 #
2606 $lblLastBoot_info.AutoSize = $True
2607 $lblLastBoot_info.Location = '259, 213'
2608 $lblLastBoot_info.Name = 'lblLastBoot_info'
2609 $lblLastBoot_info.Size = '35, 17'
2610 $lblLastBoot_info.TabIndex = 0
2611 $lblLastBoot_info.Text = 'Last Restart:'
2612 $lblLastBoot_info.UseCompatibleTextRendering = $True
2613 #
2614 #lblWinKey_info
2615 #
2616 $lblWinKey_info.AutoSize = $True
2617 $lblWinKey_info.Location = '263, 242'
2618 $lblWinKey_info.Name = 'lblWinKey_info'
2619 $lblWinKey_info.Size = '35, 17'
2620 $lblWinKey_info.TabIndex = 0
2621 $lblWinKey_info.Text = 'Win 10 Key:'
2622 $lblWinKey_info.UseCompatibleTextRendering = $True
2623 #
2624 #lblOfficeKey_info
2625 #
2626 $lblOfficeKey_info.AutoSize = $True
2627 $lblOfficeKey_info.Location = '267, 268'
2628 $lblOfficeKey_info.Name = 'lblOfficeKey_info'
2629 $lblOfficeKey_info.Size = '35, 17'
2630 $lblOfficeKey_info.TabIndex = 0
2631 $lblOfficeKey_info.Text = 'Office Key:'
2632 $lblOfficeKey_info.UseCompatibleTextRendering = $True
2633 #
2634 #lblPCName_result
2635 #
2636 $lblPCName_result.AutoSize = $True
2637 $lblPCName_result.Location = '330, 19'
2638 $lblPCName_result.Name = 'lblPCName_result'
2639 $lblPCName_result.Size = '35, 17'
2640 $lblPCName_result.TabIndex = 0
2641 $lblPCName_result.Text = ''
2642 $lblPCName_result.UseCompatibleTextRendering = $True
2643 #
2644 #lblOU_result
2645 #
2646 $lblOU_result.AutoSize = $True
2647 $lblOU_result.Location = '330, 45'
2648 $lblOU_result.Name = 'lblOU_result'
2649 $lblOU_result.Size = '35, 17'
2650 $lblOU_result.TabIndex = 0
2651 $lblOU_result.Text = ''
2652 $lblOU_result.UseCompatibleTextRendering = $True
2653 #
2654 #lblOSName_result
2655 #
2656 $lblOSName_result.AutoSize = $True
2657 $lblOSName_result.Location = '330, 71'
2658 $lblOSName_result.Name = 'lblOSName_result'
2659 $lblOSName_result.Size = '35, 17'
2660 $lblOSName_result.TabIndex = 0
2661 $lblOSName_result.Text = ''
2662 $lblOSName_result.UseCompatibleTextRendering = $True
2663 #
2664 #lblVersion_result
2665 #
2666 $lblVersion_result.AutoSize = $True
2667 $lblVersion_result.Location = '330, 97'
2668 $lblVersion_result.Name = 'lblVersion_result'
2669 $lblVersion_result.Size = '35, 17'
2670 $lblVersion_result.TabIndex = 0
2671 $lblVersion_result.Text = ''
2672 $lblVersion_result.UseCompatibleTextRendering = $True
2673 #
2674 #lblBuild_result
2675 #
2676 $lblBuild_result.AutoSize = $True
2677 $lblBuild_result.Location = '330, 126'
2678 $lblBuild_result.Name = 'lblBuild_result'
2679 $lblBuild_result.Size = '35, 17'
2680 $lblBuild_result.TabIndex = 0
2681 $lblBuild_result.Text = ''
2682 $lblBuild_result.UseCompatibleTextRendering = $True
2683 #
2684 #lblIP_result
2685 #
2686 $lblIP_result.AutoSize = $True
2687 $lblIP_result.Location = '330, 155'
2688 $lblIP_result.Name = 'lblIP_result'
2689 $lblIP_result.Size = '35, 17'
2690 $lblIP_result.TabIndex = 0
2691 $lblIP_result.Text = ''
2692 $lblIP_result.UseCompatibleTextRendering = $True
2693 #
2694 #lblFreeSpace_result
2695 #
2696 $lblFreeSpace_result.AutoSize = $True
2697 $lblFreeSpace_result.Location = '330, 184'
2698 $lblFreeSpace_result.Name = 'lblFreeSpace_result'
2699 $lblFreeSpace_result.Size = '35, 17'
2700 $lblFreeSpace_result.TabIndex = 0
2701 $lblFreeSpace_result.Text = ''
2702 $lblFreeSpace_result.UseCompatibleTextRendering = $True
2703 #
2704 #lblLastBoot_result
2705 #
2706 $lblLastBoot_result.AutoSize = $True
2707 $lblLastBoot_result.Location = '330, 213'
2708 $lblLastBoot_result.Name = 'lblLastBoot_result'
2709 $lblLastBoot_result.Size = '35, 17'
2710 $lblLastBoot_result.TabIndex = 0
2711 $lblLastBoot_result.Text = ''
2712 $lblLastBoot_result.UseCompatibleTextRendering = $True
2713 #
2714 #lblWinKey_result
2715 #
2716 $lblWinKey_result.AutoSize = $True
2717 $lblWinKey_result.Location = '330, 242'
2718 $lblWinKey_result.Name = 'lblWinKey_result'
2719 $lblWinKey_result.Size = '35, 17'
2720 $lblWinKey_result.TabIndex = 0
2721 $lblWinKey_result.Text = ''
2722 $lblWinKey_result.UseCompatibleTextRendering = $True
2723 #
2724 #lblOfficeKey_result
2725 #
2726 $lblOfficeKey_result.AutoSize = $True
2727 $lblOfficeKey_result.Location = '330, 268'
2728 $lblOfficeKey_result.Name = 'lblOfficeKey_result'
2729 $lblOfficeKey_result.Size = '35, 17'
2730 $lblOfficeKey_result.TabIndex = 0
2731 $lblOfficeKey_result.Text = ''
2732 $lblOfficeKey_result.UseCompatibleTextRendering = $True
2733
2734
2735 #endregion Generated Form Code
2736
2737 #----------------------------------------------
2738
2739 #Save the initial state of the form
2740 $InitialFormWindowState = $form1.WindowState
2741 #Init the OnLoad event to correct the initial state of the form
2742 $form1.add_Load($Form_StateCorrection_Load)
2743 #Clean up the control events
2744 $form1.add_FormClosed($Form_Cleanup_FormClosed)
2745 #Show the Form
2746 return $form1.ShowDialog()
2747
2748} #End Function
2749
2750#Call the form
2751Show-Tabbed_Layout_psf | Out-Null