-
Notifications
You must be signed in to change notification settings - Fork 0
/
osfortify.py
4847 lines (4380 loc) · 210 KB
/
osfortify.py
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
################################
# OSFortify v2.0 by DannnyzZ ##
################################
# V2.0
# - Added software inventory
# Autorun
# Powershell security
# Terminal security
# Added checking for update in not windows related software
# Added GPO module
# Added Event Viewer & logging module
# Added UAC hardening
# Added Terminal hardening
# Add managing services:
# Powershell
#Future
# Add exporting after execution to pdf
# BLOCK PORT
import os
import subprocess
import curses
import ctypes
import sys
import tkinter as tk
from tkinter import filedialog
from tkinter import messagebox
import subprocess
# FUNCTION - CONSOLE WINDOW SETTINGS
hwnd = ctypes.windll.kernel32.GetConsoleWindow()
ctypes.windll.user32.MoveWindow(hwnd, 0, 0, 660, 740, True)
# S C R I P T S # S C R I P T S # S C R I P T S # S C R I P T S # S C R I P T S # S C R I P T S # S C R I P T S # S C R I P T S # S C R I P T S #
# LIST OF OBJECTS (TICKMARK STATUS, NAME, GROUP, VALUES)
################################################# O B J E C T S 1 ###############################################################################
objects = [
# SERVICES
{
"group": "Services",
"name": "Windows Defender",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Windows Defender |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'WinDefend' | Select-Object -Property Name, Status, StartType
$defender = Get-MpComputerStatus
$defenderPreferences = Get-MpPreference
if ($defender.AntivirusEnabled) {
Write-Output "`n Windows Defender is enabled."
$defenderVersion = $defender.AntivirusSignatureVersion
Write-Output " Windows Defender version: $defenderVersion"
$defenderSignatureVersion = $defender.AntivirusSignatureUpdateDateTime
Write-Output " Windows Defender signature version: $defenderSignatureVersion"
if ($defender.SignatureUpdateAvailable) {
Write-Output " New Windows Defender updates are available."
} else {
Write-Output " Windows Defender is up to date. No available updates."
}
if ($defenderPreferences.DisableRealtimeMonitoring) {
Write-Output " Real-time monitoring is disabled."
} else {
Write-Output " Real-time monitoring is enabled."
}
if ($defenderPreferences.DisableRealtimeMonitoring -eq $false) {
Write-Output " Real-time protection is enabled."
} else {
Write-Output " Real-time protection is disabled."
}
if ($defenderPreferences.DisableBehaviorMonitoring -eq $false) {
Write-Output " Behavior monitoring is enabled."
} else {
Write-Output " Behavior monitoring is disabled."
}
if ($defenderPreferences.DisableOnAccessProtection -eq $false) {
Write-Output " On-access protection is enabled."
} else {
Write-Output " On-access protection is disabled."
}
if ($defenderPreferences.ExclusionPath) {
Write-Output "`n The following paths are excluded from scans:"
foreach ($path in $defenderPreferences.ExclusionPath) {
Write-Output " $path"
}
} else {
Write-Output " There are no path exclusions."
}
} else {
Write-Output " Windows Defender is not enabled."
}
} catch {
Write-Output " Error: Unable to retrieve Defender status."
}
''',
''' try { Set-Service -Name 'WinDefend' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'WinDefend' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'WinDefend' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'WinDefend' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services",
"name": "Windows Firewall",
"tickmark": False,
"values": [
'''
try {
$profiles = @("Domain", "Public", "Private")
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Windows Firewall |" -ForegroundColor Cyan
foreach($profile in $profiles){
$firewallStatus = (Get-NetFirewallProfile -Name $profile).Enabled
Write-Output "`n Firewall status for $profile profile: $(if($firewallStatus -eq 'True'){'Enabled'} else {'Disabled'})"
}
} catch {
Write-Output " Error: Unable to retrieve Firewall status."
}
''',
''' try { Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True } catch { Write-Output ' Error: Unable to enable Windows Firewall.' } ''',
''' try { Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False } catch { Write-Output ' Error: Unable to disable Windows Firewall.' } ''',
''' try { Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled True } catch { Write-Output ' Error: Unable to enable Windows Firewall.' } ''',
''' try { Set-NetFirewallProfile -Profile Domain,Public,Private -Enabled False } catch { Write-Output ' Error: Unable to disable Windows Firewall.' } ''',
]
},
{
"group": "Services",
"name": "Windows Update",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Windows Update |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'wuauserv' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Output "| Windows Updates |"
$session = New-Object -ComObject "Microsoft.Update.Session"
$searcher = $session.CreateUpdateSearcher()
$updates = $searcher.Search("Type='Software' and IsInstalled=0")
if ($updates.Updates.Count -gt 0) {
$latestUpdate = $updates.Updates | Sort-Object -Property Date -Descending | Select-Object -First 1
Write-Output "`n New Updates Available: $($updates.Updates.Count)"
Write-Output " Latest Update Title: $($latestUpdate.Title)"
Write-Output " KB Article IDs: $($latestUpdate.KBArticleIDs -join ', ')"
} else {
Write-Output "`n Windows is up to date. No available updates."
}
} catch {
Write-Output " Error: Unable to retrieve Windows Update status."
}
''',
''' try { Set-Service -Name 'wuauserv' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'wuauserv' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'wuauserv' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'wuauserv' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services",
"name": "Windows Remote Registry",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Windows Remote Registry |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'RemoteRegistry' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'RemoteRegistry' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'RemoteRegistry' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'RemoteRegistry' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'RemoteRegistry' -Force } catch { Write-Output ' Error: Unable to stop the service.' } '''
]
},
{
"group": "Services",
"name": "Windows Remote Management",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Windows Remote Management |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'winrm' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'winrm' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'winrm' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'winrm' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'winrm' -Force } catch { Write-Output ' Error: Unable to stop the service.' } '''
]
},
{
"group": "Services",
"name": "Windows Management Instrumentation (WMI)",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Windows Management Instrumentation (WMI) |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'winmgmt' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'winmgmt' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'winmgmt' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'winmgmt' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'winmgmt' -Force } catch { Write-Output ' Error: Unable to stop the service.' } '''
]
},
{
"group": "Services", "name": "Remote Desktop Protocol (RDP)", "tickmark": False, "values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Remote Desktop Protocol (RDP) |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'TermService' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'TermService' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'TermService' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'TermService' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'TermService' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services", "name": "Windows Error Reporting", "tickmark": False, "values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Windows Error Reporting |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'WerSvc' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'WerSvc' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'WerSvc' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'WerSvc' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'WerSvc' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services",
"name": "Windows Remote Assistance",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Windows Remote Assistance |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'SessionEnv' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'SessionEnv' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'SessionEnv' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'SessionEnv' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'SessionEnv' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services",
"name": "Windows Fax and Scan",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Windows Fax and Scan |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'fax' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'fax' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'fax' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'fax' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'fax' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services",
"name": "Internet Printing Client",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Internet Printing Client |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'PrintNotify' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'PrintNotify' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'PrintNotify' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'PrintNotify' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'PrintNotify' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services",
"name": "Universal Plug and Play (UPnP)",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Universal Plug and Play (UPnP) |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'SSDPSRV' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'SSDPSRV' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'SSDPSRV' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'SSDPSRV' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'SSDPSRV' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services",
"name": "Bluetooth",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Bluetooth |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'bthserv' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'bthserv' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'bthserv' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'bthserv' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'bthserv' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services",
"name": "Windows Search",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Windows Search |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'WSearch' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'WSearch' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'WSearch' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'WSearch' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'WSearch' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services",
"name": "Print Spooler",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Print Spooler |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'Spooler' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'Spooler' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'Spooler' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'Spooler' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'Spooler' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services",
"name": "Microsoft IIS",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Microsoft IIS |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'W3SVC' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'W3SVC' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'W3SVC' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'W3SVC' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'W3SVC' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services",
"name": "NetBIOS",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| NetBIOS |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'NetBT' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'NetBT' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'NetBT' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'NetBT' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'NetBT' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services",
"name": "Link-Local Multicast Name Resolution (LLMNR)",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Link-Local Multicast Name Resolution (LLMNR) |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'lltdsvc' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-Service -Name 'lltdsvc' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'lltdsvc' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'lltdsvc' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'lltdsvc' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Services",
"name": "Server Message Block Version 1 (SMB1)",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Server Message Block Version 1 (SMB1) |" -ForegroundColor Cyan
$smb1Enabled = (Get-SmbServerConfiguration | Select-Object -ExpandProperty EnableSMB1Protocol)
if ($smb1Enabled) {
Write-Output "`n SMB1 is enabled."
} else {
Write-Output "`n SMB1 is disabled."
}
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-SmbServerConfiguration -EnableSMB1Protocol $true } catch { Write-Output ' Error: Unable to enable SMB1.' } ''',
''' try { Set-SmbServerConfiguration -EnableSMB1Protocol $false } catch { Write-Output ' Error: Unable to disable SMB1.' } ''',
''';''',
''';''',
]
},
{
"group": "Services",
"name": "Server Message Block Version 2 (SMB2)",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Server Message Block Version 2 (SMB2) |" -ForegroundColor Cyan
$smb2Enabled = (Get-SmbServerConfiguration | Select-Object -ExpandProperty EnableSMB2Protocol)
if ($smb2Enabled) {
Write-Output "`n SMB2 is enabled."
} else {
Write-Output "`n SMB2 is disabled."
}
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
''' try { Set-SmbServerConfiguration -EnableSMB2Protocol $true } catch { Write-Output ' Error: Unable to enable SMB2.' } ''',
''' try { Set-SmbServerConfiguration -EnableSMB2Protocol $false } catch { Write-Output ' Error: Unable to disable SMB2.' } ''',
''';''',
''';''',
]
},
{
"group": "Services",
"name": "Telnet",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Telnet |" -ForegroundColor Cyan
$telnetFeature = Get-WindowsOptionalFeature -FeatureName 'TelnetClient' -Online
if ($telnetFeature) {
if ($telnetFeature.State -eq "Enabled") {
Write-Output "`n Telnet Client: Enabled"
} elseif ($telnetFeature.State -eq "Disabled") {
Write-Output "`n Telnet Client: Disabled"
} else {
Write-Output "`n Telnet Client: State unknown"
}
} else {
Write-Output "`n Telnet Client: Not installed"
}
} catch {
Write-Output "`n Error: Unable to retrieve service information."
}
''',
''' try { Enable-WindowsOptionalFeature -FeatureName 'TelnetClient' -Online } catch { Write-Output '`n Error: Unable to enable Telnet Client.' } ''',
''' try { Disable-WindowsOptionalFeature -FeatureName 'TelnetClient' -Online } catch { Write-Output '`n Error: Unable to disable Telnet Client.' } ''',
''' try { Start-Process -FilePath 'telnet.exe' } catch { Write-Output '`n Error: Unable to start the service.' } ''',
''' try { Stop-Process -Name 'telnet' -Force } catch { Write-Output '`n Error: Unable to stop the service.' } ''',
]
},
]
################################################# O B J E C T S 2 ###############################################################################
objects2 = [
{
"group": "Features/Network",
"name": "Guest user account",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Guest user account |" -ForegroundColor Cyan
$guestAccount = Get-LocalUser -Name 'Guest' -ErrorAction SilentlyContinue
if ($guestAccount) {
Write-Output "`n Guest user account exists."
} else {
Write-Output "`n Guest user account does not exist!"
}
} catch {
Write-Output "`n Error: Unable to retrieve Guest user account status."
}
''',
"Try {Enable-LocalUser -Name 'Guest'} Catch {Write-Output '`n Cannot enable Guest user account!'}",
"Try {Disable-LocalUser -Name 'Guest'} Catch {Write-Output '`n Cannot disable Guest user account!'}",
";",
";",
]
},
{
"group": "Features/Network",
"name": "Autorun",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Autorun |" -ForegroundColor Cyan
Write-Host " "
# Check autorun state
$regKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer"
$regValueName = "NoDriveTypeAutorun"
if (Test-Path $regKey) {
$noDriveTypeAutorun = (Get-ItemProperty -Path $regKey -Name $regValueName -ErrorAction SilentlyContinue).$regValueName
if ($noDriveTypeAutorun -eq 255) {
Write-Host " Autorun is disabled."
} elseif ($noDriveTypeAutorun -eq 145) {
Write-Host " Autorun is enabled."
} else {
Write-Host " Unknown autorun state."
}
} else {
Write-Host " Autorun settings not found."
}
} catch {
Write-Host " An error occurred: $_"
}
''',
''' Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutorun" -Value 145 -Type DWord ''',
''' Set-ItemProperty -Path "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer" -Name "NoDriveTypeAutorun" -Value 255 -Type DWord ''',
";",
";",
]
},
{
"group": "Features/Network",
"name": "Terminal",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Terminal |" -ForegroundColor Cyan
Write-Host " "
# Check if Command Prompt is running with administrative privileges
$isAdmin = ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")
# Check if Command Prompt execution policy is restricted
$executionPolicy = Get-ExecutionPolicy
# Check if Command Prompt usage is restricted via Group Policy
$regKey = "HKLM:\SOFTWARE\Policies\Microsoft\Windows\System"
$regValueName = "DisableCMD"
if (Test-Path $regKey) {
$disableCmd = (Get-ItemProperty -Path $regKey -Name $regValueName -ErrorAction SilentlyContinue).$regValueName
if ($disableCmd -eq 1) {
$groupPolicyRestriction = " Command Prompt usage is restricted via Group Policy"
} else {
$groupPolicyRestriction = " Command Prompt usage is not restricted via Group Policy"
}
} else {
$groupPolicyRestriction = " No Group Policy restriction found for Command Prompt usage"
}
# Output the results
Write-Host " Command Prompt Running with Administrative Privileges: $isAdmin"
Write-Host " Command Prompt Execution Policy: $executionPolicy"
Write-Host $groupPolicyRestriction
}
catch {
Write-Host "An error occurred: $_" -ForegroundColor Red
}
''',
'''
# Remove the item property
Remove-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\System' -Name DisableCMD
''',
''',
# Create the registry path if it doesn't exist
New-Item -Path 'HKCU:\Software\Policies\Microsoft\Windows\System' -Force
# Disable Command Prompt
Set-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\System' -Name DisableCMD -Value 1
''',
";",
";",
]
},
{
"group": "Features/Network",
"name": "Event Viewer",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Event Viewer |" -ForegroundColor Cyan
try {
$serviceStatus = Get-Service -Name 'EventLog' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
} catch {
Write-Output " Error: An error occurred while accessing Event Viewer."
}
''',
''' try { Set-Service -Name 'EventLog' -StartupType Automatic } catch { Write-Output ' Error: Unable to set startup type to Automatic.' } ''',
''' try { Set-Service -Name 'EventLog' -StartupType Disabled } catch { Write-Output ' Error: Unable to set startup type to Disabled.' } ''',
''' try { Start-Service -Name 'EventLog' } catch { Write-Output ' Error: Unable to start the service.' } ''',
''' try { Stop-Service -Name 'EventLog' -Force } catch { Write-Output ' Error: Unable to stop the service.' } ''',
]
},
{
"group": "Features/Network",
"name": "File Transfer Protocol (FTP)",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| File Transfer Protocol (FTP) |" -ForegroundColor Cyan
$serviceStatus = Get-Service -Name 'ftpsvc' | Select-Object -Property Name, Status, StartType
$formattedStatus = $serviceStatus | ForEach-Object {
$formattedName = "`n Name: " + $_.Name
$formattedStatus = " Status: " + $_.Status
$formattedStartType = " StartType: " + $_.StartType
$formattedInfo = $formattedName, $formattedStatus, $formattedStartType -join "`n"
$formattedInfo
}
Write-Output $formattedStatus.TrimEnd()
} catch {
Write-Output " Error: Unable to retrieve service information."
}
''',
"try {Set-Service -Name 'ftpsvc' -StartupType Automatic -ErrorAction Stop} catch {Write-Output '`n Cannot set FTP service to automatic startup!'}",
"try {Set-Service -Name 'ftpsvc' -StartupType Disabled -ErrorAction Stop} catch {Write-Output '`n Cannot set FTP service to disabled startup!'}",
"try {Start-Service -Name 'ftpsvc' -ErrorAction Stop} catch {Write-Output '`n Cannot start FTP service!'}",
"try {Stop-Service -Name 'ftpsvc' -Force -ErrorAction Stop} catch {Write-Output '`n Cannot stop FTP service!'}",
]
},
{
"group": "Features/Network",
"name": "Windows Media Player",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| Windows Media Player |" -ForegroundColor Cyan
if (Get-WindowsOptionalFeature -Online -FeatureName 'WindowsMediaPlayer' -ErrorAction SilentlyContinue) {
Write-Output "`n Windows Media Player is installed."
} else {
Write-Output "`n Windows Media Player is not installed."
}
} catch {
Write-Output "`n Error: Unable to retrieve Windows Media Player status."
}
''',
''' try {Enable-WindowsOptionalFeature -Online -FeatureName 'WindowsMediaPlayer' -NoRestart -ErrorAction Stop} catch {Write-Output '`n Cannot enable Windows Media Player feature!'} ''',
''' try {Disable-WindowsOptionalFeature -Online -FeatureName 'WindowsMediaPlayer' -NoRestart -ErrorAction Stop} catch {Write-Output '`n Cannot disable Windows Media Player feature!'} ''',
''' try {Start-Process -FilePath 'C:\\Program Files\\Windows Media Player\\wmplayer.exe' -ErrorAction Stop} catch {Write-Output '`n Cannot start Windows Media Player!'} ''',
''' try {Stop-Process -Name 'wmplayer' -Force -ErrorAction Stop} catch {Write-Output '`n Cannot stop Windows Media Player!'} ''',
]
},
{
"group": "Features/Network",
"name": "USB ports",
"tickmark": False,
"values": [
'''
try {
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| USB ports |" -ForegroundColor Cyan
$usbPorts = Get-PnpDevice -Class "USB" | Select-Object -Property DeviceID, Status, Parent
foreach ($port in $usbPorts) {
$portNumber = $port.DeviceID -replace "\\\\|USBSTOR\\\\DISK&VEN_|&REV.*$";
$parent = $port.Parent -replace ".*\\\\\\\\(?<parent>.+?)\\\\\\\\.*", '$1';
$status = if ($port.Status -eq "OK") { " Enabled" } else { " Disabled" };
Write-Output "`n USB port $portNumber is $status. Parent: $parent"
}
} catch {
Write-Output "`n Error: Unable to retrieve USB ports status."
}
''',
''' try {Set-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR' -Name 'Start' -Value 3; Set-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Power' -Name 'SelectiveSuspendEnabled' -Value 1; Write-Output ' USB ports have been enabled.'} catch {Write-Output ' Cannot enable USB ports!'} ''',
''' try {Set-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Services\\USBSTOR' -Name 'Start' -Value 4; Set-ItemProperty -Path 'HKLM:\\SYSTEM\\CurrentControlSet\\Control\\Power' -Name 'SelectiveSuspendEnabled' -Value 0; Write-Output ' USB ports have been disabled.'} catch {Write-Output ' Cannot disable USB ports!'} ''',
'''
try {
$usbDevices = Get-PnpDevice -Class "USB"
foreach ($usbDevice in $usbDevices) {
if ($usbDevice.Status -ne "OK") {
Enable-PnpDevice -InstanceId $usbDevice.InstanceId -Confirm:$false
Write-Output "`n USB port $($usbDevice.DeviceID) has been started."
} else {
Write-Output "`n USB port $($usbDevice.DeviceID) is already started."
}
}
} catch {
Write-Output "`n Error: Unable to start USB ports."
}
''',
'''
try {
$usbDevices = Get-PnpDevice -Class "USB"
foreach ($usbDevice in $usbDevices) {
if ($usbDevice.Status -eq "OK") {
Disable-PnpDevice -InstanceId $usbDevice.InstanceId -Confirm:$false
Write-Output "`n USB port $($usbDevice.DeviceID) has been stopped."
} else {
Write-Output "`n USB port $($usbDevice.DeviceID) is already stopped."
}
}
} catch {
Write-Output "`n Error: Unable to stop USB ports."
}
''',
]
},
{
"group": "Features/Network",
"name": "User Account Control (UAC)",
"tickmark": False,
"values": [
'''
try {
$uacPolicy = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' | Select-Object EnableInstallerDetection, FilterAdministratorToken, PromptOnSecureDesktop, ConsentPromptBehaviorAdmin
Write-Output "`n_________________________________________________________________________________________________________"
Write-Host "| UAC Group Policy Settings |" -ForegroundColor Cyan
Write-Output "`n Enable Installer Detection: $(
switch ($uacPolicy.EnableInstallerDetection) {
0 { 'Disabled' }
1 { 'Enabled' }
default { 'Unknown' }
}
)"
Write-Output " Filter Administrator Token: $(
switch ($uacPolicy.FilterAdministratorToken) {
0 { 'Disabled' }
1 { 'Enabled' }
default { 'Unknown' }
}
)"
Write-Output " Prompt On Secure Desktop: $(
switch ($uacPolicy.PromptOnSecureDesktop) {
0 { 'Disabled' }
1 { 'Enabled' }
default { 'Unknown' }
}
)"
Write-Output " Consent Prompt Behavior for Admins: $(
switch ($uacPolicy.ConsentPromptBehaviorAdmin) {
0 { 'No prompt' }
1 { 'Prompt for credentials on the secure desktop' }
2 { 'Prompt for consent on the secure desktop' }
3 { 'Prompt for consent on the non-secure desktop' }
4 { 'Prompt for credentials on the non-secure desktop' }
default { 'Unknown' }
}
)"
} catch {
Write-Output "`n Error: Unable to retrieve UAC group policy settings."
}
''',
'''
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name EnableInstallerDetection -Value 0
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name FilterAdministratorToken -Value 0
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name PromptOnSecureDesktop -Value 0
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name ConsentPromptBehaviorAdmin -Value 0
$uacPolicy = Get-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' | Select-Object EnableInstallerDetection, FilterAdministratorToken, PromptOnSecureDesktop, ConsentPromptBehaviorAdmin
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name EnableInstallerDetection -Value 1
Set-ItemProperty -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System' -Name FilterAdministratorToken -Value 1