-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathNewADUserGUI.ps1
More file actions
1296 lines (1107 loc) · 80.5 KB
/
Copy pathNewADUserGUI.ps1
File metadata and controls
1296 lines (1107 loc) · 80.5 KB
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
##################################################################################### Text Feilds #####################################################################################
[String]$UserName
[String]$ExtensionName
[String]$Password
[string]$FirstName
[string]$MiddleInit
[string]$LastName
[String]$name5
[String]$name2
#5-2-1
[string]$EmployeeID
#Phone Number
[string]$PhoneNum
#Email
[string]$Email
#Home Folder
[string]$HomeFolder
#Description
[string]$Description
#Job Title
[string]$Title
#Job description
[string]$Department
#Job manager
[ADUser]$Manager
#Company
[string]$Company
#Mailstop
[string]$MailStop
############################################################ General GUI #########################################################################
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Drawing")
[void] [System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms")
Import-Module ActiveDirectory
$GUIFont = [System.Drawing.Font]::new('Segoe UI', 9, [System.Drawing.FontStyle]::Regular) #Font for main form and mult form
#Main form -
$Icon = New-Object System.Drawing.Icon ('C:\Users\turflhj1\profile_512_pm1_icon.ico') #Icon for main form and mult form
$main_form = New-Object System.Windows.Forms.Form #Main form creation and formatting
$main_form.Icon = $Icon
$main_form.Text = 'Active Directory User'
$main_form.Font = $GUIFont
$main_form.FormBorderStyle = 'fixed3d'
$main_form.BackColor = 'whitesmoke'
$main_form.AutoSize = $true
#Tab Control Info -
$tabControl = New-Object System.Windows.Forms.TabControl
$tabControl.Location = New-Object System.Drawing.Size (5,5)
$tabControl.Name = "tabControl"
$tabControl.Font = $GUIFont
$tabControl.Size = New-Object System.Drawing.Size (405,465)
$tabControl.DataBindings.DefaultDataSourceUpdateMode = 0
$main_form.Controls.Add($tabControl) #Add tab control to main form
############################################################ Account Page #########################################################################
$AcctPage = New-Object System.Windows.Forms.TabPage
$AcctPage.Dock = 'bottom'
$AcctPage.Text = "Account"
$AcctPage.Font = $GUIFont
$AcctPage.Name = 'Account'
$AcctPage.Location = New-Object System.Drawing.Size (15,75)
$AcctPage.Size = New-Object System.Drawing.Size (405,475)
$AcctPage.AutoSize = $true
$AcctPage.DataBindings.DefaultDataSourceUpdateMode = 0
$tabControl.Controls.Add($AcctPage) #Add "Account" page to tab control (in main form)
####################################### User Image #######################################
#Image -
$image = [System.Drawing.Image]::Fromfile('C:\Users\turflhj1\Profile-512.png')
$pictureBox = new-object Windows.Forms.PictureBox
$pictureBox.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::Zoom
$pictureBox.Size = New-Object System.Drawing.Size (35,35)
$pictureBox.Location = New-Object System.Drawing.Size (30,18)
$pictureBox.Image = $image
$AcctPage.Controls.Add($pictureBox) #Add user image to Account age (in main form)
####################################### Name GroupBox #######################################
$NameGroupBox = New-Object System.Windows.Forms.GroupBox
$NameGroupBox.Location = New-Object System.Drawing.Size (5,70)
$NameGroupBox.Size = New-Object System.Drawing.Size (387,100)
$NameGroupBox.AutoSize = $true
$NameGroupBox.Text = "Name"
$NameGroupBox.DataBindings.DefaultDataSourceUpdateMode = 0
$AcctPage.Controls.Add($NameGroupBox) #Add "Name" group box to Account page (in main form)
################ First Name ################
#Label -
$FNameLabel = New-Object System.Windows.Forms.Label
$FNameLabel.Location = New-Object System.Drawing.Size (10,30)
$FNameLabel.AutoSize = $true
$FNameLabel.Text = "First "
$NameGroupBox.Controls.Add($FNameLabel) #Add "first name" label to name group box (on account page)
#TextBox -
$FNameBox = New-Object System.Windows.Forms.TextBox
$FNameBox.BorderStyle = 'FixedSingle'
$FNameBox.Location = New-Object System.Drawing.Size (90,28)
$FNameBox.Size = New-Object System.Drawing.Size (195,10)
$NameGroupBox.Controls.Add($FNameBox) #Add "first name" text box to name group box (on account page)
################ Middle Name ################
#Label -
$MNameLabel = New-Object System.Windows.Forms.Label
$MNameLabel.Location = New-Object System.Drawing.Size (295,30)
$MNameLabel.AutoSize = $true
$MNameLabel.Text = "M.I. "
$NameGroupBox.Controls.Add($MNameLabel) #Add "middle initial" label to name group box (on account page)
#TextBox -
$MNameBox = New-Object System.Windows.Forms.TextBox #only 1 char should be put in this text box
$MNameBox.BorderStyle = 'FixedSingle'
$MNameBox.Location = New-Object System.Drawing.Size (330,28)
$MNameBox.Size = New-Object System.Drawing.Size (35,10)
$NameGroupBox.Controls.Add($MNameBox) #Add "middle initial" text box to name group box (on account page)
################ Last Name ################
#Label -
$LNameLabel = New-Object System.Windows.Forms.Label
$LNameLabel.Location = New-Object System.Drawing.Size (10,60)
$LNameLabel.AutoSize = $true
$LNameLabel.Text = "Last "
$NameGroupBox.Controls.Add($LNameLabel) #Add "last name" label to name group box (on account page)
#TextBox -
$LNameBox = New-Object System.Windows.Forms.TextBox
$LNameBox.BorderStyle = 'FixedSingle'
$LNameBox.Location = New-Object System.Drawing.Size (90,58)
$LNameBox.Size = New-Object System.Drawing.Size (275,10)
$NameGroupBox.Controls.Add($LNameBox) #Add "last name" text box to name group box (on account page)
################ Multiple User Creation Button ################
$MultButton = New-Object System.Windows.Forms.Button
$MultButton.Text = 'Create Multiple Users'
$MultButton.FlatStyle = 'flat'
$MultButton.BackColor = "white"
$MultButton.Location = New-Object System.Drawing.Size(135,179)
$MultButton.Size = New-Object System.Drawing.Size(120,12)
$MultButton.AutoSize = $true
$MultButton.FlatAppearance.BorderColor = 'lightgray'
$MultButton.DataBindings.DefaultDataSourceUpdateMode = 0
$AcctPage.Controls.Add($MultButton) #Add "multiple user creation" button to account page (in main form)
################################################################ Multiple Account Creation Form ################################################################
$MultButton.Add_Click({ #Add click for "multiple user creation" button
$mult_form = New-Object System.Windows.Forms.Form #Multiple user creation (mult form) form creation
$mult_form.Icon = $Icon
$mult_form.Text = 'Multiple User Creation'
$mult_form.Font = $GUIFont
$mult_form.FormBorderStyle = 'fixed3d'
$mult_form.BackColor = 'whitesmoke'
$mult_form.AutoSize = $true
$mult_form.Size = New-Object System.Drawing.Size (410,265)
#Image -
$multimage = [System.Drawing.Image]::Fromfile('C:\Users\turflhj1\group-users.png')
$multpictureBox = new-object Windows.Forms.PictureBox
$multpictureBox.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::Zoom
$multpictureBox.Size = New-Object System.Drawing.Size (75,55)
$multpictureBox.Location = New-Object System.Drawing.Size (175,5)
$multpictureBox.Image = $multimage
$mult_form.Controls.Add($multpictureBox) #Add multiple users graphic image to mult form
####################################### Import GroupBox #######################################
$multGroupBox = New-Object System.Windows.Forms.GroupBox
$multGroupBox.Location = New-Object System.Drawing.Size (5,60)
$multGroupBox.Size = New-Object System.Drawing.Size (400,140)
$multGroupBox.AutoSize = $true
$multGroupBox.DataBindings.DefaultDataSourceUpdateMode = 0
$mult_form.Controls.Add($multGroupBox) #Add "mult" group box to mult form (only group box on form )
#Label -
$multformlabel = New-Object System.Windows.Forms.Label
$multformlabel.text = "Create multiple Active Directory users at once by importing a CSV file."
$multformlabel.Location = New-Object System.Drawing.Size(15,23)
$multformlabel.Size = New-Object System.Drawing.Size (375,15)
$multformlabel.AutoSize = $true
$multGroupBox.Controls.Add($multformlabel) #Add label to display info about form to mult group box (on mult form)
########################## Import CSV ##########################
#TextBox -
$multBox = New-Object System.Windows.Forms.TextBox
$multBox.text = $usersfile
$multBox.BorderStyle = 'FixedSingle'
$multBox.Location = New-Object System.Drawing.Size (90,60)
$multBox.Size = New-Object System.Drawing.Size (305,12)
$multGroupBox.Controls.Add($multBox) #Add text box to mult group box (on mult form) - contains link to CSV file
################ Choose Button ################
#Button -
$MultButton = New-Object System.Windows.Forms.Button
$MultButton.Text = 'Choose'
$MultButton.FlatStyle = 'flat'
$MultButton.BackColor = "white"
$MultButton.Location = New-Object System.Drawing.Size(10,57)
$MultButton.Size = New-Object System.Drawing.Size(75,12)
$MultButton.AutoSize = $true
$MultButton.FlatAppearance.BorderColor = 'lightgray'
$MultButton.DataBindings.DefaultDataSourceUpdateMode = 0
$multGroupBox.Controls.Add($MultButton) #Add "choose" button to mult group box (on mult form) -add click to open file directory
$MultButton.Add_Click({
$filebrowser = New-Object System.Windows.Forms.OpenFileDialog -Property @{ InitialDirectory = [Environment]::GetFolderPath('Desktop') }
$filebrowser.ShowDialog()
$csvfile = $filebrowser.FileName
$multBox.Text = $csvfile
if($multBox.text.Length -ne 0){ #Only allow import button to be enabled if text box contains text (file link)
$MultButton2.enabled = $true
}
else{
$MultButton2.enabled = $false
}
})
################ Import Button ################
#Button -
$MultButton2 = New-Object System.Windows.Forms.Button
$MultButton2.Enabled = $false
$MultButton2.Text = 'Import'
$MultButton2.FlatStyle = 'flat'
$MultButton2.BackColor = "white"
$MultButton2.Location = New-Object System.Drawing.Size(170,100)
$MultButton2.Size = New-Object System.Drawing.Size(75,12)
$MultButton2.AutoSize = $true
$MultButton2.FlatAppearance.BorderColor = 'lightgray'
$MultButton2.DataBindings.DefaultDataSourceUpdateMode = 0
$multGroupBox.Controls.Add($MultButton2) #Add "import" button to mult group box (on mult from)
$MultButton2.Add_Click({ #Add click to import CSV file and assign multiple AD user parameters - FINISH
$ADUsers = Import-Csv $csvfile
foreach($user in $ADUsers){
$Username = $user.username
$Password = $user.password
$FirstName = $user.firstname
$LastName = $user.lastName
}
if(Get-ADUser -Filter { SamAccountName -eq $Username }){
}
})
############################################################ Bottom Buttons #########################################################################
$mult_form.KeyPreview = $true #Add Key Preview to mult form
$mult_form.Add_KeyDown({ #Add Key Down so if 'enter' key clicked OK button will be clicked
if ($_.keycode -eq 'Enter'){
$OkButton2.PerformClick()
}
})
$mult_form.Add_KeyDown({ #Add Key Down so if 'esc' key clicked Cancel button will be clicked
if($_.keycode -eq 'Escape'){
$CancelButton2.PerformClick()
}
})
################ Cancel Button ################
$CancelButton2 = New-Object System.Windows.Forms.Button
$CancelButton2.Text = 'Cancel'
$CancelButton2.FlatStyle = 'flat'
$CancelButton2.BackColor = "white"
$CancelButton2.Location = New-Object System.Drawing.Size(243,215)
$CancelButton2.Size = New-Object System.Drawing.Size(80,12)
$CancelButton2.AutoSize = $true
$CancelButton2.FlatAppearance.BorderColor = 'lightgray'
$CancelButton2.DataBindings.DefaultDataSourceUpdateMode = 0
$mult_form.Controls.Add($CancelButton2) #Add "Cancel" button to bottom of mult form
$CancelButton2.Add_Click({ #Add click to Cancel button to close form
$mult_form.close()
})
################ OK Button ################
$OkButton2 = New-Object System.Windows.Forms.Button
$OkButton2.Text = 'OK'
$OkButton2.FlatStyle = 'flat'
$OkButton2.BackColor = "white"
$OkButton2.Location = New-Object System.Drawing.Size(328,215)
$OkButton2.Size = New-Object System.Drawing.Size(80,12)
$OkButton2.AutoSize = $true
$OkButton2.FlatAppearance.BorderColor = 'lightgray'
$OkButton2.DataBindings.DefaultDataSourceUpdateMode = 0
$mult_form.Controls.Add($OkButton2) #Add "OK" button to bottom of mult form
$OkButton2.Add_Click({ #splatting #Add click to OK button to create new users using assigned params from import button
#New-ADUser `
#-Name $name -GivenName $Firstname -Surname $Lastname $DisplayName $Fullname -EmployeeID $EmployeeID `
#-OfficePhone $PhoneNum -EmailAddress $Email -HomeDrive $HomeFolder -Description $Description `
#-Title $Title -Department $Department -Manager $Manager -Company $Company -PostalCode $MailStop
})
$mult_form.ShowDialog()
})
####################################### Account GroupBox #######################################
$AcctGroupBox = New-Object System.Windows.Forms.GroupBox
$AcctGroupBox.Location = New-Object System.Drawing.Size (5,210)
$AcctGroupBox.Size = New-Object System.Drawing.Size (387,100)
$AcctGroupBox.AutoSize = $true
$AcctGroupBox.Text = "User Account"
$AcctGroupBox.DataBindings.DefaultDataSourceUpdateMode = 0
$AcctPage.Controls.Add($AcctGroupBox) #Add "Account" group box to Account page (on main form)
#Image -
$Acctimage = [System.Drawing.Image]::Fromfile('C:\Users\turflhj1\1034125-contact-us.png')
$AcctpictureBox = new-object Windows.Forms.PictureBox
$AcctpictureBox.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::Zoom
$AcctpictureBox.Size = New-Object System.Drawing.Size (140,65)
$AcctpictureBox.Location = New-Object System.Drawing.Size (220,20)
$AcctpictureBox.Image = $Acctimage
$AcctGroupBox.Controls.Add($AcctpictureBox) #Add email,phone graphic image to account group box (on account page)
################ 5-2-1 ################
#Label -
$521NameLabel = New-Object System.Windows.Forms.Label
$521NameLabel.Location = New-Object System.Drawing.Size (10,30)
$521NameLabel.AutoSize = $true
$521NameLabel.Text = "5-2-1 "
$AcctGroupBox.Controls.Add($521NameLabel) #Add "5-2-1" label to account group box (on account page)
#TextBox -
$521NameBox = New-Object System.Windows.Forms.TextBox
$521NameBox.Enabled = $false #5-2-1 text box not enabled, text generated from OK click
$521NameBox.BorderStyle = 'FixedSingle'
$521NameBox.Location = New-Object System.Drawing.Size (90,28)
$521NameBox.Size = New-Object System.Drawing.Size (120,10)
$AcctGroupBox.Controls.Add($521NameBox) #Add 5-2-1 text box to account group box (on account page)
################ Office Phone Number ################
#Label -
$PhoneLabel = New-Object System.Windows.Forms.Label
$PhoneLabel.Location = New-Object System.Drawing.Size (10,60)
$PhoneLabel.AutoSize = $true
$PhoneLabel.Text = "Phone "
$AcctGroupBox.Controls.Add($PhoneLabel) #Add "Phone" label to account group box (on account page)
#TextBox -
$PhoneBox = New-Object System.Windows.Forms.TextBox
$PhoneBox.BorderStyle = 'FixedSingle'
$PhoneBox.Location = New-Object System.Drawing.Size (90,58)
$PhoneBox.Size = New-Object System.Drawing.Size (120,10)
$AcctGroupBox.Controls.Add($PhoneBox) #Add phone number text box to account group box (on account page)
################ Work E-mail ################
#Label -
$EmailNameLabel = New-Object System.Windows.Forms.Label
$EmailNameLabel.Location = New-Object System.Drawing.Size (10,90)
$EmailNameLabel.AutoSize = $true
$EmailNameLabel.Text = "Email "
$AcctGroupBox.Controls.Add($EmailNameLabel) #Add "Email" label to account group box (on account page)
#TextBox -
$EmailNameBox = New-Object System.Windows.Forms.TextBox
$EmailNameBox.Enabled = $false #Email text box not enabled, text generated from OK click
$EmailNameBox.BorderStyle = 'FixedSingle'
$EmailNameBox.Location = New-Object System.Drawing.Size (90,88)
$EmailNameBox.Size = New-Object System.Drawing.Size (275,10)
$AcctGroupBox.Controls.Add($EmailNameBox) #Add email address to account group box (on account page)
################ Office Location ################
#Label -
$OfficeLabel = New-Object System.Windows.Forms.Label
$OfficeLabel.Location = New-Object System.Drawing.Size (10,120)
$OfficeLabel.AutoSize = $true
$OfficeLabel.Text = "Office "
$AcctGroupBox.Controls.Add($OfficeLabel) #Add "Office" label to account group box (on account page)
#TextBox -
$OfficeBox = New-Object System.Windows.Forms.TextBox
$OfficeBox.BorderStyle = 'FixedSingle'
$OfficeBox.Location = New-Object System.Drawing.Size (90,118)
$OfficeBox.Size = New-Object System.Drawing.Size (275,10)
$AcctGroupBox.Controls.Add($OfficeBox) #Add office location text box to account group box (on account page)
################ Home Folder ################
#Label -
$HFolderNameLabel = New-Object System.Windows.Forms.Label
$HFolderNameLabel.Location = New-Object System.Drawing.Size (10,150)
$HFolderNameLabel.AutoSize = $true
$HFolderNameLabel.Text = "Home Folder "
$AcctGroupBox.Controls.Add($HFolderNameLabel) #Add "home folder" label to account group box (on account page)
#TextBox -
$HFolderNameBox = New-Object System.Windows.Forms.TextBox
$HFolderNameBox.BorderStyle = 'FixedSingle'
$HfolderNameBox.Location = New-Object System.Drawing.Size (90,148)
$HFolderNameBox.Size = New-Object System.Drawing.Size (275,10)
$AcctGroupBox.Controls.Add($HFolderNameBox) #Add home folder location text box to account group box (on account page)
################ Employee Number ################
#Label -
$DescNameLabel = New-Object System.Windows.Forms.Label
$DescNameLabel.Location = New-Object System.Drawing.Size (10,180)
$DescNameLabel.AutoSize = $true
$DescNameLabel.Text = "Employee # "
$AcctGroupBox.Controls.Add($DescNameLabel) #Add "Employee #" label to account group box (on account page)
#TextBox -
$DescNameBox = New-Object System.Windows.Forms.TextBox
$DescNameBox.BorderStyle = 'FixedSingle'
$DescNameBox.Location = New-Object System.Drawing.Size (90,178)
$DescNameBox.Size = New-Object System.Drawing.Size (275,10)
$AcctGroupBox.Controls.Add($DescNameBox) #Add employee number text box to account group box (on account page)
############################################################ Profile Page #########################################################################
$ProfPage = New-Object System.Windows.Forms.TabPage
$ProfPage.Text = "Profile"
$ProfPage.Font = $GUIFont
$ProfPage.Location = New-Object System.Drawing.Size (15,70)
$ProfPage.Size = New-Object System.Drawing.Size (405,475)
$ProfPage.AutoSize = $true
$ProfPage.DataBindings.DefaultDataSourceUpdateMode = 0
$tabControl.Controls.Add($ProfPage) #Add "Profile" page to tab control (in main form)
####################################### Profile GroupBox #######################################
$ProfGroupBox = New-Object System.Windows.Forms.GroupBox
$ProfGroupBox.Location = New-Object System.Drawing.Size (5,10)
$ProfGroupBox.Size = New-Object System.Drawing.Size (387,190)
$ProfGroupBox.AutoSize = $true
$ProfGroupBox.Text = "User Profile"
$ProfGroupBox.DataBindings.DefaultDataSourceUpdateMode = 0
$ProfPage.Controls.Add($ProfGroupBox) #Add "User Profile" group box to profile page (on main form)
#Image -
$Profimage = [System.Drawing.Image]::Fromfile('C:\Users\turflhj1\edit-user.png')
$ProfpictureBox = new-object Windows.Forms.PictureBox
$ProfpictureBox.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::Zoom
$ProfpictureBox.Size = New-Object System.Drawing.Size (45,45)
$ProfpictureBox.Location = New-Object System.Drawing.Size (315,125)
$ProfpictureBox.Image = $Profimage
$ProfGroupBox.Controls.Add($ProfpictureBox) #Add user graphic image to user profile group box (on profile page)
################ Job Title ################
#Label -
$JobTLabel = New-Object System.Windows.Forms.Label
$JobTLabel.Location = New-Object System.Drawing.Size (10,30)
$JobTLabel.AutoSize = $true
$JobTLabel.Text = "Job Title "
$ProfGroupBox.Controls.Add($JobTLabel) #Add "Job title" label to user profile group box (on profile page)
#TextBox -
$JobTBox = New-Object System.Windows.Forms.TextBox
$JobTBox.BorderStyle = 'FixedSingle'
$JobTBox.Location = New-Object System.Drawing.Size (90,28)
$JobTBox.Size = New-Object System.Drawing.Size (275,10)
$ProfGroupBox.Controls.Add($JobTBox) #Add job title text box to user profile group box (on profile page)
################ Department ################
#Label -
$DeptLabel = New-Object System.Windows.Forms.Label
$DeptLabel.Location = New-Object System.Drawing.Size (10,60)
$DeptLabel.AutoSize = $true
$DeptLabel.Text = "Department "
$ProfGroupBox.Controls.Add($DeptLabel) #Add "Department" label to user profile group box (on profile page)
#TextBox -
$DeptBox = New-Object System.Windows.Forms.TextBox
$DeptBox.BorderStyle = 'fixedsingle'
$DeptBox.Location = New-Object System.Drawing.Size (90,58)
$DeptBox.Size = New-Object System.Drawing.Size (120,12)
$ProfGroupBox.Controls.Add($DeptBox) #Add department text box to user profile group box (on profile page)
################ Group Box ################
#Label -
$GroupLabel = New-Object System.Windows.Forms.Label
$GroupLabel.Location = New-Object System.Drawing.Size (220,60)
$GroupLabel.AutoSize = $true
$GroupLabel.Text = "Group "
$ProfGroupBox.Controls.Add($GroupLabel) #Add "Group" label to user profile group box (on profile page)
#TextBox -
$GroupBox = New-Object System.Windows.Forms.TextBox
$GroupBox.BorderStyle = 'fixedsingle'
$GroupBox.Location = New-Object System.Drawing.Size (265,58)
$GroupBox.Size = New-Object System.Drawing.Size (100,12)
$ProfGroupBox.Controls.Add($GroupBox) #Add group text box to user profile group box (on profile page)
################ Manager ################
#Label -
$ManNameLabel = New-Object System.Windows.Forms.Label
$ManNameLabel.Location = New-Object System.Drawing.Size (10,90)
$ManNameLabel.AutoSize = $true
$ManNameLabel.Text = "Manager "
$ProfGroupBox.Controls.Add($ManNameLabel) #Add "Manager" label to user profile group box (on profile page)
#TextBox -
$ManNameBox = New-Object System.Windows.Forms.TextBox
$ManNameBox.BorderStyle = 'FixedSingle'
$ManNameBox.Location = New-Object System.Drawing.Size (90,88)
$ManNameBox.Size = New-Object System.Drawing.Size (275,10)
$ProfGroupBox.Controls.Add($ManNameBox) #Add manager text box to user profile group box (on profile page) - accepts AD User type
################ Company ################
#Label -
$CompNameLabel = New-Object System.Windows.Forms.Label
$CompNameLabel.Location = New-Object System.Drawing.Size (10,120)
$CompNameLabel.AutoSize = $true
$CompNameLabel.Text = "Company "
$ProfGroupBox.Controls.Add($CompNameLabel) #Add "Company" label to user profile group box (on profile page)
#TextBox -
$CompNameBox = New-Object System.Windows.Forms.TextBox
$CompNameBox.Enabled = $false #Company text box not enabled, text generated from .text
$Company = 'JHU/APL'
$CompNameBox.text = $Company
$CompNameBox.BorderStyle = 'FixedSingle'
$CompNameBox.Location = New-Object System.Drawing.Size (90,118)
$CompNameBox.Size = New-Object System.Drawing.Size (200,10)
$ProfGroupBox.Controls.Add($CompNameBox) #Add company text box to user profile group box (on profile page)
################ Mailstop ################
#Label -
$MailLabel = New-Object System.Windows.Forms.Label
$MailLabel.Location = New-Object System.Drawing.Size (10,150)
$MailLabel.AutoSize = $true
$MailLabel.Text = "Mailbox "
$ProfGroupBox.Controls.Add($MailLabel) #Add "Mailbox" label to user profile group box (on profile page)
#TextBox -
$MailBox = New-Object System.Windows.Forms.TextBox
$MailBox.BorderStyle = 'FixedSingle'
$MailBox.Location = New-Object System.Drawing.Size (90,148)
$MailBox.Size = New-Object System.Drawing.Size (200,10)
$ProfGroupBox.Controls.Add($MailBox) #Add mailbox text box to user profile group box (on profile page)
####################################### Member Of GroupBox #######################################
$MemGroupBox = New-Object System.Windows.Forms.GroupBox
$MemGroupBox.Location = New-Object System.Drawing.Size (5,210)
$MemGroupBox.Size = New-Object System.Drawing.Size (387,221)
$MemGroupBox.AutoSize = $true
$MemGroupBox.Text = "Member Of"
$MemGroupBox.DataBindings.DefaultDataSourceUpdateMode = 0
$ProfPage.Controls.Add($MemGroupBox) #Add "Member Of" group box to profile page (on main form)
################ Groups Panel ################
$MemPanel = New-Object System.Windows.Forms.Panel
$MemPanel.Size = New-Object System.Drawing.Size(365,100)
$MemPanel.Location = New-Object System.Drawing.Size(10,25)
$MemPanel.BackColor = 'white'
$MemPanel.BorderStyle = 'FixedSingle'
$MemGroupBox.Controls.Add($MemPanel)
############### Groups TextBox ###############
$MemTextBox = New-Object System.Windows.Forms.TextBox
$MemTextBox.Size = New-Object System.Drawing.Size(350,80)
$MemTextBox.Location = New-Object System.Drawing.Size(10,7)
$MemTextBox.Text = ''
$MemTextBox.BackColor = 'white'
$MemTextBox.BorderStyle = 'FixedSingle'
$MemPanel.Controls.Add($MemTextBox)
#Label for combobox -
$FacilityLabel = New-Object System.Windows.Forms.Label
$FacilityLabel.Text = 'Facility'
$FacilityLabel.Size = New-Object System.Drawing.Size (60,20)
$FacilityLabel.Location = New-Object System.Drawing.Size(55,135)
$MemGroupBox.Controls.Add($FacilityLabel)
#ComboBox -
$FacilityBox = New-Object System.Windows.Forms.ComboBox
$FacilityBox.FlatStyle = 'popup'
$FacilityBox.BackColor = 'white'
$FacilityBox.Location = New-Object System.Drawing.Size(15,165)
$FacilityBox.Size = New-Object System.Drawing.Size(150,15)
$FacilityBox.AutoSize = $true
$FacilityBox.Items.Add("A4 Classified Spark")
$FacilityBox.Items.Add("ABMPC")
$FacilityBox.Items.Add("ACES")
$FacilityBox.Items.Add("ACRE")
$FacilityBox.Items.Add("AMDR")
$FacilityBox.Items.Add("AMDS CVTC")
$FacilityBox.Items.Add("AMDS-CCF")
$FacilityBox.Items.Add("AMSEL")
$FacilityBox.Items.Add("ASCF")
$FacilityBox.Items.Add("BLAST Lab")
$FacilityBox.Items.Add("CSDF")
$FacilityBox.Items.Add("DDA")
$FacilityBox.Items.Add("GSEL-26")
$FacilityBox.Items.Add("INTEROP")
$FacilityBox.Items.Add("LODI")
$FacilityBox.Items.Add("MSI")
$FacilityBox.Items.Add("PARSE")
$FacilityBox.Items.Add("RADAR")
$FacilityBox.Items.Add("REDD")
$FacilityBox.Items.Add("SCOPE")
$FacilityBox.Items.Add("SRTF")
$FacilityBox.Items.Add("SSDS")
$FacilityBox.Items.Add("Viz-Sim")
$FacilityBox.DataBindings.DefaultDataSourceUpdateMode = 0
$MemGroupBox.Controls.Add($FacilityBox)
$AddButton.Add_Click{ #this does not work ?????
$MemTextBox.AppendText('Facility:')
Switch($FacilityBox.SelectedText){
"A4 Classified Spark"{
$MemTextBox.AppendText('A4 Classified Spark ' + '/ No groups')
}
"ABMPC"{
$MemTextBox.AppendText("ABMPC " + "/ No Groups")
}
"ACES"{
$MemTextBox.AppendText("ACES " + "/ No Groups")
}
"ACRE"{
$MemTextBox.AppendText("ACRE " + "/ No Groups")
}
"AMDR"{
$MemTextBox.AppendText("AMDR " + "/ AMDR Users")
$MemTextBox.AppendText("AMDR " + "/ RDSH-AMDR Mapped Network Drives")
}
"AMDS CVTC"{
$MemTextBox.AppendText("AMDS CVTC " + "/ No Groups")
}
"AMDS-CCF"{
$MemTextBox.AppendText("AMDS-CCF " + "/ No Groups")
}
"AMSEL"{
$MemTextBox.AppendText("AMSEL " + "/ +AMSEL-Users")
$MemTextBox.AppendText("AMSEL " + "/ AMSEL-USERS")
$MemTextBox.AppendText("AMSEL " + "/ RDSH-AMSEL Mapped Network Drives")
}
"ASCF"{
$MemTextBox.AppendText("ASCF " + "/ ASCF Users")
$MemTextBox.AppendText("ASCF " + "/ ASCF-Users")
$MemTextBox.AppendText("ASCF " + "/ Remote Desktop Users")
$MemTextBox.AppendText("ASCF " + "/ RDSH-ASDF Mapped Network Drives")
}
"BLAST Lab"{
$MemTextBox.AppendText("BLAST Lab " + "/ Blast-Users")
}
"CSDF"{
$MemTextBox.AppendText("CSDF " + "/ CSDF-Facility Users")
$MemTextBox.AppendText("CSDF " + "/ CSDF-Users")
$MemTextBox.AppendText("CSDF " + "/ RDSH-CSDF Mapped Network Drives")
}
"DDA"{
$MemTextBox.AppendText("DDA " + "/ DDA Users")
$MemTextBox.AppendText("DDA " + "/ RDSH-DDA Mapped Network Drives")
}
"GSEL-26"{
$MemTextBox.AppendText("GSEL-26 " + "/ No Groups")
}
"INTEROP"{
$MemTextBox.AppendText("INTEROP " + "/ ExchangeLegacyInterop")
$MemTextBox.AppendText("INTEROP " + "/ INTEROP_USERS")
}
"LODI"{
$MemTextBox.AppendText("LODI " + "/ No Groups")
}
"MSI"{
$MemTextBox.AppendText("MSI " + "/ MSI Users")
$MemTextBox.AppendText("MSI " + "/ RDSH-MSI Mapped Network Drives")
}
"PARSE"{
$MemTextBox.AppendText("PARSE " + "/ PARSE-Users")
$MemTextBox.AppendText("PARSE " + "/ RDSH-PARSE Mapped Network Drives")
}
"RADAR"{
$MemTextBox.AppendText("RADAR " + "/ RADAR-Lab Users")
$MemTextBox.AppendText("RADAR " + "/ RADAR-Lab-Users")
$MemTextBox.AppendText("RADAR " + "/ RDSH-RADAR Mapped Network Drives")
}
"REDD"{
$MemTextBox.AppendText("REDD " + "/ REDD Users")
$MemTextBox.AppendText("REDD " + "/ REDD-Vmusers")
}
"SCOPE"{
$MemTextBox.AppendText("SCOPE " + "/ SCOPE-Users")
$MemTextBox.AppendText("SCOPE " + "/ RDSH-SCOPE Mapped Network Drives")
}
"SRTF"{
$MemTextBox.AppendText("SRIF " + "/ SRIF-Users")
$MemTextBox.AppendText("SRIF " + "/ RDSH-SRTF Mapped Network Drives")
}
"SSDS"{
$MemTextBox.AppendText("SSDS " + "/ SSDSUsers")
}
"Viz-Sim"{
$MemTextBox.AppendText("Viz-Sim " + "/ No Groups")
}
}
}
#Add to group button -
$AddButton = New-Object System.Windows.Forms.Button
$AddButton.Text = 'Add'
$AddButton.FlatStyle = 'flat'
$AddButton.BackColor = "white"
$AddButton.Location = New-Object System.Drawing.Size(200,162.5)
$AddButton.Size = New-Object System.Drawing.Size(80,12)
$AddButton.AutoSize = $true
$AddButton.FlatAppearance.BorderColor = 'lightgray'
$AddButton.DataBindings.DefaultDataSourceUpdateMode = 0
$MemGroupBox.Controls.Add($AddButton)
#Remove from group button -
$RemButton = New-Object System.Windows.Forms.Button
$RemButton.Text = 'Remove'
$RemButton.FlatStyle = 'flat'
$RemButton.BackColor = "white"
$RemButton.Location = New-Object System.Drawing.Size(288,162.5)
$RemButton.Size = New-Object System.Drawing.Size(80,12)
$RemButton.AutoSize = $true
$RemButton.FlatAppearance.BorderColor = 'lightgray'
$RemButton.DataBindings.DefaultDataSourceUpdateMode = 0
$MemGroupBox.Controls.Add($RemButton)
############################################################ Organization Page #########################################################################
$OrgPage = New-Object System.Windows.Forms.TabPage
$OrgPage.Text = "Organization"
$OrgPage.Font = $GUIFont
$OrgPage.Location = New-Object System.Drawing.Size(15,70)
$OrgPage.Size = New-Object System.Drawing.Size(405,475)
$OrgPage.AutoSize = $true
$OrgPage.DataBindings.DefaultDataSourceUpdateMode = 0
$tabControl.Controls.Add($OrgPage) #Add "Organization" page to tab control (in main form)
####################################### Environment GroupBox #######################################
$EnvGroupBox = New-Object System.Windows.Forms.GroupBox
$EnvGroupBox.Location = New-Object System.Drawing.Size(5,10)
$EnvGroupBox.Size = New-Object System.Drawing.Size(387,70)
$EnvGroupBox.AutoSize = $true
$EnvGroupBox.Text = "Environment"
$EnvGroupBox.DataBindings.DefaultDataSourceUpdateMode = 0
$OrgPage.Controls.Add($EnvGroupBox) #Add "Environment" group box to organization page (on main form)
#Environment info Label-
$EnvLabel = New-Object System.Windows.Forms.Label
$EnvLabel.Location = New-Object System.Drawing.Size(10,20)
$EnvLabel.Size = New-Object System.Drawing.Size (320,20)
$EnvLabel.Text = "Configure Remote Desktop Services startup enviroment."
$EnvGroupBox.Controls.Add($EnvLabel) #Add label to provide environment info to environment group box (on organization page)
#Image -
$envimage = [System.Drawing.Image]::Fromfile('C:\Users\turflhj1\client-devices.png')
$envpictureBox = new-object Windows.Forms.PictureBox
$envpictureBox.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::Zoom
$envpictureBox.Size = New-Object System.Drawing.Size (45,45)
$envpictureBox.Location = New-Object System.Drawing.Size (325,20)
$envpictureBox.Image = $envimage
$EnvGroupBox.Controls.Add($envpictureBox) #Add computer graphic image to environment group box (on organization page)
################ Client Devices ################
#Label -
$ClientLabel = New-Object System.Windows.Forms.Label
$ClientLabel.Location = New-Object System.Drawing.Size(10,45)
$ClientLabel.AutoSize = $true
$ClientLabel.Text = "Client Devices "
$EnvGroupBox.Controls.Add($ClientLabel)
#ComboBox -
$ClientD = New-Object System.Windows.Forms.ComboBox
$ClientD.FlatStyle = 'popup'
$ClientD.BackColor = 'white'
$ClientD.Location = New-Object System.Drawing.Size(100,45)
$ClientD.Size = New-Object System.Drawing.Size(210,12)
$ClientD.AutoSize = $true
$ClientD.Items.Add("Connect Client Devices at Logon")
$ClientD.Items.Add("Connect Client Printers at Logon")
$ClientD.Items.Add("Default to Main Client Computer")
$ClientD.DataBindings.DefaultDataSourceUpdateMode = 0
$EnvGroupBox.Controls.Add($ClientD) #Add client devices group box and label to environment group box (on organization page)
####################################### Remote Control GroupBox #######################################
$RemCGroupBox = New-Object System.Windows.Forms.GroupBox
$RemCGroupBox.Location = New-Object System.Drawing.Size(5,100)
$RemCGroupBox.Size = New-Object System.Drawing.Size(387,90)
$RemCGroupBox.AutoSize = $true
$RemCGroupBox.Text = "Remote Control"
$RemCGroupBox.DataBindings.DefaultDataSourceUpdateMode = 0
$OrgPage.Controls.Add($RemCGroupBox) #Add "Remote Control" group box to organization page (on main form)
#Remote Control label-
$RemCLabel = New-Object System.Windows.Forms.Label
$RemCLabel.Location = New-Object System.Drawing.Size(10,20)
$RemCLabel.Size = New-Object System.Drawing.Size (335,20)
$RemCLabel.Text = "Configure Remote Desktop Services remote control settings."
$RemCGroupBox.Controls.Add($RemCLabel) #Add label to provide remote control info to remote control group box (on organization page)
#Image -
$RemCimage = [System.Drawing.Image]::Fromfile('C:\Users\turflhj1\remote_access-512.png')
$RemCpictureBox = new-object Windows.Forms.PictureBox
$RemCpictureBox.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::Zoom
$RemCpictureBox.Size = New-Object System.Drawing.Size (45,45)
$RemCpictureBox.Location = New-Object System.Drawing.Size (325,38)
$RemCpictureBox.Image = $RemCimage
$RemCGroupBox.Controls.Add($RemCpictureBox) #Add remote computers image to remote control group box (on organization page)
################ Enable Remote Control CheckBox ################
$CheckBox1 = New-Object System.Windows.Forms.CheckBox
$CheckBox1.FlatStyle = 'popup'
$CheckBox1.Location = New-Object System.Drawing.Size(10,42)
$CheckBox1.Size = New-Object System.Drawing.Size(10,10)
$CheckBox1.AutoSize = $true
$CheckBox1.Text = "Enable Remote Control"
$CheckBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$RemCGroupBox.Controls.Add($CheckBox1) #Add "Enable Remote Control" checkbox to remote control group box (on organization page)
$CheckBox1.Add_CheckStateChanged({ #Only if "Enable Remote Control" checkbox is checked, "Require User's Permission" checkbox becomes visible
if($CheckBox1.Checked -eq $true){
$CheckBox2.enabled = $true
}
else{
$CheckBox2.enabled = $false
}
})
################ User Permission CheckBox ################
$CheckBox2 = New-Object System.Windows.Forms.CheckBox
$CheckBox2.Enabled = $false
$CheckBox2.FlatStyle = 'popup'
$CheckBox2.Location = New-Object System.Drawing.Size(160,42)
$CheckBox2.Size = New-Object System.Drawing.Size(10,10)
$CheckBox2.AutoSize = $true
$CheckBox2.Text = "Require User's Permission"
$CheckBox2.DataBindings.DefaultDataSourceUpdateMode = 0
$RemCGroupBox.Controls.Add($CheckBox2) #Add "Require User's Permission" checkbox to remote control group box (on organization page)
$CheckBox2.Add_CheckStateChanged({ #Only if "Require User's Permission" checkbox is checked, control level combobox becomes visible
if($CheckBox2.Checked -eq $true){
$Control3.enabled = $true
}
else{
$Control3.enabled = $false
}
})
################ Level of Control ################
#ComboBox -
$Control3 = New-Object System.Windows.Forms.ComboBox
$Control3.Enabled = $false
$Control3.FlatStyle = 'popup'
$Control3.BackColor = 'white'
$Control3.Location = new-object System.Drawing.Size(176,66)
$Control3.Size = new-object System.Drawing.Size(125,15)
$Control3.AutoSize = $true
$Control3.Items.Add("View User's Session")
$Control3.Items.Add("Interact with Session")
$Control3.DataBindings.DefaultDataSourceUpdateMode = 0
$RemCGroupBox.Controls.Add($Control3) #Add Combo box to select control level to remote control group box (on organization page)
####################################### Sessions GroupBox #######################################
$SessGroupBox = New-Object System.Windows.Forms.GroupBox
$SessGroupBox.DataBindings.DefaultDataSourceUpdateMode = 0
$SessGroupBox.Location = New-Object System.Drawing.Size(5,210)
$SessGroupBox.Size = New-Object System.Drawing.Size(387,150)
$SessGroupBox.AutoSize = $true
$SessGroupBox.Text = "Sessions"
$OrgPage.Controls.Add($SessGroupBox) #Add "Sessions" group box to organization page (on main form)
#Sessions info Label-
$SessLabel = New-Object System.Windows.Forms.Label
$SessLabel.Location = New-Object System.Drawing.Size(10,20)
$SessLabel.Size = New-Object System.Drawing.Size (365,20)
$SessLabel.Text = "Set Remote Desktop Services timeout and reconnection settings."
$SessGroupBox.Controls.Add($SessLabel) #Add label to provide session info to session group box (on organization page)
#Image -
$Sessimage = [System.Drawing.Image]::Fromfile('C:\Users\turflhj1\sessions.png')
$SesspictureBox = new-object Windows.Forms.PictureBox
$SesspictureBox.SizeMode = [System.Windows.Forms.PictureBoxSizeMode]::Zoom
$SesspictureBox.Size = New-Object System.Drawing.Size (45,45)
$SesspictureBox.Location = New-Object System.Drawing.Size (325,55)
$SesspictureBox.Image =$Sessimage
$SessGroupBox.Controls.Add($SesspictureBox) #Add computer settings image to session group box (on organization page)
################ Disconnected Sessions ComboBox ################
#Label -
$Box1Label = New-Object System.Windows.Forms.Label
$Box1Label.Location = New-Object System.Drawing.Size(10,47)
$Box1Label.AutoSize = $true
$Box1Label.Text = "End a Disconnected Session "
$SessGroupBox.Controls.Add($Box1Label)
#ComboBox -
$ListBox1 = New-Object System.Windows.Forms.ComboBox
$ListBox1.FlatStyle = 'popup'
$ListBox1.BackColor = 'white'
$ListBox1.Location = New-Object System.Drawing.Size(180,45)
$ListBox1.Size = New-Object System.Drawing.Size(105,15)
$ListBox1.AutoSize = $true
$listBox1.Items.Add('Never')
$listBox1.Items.Add('1 Minute')
$listBox1.Items.Add('5 Minutes')
$listBox1.Items.Add('10 Minutes')
$listBox1.Items.Add('15 Minutes')
$listBox1.Items.Add('30 Minutes')
$listBox1.Items.Add('1 Hour')
$ListBox1.DataBindings.DefaultDataSourceUpdateMode = 0
$SessGroupBox.Controls.Add($ListBox1) #Add "End a disconnected session" combobox and label to select end time to sessions group box (on organization page)
################ Active Session Limit ComboBox ################
#Label -
$Box2Label = New-Object System.Windows.Forms.Label
$Box2Label.Location = New-Object System.Drawing.Size(10,72)
$Box2Label.AutoSize = $true
$Box2Label.Text = "Active Session Limit "
$SessGroupBox.Controls.Add($Box2Label)
#ComboBox -
$ListBox2 = New-Object System.Windows.Forms.ComboBox
$ListBox2.FlatStyle = 'popup'
$ListBox2.BackColor = 'white'
$ListBox2.Location = New-Object System.Drawing.Size(180,70)
$ListBox2.Size = New-Object System.Drawing.Size(105,15)
$ListBox2.AutoSize = $true
$listBox2.Items.Add('Never')
$listBox2.Items.Add('1 Minute')
$listBox2.Items.Add('5 Minutes')
$listBox2.Items.Add('10 Minutes')
$listBox2.Items.Add('15 Minutes')
$listBox2.Items.Add('30 Minutes')
$listBox2.Items.Add('1 Hour')
$ListBox2.DataBindings.DefaultDataSourceUpdateMode = 0
$SessGroupBox.Controls.Add($ListBox2) #Add "Active session limit" combobox and label to select active session limit time to sessions group box (on organization page)
################ Idle Session Limit ComboBox ################
#Label -
$Box3Label = New-Object System.Windows.Forms.Label
$Box3Label.Location = New-Object System.Drawing.Size(10,97)
$Box3Label.AutoSize = $true
$Box3Label.Text = "Idle Session Limit "
$SessGroupBox.Controls.Add($Box3Label)
#ComboBox -
$ListBox3 = New-Object System.Windows.Forms.ComboBox
$ListBox3.FlatStyle = 'popup'
$ListBox3.BackColor = 'white'
$ListBox3.Location = New-Object System.Drawing.Size(180,95)
$ListBox3.Size = New-Object System.Drawing.Size(105,15)
$ListBox3.AutoSize = $true
$listBox3.Items.Add('Never')
$listBox3.Items.Add('1 Minute')
$listBox3.Items.Add('5 Minutes')
$listBox3.Items.Add('10 Minutes')
$listBox3.Items.Add('15 Minutes')
$listBox3.Items.Add('30 Minutes')
$listBox3.Items.Add('1 Hour')
$ListBox3.DataBindings.DefaultDataSourceUpdateMode = 0
$SessGroupBox.Controls.Add($ListBox3) #Add "Idle session limit" combobox and label to select idle session limit time to sessions group box (on organization page)
################ Session Limit Controls ################