-
Notifications
You must be signed in to change notification settings - Fork 0
/
pke_meter.ps1
1619 lines (1606 loc) · 127 KB
/
pke_meter.ps1
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
<#
The Psycho Kinectic Energy Meter (P.K.E. Meter) was one
of the Ghostbusters tools invented by Dr. Egon Spengler
that enabled them to track ghosts and other entities.
#>
mode con:cols=90 lines=62
Import-Module activedirectory
$user = $env:UserName
function ResetAccount($dn){
write-host 'Removing AdminCount attribute... ' -NoNewline
try{
Get-ADObject $dn | set-adobject -Remove @{admincount=1}
Write-Host 'OK' -ForegroundColor Green
}
catch{
Write-Host 'Failed.' -ForegroundColor Red
Write-Host $_ -ForegroundColor DarkRed
}
write-host 'Resettings ACL... ' -NoNewline
try{
$acl = Get-ACL -Path "AD:\$dn"
$acl.SetAccessRuleProtection($False,$True)
Set-Acl -Path "AD:\$dn" -AclObject $acl
Write-Host 'OK' -ForegroundColor Green
}
catch{
Write-Host 'Failed.' -ForegroundColor Red
Write-Host $_ -ForegroundColor DarkRed
}
}
<#----------------------------------------------------------------------------------------------------
Object type selection
----------------------------------------------------------------------------------------------------#>
do {
[string]$object_type = 0
while ( $object_type -lt 1 -or $object_type -gt 5) {
Write-Host ' _.-,'
Write-Host -ForegroundColor Red ' _' -NoNewline; Write-Host '.-` / ' -NoNewline; Write-Host -ForegroundColor Red '.._'
Write-Host -ForegroundColor Red ' .-:`' -NoNewline; Write-Host '/ - - \' -NoNewline; Write-Host -ForegroundColor Red ':::::-.'
Write-Host -ForegroundColor Red ' .:::' -NoNewline; Write-Host ' ` e e ` ' -NoNewline; Write-Host -ForegroundColor Red '`-::::.'
Write-Host -ForegroundColor Red ' :::: ' -NoNewline; Write-Host '( ^ )_' -NoNewline; Write-Host -ForegroundColor Red '.::::::'
Write-Host -ForegroundColor Red ' ::::' -NoNewline; Write-Host '.` `. o `' -NoNewline; Write-Host -ForegroundColor Red '.::::`' -NoNewline; Write-Host '.`/_'
Write-Host ' . ' -NoNewline; Write-Host -ForegroundColor Red ':::' -NoNewline; Write-Host '.` - ' -NoNewline; Write-Host -ForegroundColor Red '.::::`' -NoNewline; Write-Host '_ _.:'
Write-Host ' .-``---` .`| ' -NoNewline; Write-Host -ForegroundColor Red '.::::`' -NoNewline; Write-Host ' ```' -NoNewline; Write-Host -ForegroundColor Red '::::'
Write-Host ' `. ..-' -NoNewline; Write-Host -ForegroundColor Red ':::' -NoNewline; Write-Host '` | ' -NoNewline; Write-Host -ForegroundColor Red '.::::` ::::'
Write-Host ' `.` ' -NoNewline; Write-Host -ForegroundColor Red '::::' -NoNewline; Write-Host ' \ ' -NoNewline; Write-Host -ForegroundColor Red '.::::` ::::'
Write-Host -ForegroundColor Red ' :::: .::::` ::::'
Write-Host -ForegroundColor Red ' ::::.::::`' -NoNewline; Write-Host '._' -NoNewline; Write-Host -ForegroundColor Red ' ::::'
Write-Host -ForegroundColor Red ' ::::::`' -NoNewline; Write-Host ' / `- ' -NoNewline; Write-Host -ForegroundColor Red '.::::'
Write-Host -ForegroundColor Red ' `::::' -NoNewline; Write-Host '-/__ __.-' -NoNewline; Write-Host -ForegroundColor Red ':::``'
Write-Host -ForegroundColor Red ' `-:::::::::::::-``'
Write-Host -ForegroundColor Red ' ```::::``'
Write-Host '__________ ____ __. ___________ _____ __ '
Write-Host '\______ \| |/ _| \_ _____/ / \ _____/ |_ ___________ '
Write-Host ' | ___/| < | __)_ / \ / \_/ __ \ __\/ __ \_ __ \'
Write-Host ' | | | | \ | \ / Y \ ___/| | \ ___/| | \/'
Write-Host ' |____| /\ |____|__ \ /\ /_______ / \____|__ /\___ >__| \___ >__| '
Write-Host ' \/ \/ \/ \/ \/ \/ \/ '
Write-Host 'PKE Meter - Automated script to search "ghosts" and extract objects from Active Directory'
Write-Host ' Version 1.18'
Write-Host ' Release date : 2024/09/22'
Write-Host ' Charles BLANC ROLIN'
Write-Host ' https://github.com/woundride'
Write-Host ' https://www.apssis.com'
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ' Licence Crative Commons CC BY-NC-SA 4.0'
Write-Host ' https://creativecommons.org/licenses/by-nc-sa/4.0/'
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
Write-Host 'Select object type :'
Write-Host ''
Write-Host '1 - Computer'
Write-Host '2 - User'
Write-Host '3 - Group'
Write-Host '4 - Configuration'
Write-Host ''
Write-Host -ForegroundColor Yellow '5 - Quit'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
[string]$object_type = read-host 'Enter your selection'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
switch ($object_type) {
<#----------------------------------------------------------------------------------------------------
Computer Selection
----------------------------------------------------------------------------------------------------#>
1{
do {
[string]$os_version = 0
while ( $os_version -lt 1 -or $os_version -gt 20) {
Write-Host ' ___________'
Write-Host ' |.---------.|'
Write-Host ' || ||'
Write-Host ' || ||'
Write-Host ' || || _____ _ '
Write-Host ' | --------- | / ____| | | '
Write-Host ' )__ ____( | | ___ _ __ ___ _ __ _ _| |_ ___ _ __ ___ '
Write-Host ' [=== -- o ]--. | | / _ \| _ _ \| _ \| | | | __/ _ \ __/ __|'
Write-Host ' __|---------|__ \ | |___| (_) | | | | | | |_) | |_| | || __/ | \__ \'
Write-Host ' [::::::::::: :::] ) \_____\___/|_| |_| |_| .__/ \__,_|\__\___|_| |___/'
Write-Host ' /T\ | | '
Write-Host ' \_/ |_| '
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
Write-Host 'Choose option :'
Write-Host ''
Write-Host ''
Write-Host -ForegroundColor Red '1 - Windows 2000 + 2000 Server'
Write-Host -ForegroundColor Red '2 - Windows XP (+ Embedded)'
Write-Host -ForegroundColor Red '3 - Windows Vista'
Write-Host -ForegroundColor Red '4 - Windows 7 (+ Embedded)'
Write-Host -ForegroundColor Red '5 - Windows 8'
Write-Host -ForegroundColor Red '6 - Windows 8.1'
Write-Host -ForegroundColor Magenta '7 - Windows 10 / 11 --> New options menu'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
Write-Host -ForegroundColor Red '8 - Windows Server 2003'
Write-Host -ForegroundColor Red '9 - Windows Server 2008 + 2008 R2'
Write-Host -ForegroundColor Red '10 - Windows Server 2012 + 2012 R2'
Write-Host '11 - Windows Server 2016'
Write-Host '12 - Windows Server 2019'
Write-Host '13 - Windows Server 2022'
Write-Host ''
Write-Host -ForegroundColor Cyan '14 - All Systems in 1 file'
Write-Host -ForegroundColor Red '15 - Inactive Computer(s) (not been connected for more than 3 months)'
Write-Host -ForegroundColor Cyan '16 - Disabled Computer(s)'
Write-Host -ForegroundColor Red '17 - Duplicated computers accounts'
Write-Host -ForegroundColor Red '18 - All computers with unsupported OS'
Write-Host ''
Write-Host ''
Write-Host -ForegroundColor Cyan '19 - Computers Statistics'
Write-Host ''
Write-Host -ForegroundColor Yellow '20 - Return'
Write-Host
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
[string]$os_version = read-host 'Enter your selection'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
switch ($os_version) {
1{
Write-Host -ForegroundColor Red 'Windows 2000 + 2000 Server - End of life : 2010/07/13'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2000*' } -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_2000.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_2000.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
2{
Write-Host -ForegroundColor Red 'Windows XP - End of life : 2014/04/08'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*XP*' } -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_xp.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*Embedded*' -and OperatingSystemVersion -Like '*5.1*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_xp_embedded.csv
Write-Host 'Exported files :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_xp.csv'
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_xp_embedded.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
3{
Write-Host -ForegroundColor Red 'Windows Vista - End of life : 2017/04/11'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*vista*' } -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_vista.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_vista.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
4{
Write-Host -ForegroundColor Red 'Windows 7 - End of life : 2020/01/14'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*windows*7*' } -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_7.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*Embedded*' -and OperatingSystemVersion -Like '*6.1*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_7_embedded.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_7.csv'
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_7_embedded.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
5{
Write-Host -ForegroundColor Red 'Windows 8 - End of life : 2016/01/12'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*windows*8*' -and OperatingSystemVersion -Like '*6.2*' } -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_8.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_8.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
6{
Write-Host -ForegroundColor Red 'Windows 8.1 - End of life : 2023/01/10'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*windows*8*' -and OperatingSystemVersion -Like '*6.3*' } -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_8-1.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_8-1.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
7{
do {
[string]$10_version = 0
while ( $10_version -lt 1 -or $10_version -gt 33) {
Write-Host " ___"
Write-Host "'::|_|_|"
Write-Host "'.:|_|_| Choose Windows 10 / 11 version :"
Write-Host ''
Write-Host ''
Write-Host -ForegroundColor Red '1 - Windows 10 1507'
Write-Host '2 - Windows 10 1507 LTSC'
Write-Host -ForegroundColor Red '3 - Windows 10 1511'
Write-Host -ForegroundColor Red '4 - Windows 10 1607'
Write-Host '5 - Windows 10 1607 LTSC'
Write-Host -ForegroundColor Red '6 - Windows 10 1703'
Write-Host -ForegroundColor Red '7 - Windows 10 1709'
Write-Host -ForegroundColor Red '8 - Windows 10 1803'
Write-Host -ForegroundColor Red '9 - Windows 10 1803 Enterprise / Education'
Write-Host -ForegroundColor Red '10 - Windows 10 1809'
Write-Host -ForegroundColor Red '11 - Windows 10 1809 Enterprise / Education'
Write-Host -ForegroundColor Green '12 - Windows 10 1809 LTSC'
Write-Host -ForegroundColor Red '13 - Windows 10 1903 (19H1)'
Write-Host -ForegroundColor Red '14 - Windows 10 1909 (19H2)'
Write-Host -ForegroundColor Red '15 - Windows 10 1909 (19H2) Enterprise / Education'
Write-Host -ForegroundColor Red '16 - Windows 10 2004 (20H1)'
Write-Host -ForegroundColor Red '17 - Windows 10 20H2'
Write-Host -ForegroundColor Red '18 - Windows 10 20H2 Enterprise / Education'
Write-Host -ForegroundColor Red '19 - Windows 10 21H1'
Write-Host -ForegroundColor Red '20 - Windows 11 21H2'
Write-Host '21 - Windows 11 21H2 Enterprise / Education'
Write-Host -ForegroundColor Red '22 - Windows 10 21H2'
Write-Host -ForegroundColor Red '23 - Windows 10 21H2 Enterprise / Education'
Write-Host -ForegroundColor Green '24 - Windows 10 21H2 LTSC'
Write-Host '25 - Windows 11 22H2'
Write-Host '26 - Windows 11 22H2 Enterprise / Education'
Write-Host '27 - Windows 10 22H2'
Write-Host '28 - Windows 10 22H2 Enterprise / Education'
Write-Host '29 - Windows 11 23H2'
Write-Host '30 - Windows 11 23H2 Enterprise / Education'
Write-Host ''
Write-Host -ForegroundColor Cyan '31 - All Windows 10 versions in 1 file'
Write-Host -ForegroundColor Cyan '32 - All Windows 10 versions in separated files'
Write-Host ''
Write-Host -ForegroundColor Yellow '33 - Return'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
[string]$10_version = read-host 'Enter your selection'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
switch ($10_version) {
1{
Write-Host -ForegroundColor Red 'Windows 10 1507 - End of life : 2017/05/09'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*10240*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_1507.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_1507.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
2{
Write-Host -ForegroundColor Green 'Windows 10 1507 LTSC - End of life : 2025/10/14'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*LTSC*' -and OperatingSystemVersion -Like '*10240*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_10_1507_ltsc.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_10_1507_ltsc.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
3{
Write-Host -ForegroundColor Red 'Windows 10 1511 - End of life : 2017/10/10'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*10586*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_1511.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_1511.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
4{
Write-Host -ForegroundColor Red 'Windows 10 1607 - End of life : 2019/04/09'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*14393*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_1607.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_1607.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
5{
Write-Host -ForegroundColor Green 'Windows 10 1607 LTSC - End of life : 2026/10/13'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*LTSC*' -and OperatingSystemVersion -Like '*14393*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_10_1607_ltsc.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_10_1607_ltsc.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
6{
Write-Host -ForegroundColor Red 'Windows 10 1703 - End of life : 2019/10/08'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*15063*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_1703.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_1703.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
7{
Write-Host -ForegroundColor Red 'Windows 10 1709 - End of life : 2020/10/13'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*16299*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_1709.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_1709.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
8{
Write-Host -ForegroundColor Red 'Windows 10 1803 - End of life : 2019/11/12'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*17134*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_1803.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_1803.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
9{
Write-Host -ForegroundColor Red 'Windows 10 1803 Enterprise / Education - End of life : 2021/05/11'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*17134*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_1803_e.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_1803_e.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
10{
Write-Host -ForegroundColor Red 'Windows 10 1809 - End of life : 2020/11/10'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*17763*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_1809.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_1809.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
11{
Write-Host -ForegroundColor Red 'Windows 10 1809 Enterprise / Education - End of life : 2021/05/11'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*17763*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_1809_e.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_1809_e.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
12{
Write-Host -ForegroundColor Green 'Windows 10 1809 LTSC - End of life : 2029/01/09'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*LTSC*' -and OperatingSystemVersion -Like '*17763*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_10_1809_ltsc.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_10_1809_ltsc.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
13{
Write-Host -ForegroundColor Red 'Windows 10 1903 (19H1) - End of life : 2020/12/08'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*18362*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_1903.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_1903.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
14{
Write-Host -ForegroundColor Red 'Windows 10 1909 (19H2) - End of life : 2021/05/11'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*18363*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_1909.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_1909.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
15{
Write-Host -ForegroundColor Red 'Windows 10 1909 (19H2) Enterprise / Education - End of life : 2022/05/10'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*18363*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_1909_e.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_1909_e.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
16{
Write-Host -ForegroundColor Red 'Windows 10 2004 (20H1) - End of life : 2021/12/14'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*19041*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_2004.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_2004.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
17{
Write-Host -ForegroundColor Red 'Windows 10 20H2 - End of life : 2022/05/10'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*19042*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_20H2.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_20H2.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
18{
Write-Host -ForegroundColor Red 'Windows 10 20H2 Enterprise / Education - End of life : 2023/05/09'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*19042*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_20H2_e.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_20H2_e.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
19{
Write-Host -ForegroundColor Red 'Windows 10 21H1 - End of life : 2022/12/13'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*19043*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_21H1.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_21H1.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
20{
Write-Host -ForegroundColor Red 'Windows 11 21H2 - End of life : 2023/10/10'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*22000*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_11_21H2.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_11_21H2.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
21{
Write-Host -ForegroundColor Green 'Windows 11 21H2 Enterprise / Education - End of life : 2024/10/08'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*22000*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_11_21H2_e.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_11_21H2_e.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
22{
Write-Host -ForegroundColor Red 'Windows 10 21H2 - End of life : 2023/06/13'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*19044*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_21H2.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_21H2.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
23{
Write-Host -ForegroundColor Red 'Windows 10 21H2 Enterprise / Education - End of life : 2024/06/11'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*19044*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_10_21H2_e.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_10_21H2_e.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
24{
Write-Host -ForegroundColor Green 'Windows 10 21H2 LTSC - End of life : 2027/01/12'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*LTSC*' -and OperatingSystemVersion -Like '*19044*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_10_21H2_ltsc.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_10_21H2_ltsc.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
25{
Write-Host -ForegroundColor Green 'Windows 11 22H2 - End of life : 2024/10/08'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystemVersion -Like '*22621*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_11_22H2.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_11_22H2.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
26{
Write-Host -ForegroundColor Green 'Windows 11 22H2 Enterprise / Education - End of life : 2025/10/14'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*22621*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_11_22H2_e.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_11_22H2_e.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
27{
Write-Host -ForegroundColor Green 'Windows 10 22H2 - End of life : 2024/05/14'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*19045*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_10_22H2.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_10_22H2.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
28{
Write-Host -ForegroundColor Green 'Windows 10 22H2 Enterprise / Education - End of life : 2025/05/13'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*19045*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_10_22H2_e.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_10_22H2_e.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
29{
Write-Host -ForegroundColor Green 'Windows 11 23H2 - End of life : 2025/11/11'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystemVersion -Like '*22631*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_11_23H2.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_11_23H2.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
30{
Write-Host -ForegroundColor Green 'Windows 11 23H2 Enterprise / Education - End of life : 2026/11/10'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*22631*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_11_23H2_e.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_11_23H2_e.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
31{
Write-Host -ForegroundColor Cyan 'All Windows 10 versions in 1 file'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_10.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_10.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
32{
Write-Host -ForegroundColor Cyan 'All Windows 10 versions in separated files'
Write-Host ''
Mkdir C:\Users\$user\Desktop\Windows_10
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*10240*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_1507.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*LTSC*' -and OperatingSystemVersion -Like '*10240*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\os_windows_10_1507_ltsc.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*10586*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_1511.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*14393*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_1607.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*LTSC*' -and OperatingSystemVersion -Like '*14393*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\os_windows_10_1607_ltsc.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*15063*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_1703.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*16299*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_1709.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*17134*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_1803.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*17134*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_1803_e.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*17763*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_1809.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*17763*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_1809_e.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*LTSC*' -and OperatingSystemVersion -Like '*17763*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\os_windows_10_1809_ltsc.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*18362*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_1903.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*18363*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_1909.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*18363*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_1909_e.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*19041*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_2004.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*19042*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_20H2.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*19042*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_20H2_e.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*19043*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_21H1.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*19044*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_21H2.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*19044*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\unsupported_os_windows_10_21H2_e.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*LTSC*' -and OperatingSystemVersion -Like '*19044*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\os_windows_10_21H2_ltsc.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*19045*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\os_windows_10_22H2.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*19045*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Windows_10\os_windows_10_22H2_e.csv
Write-Host ''
Write-Host 'All files are exported in :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\Windows_10'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
}
}
} while ( $10_version -ne 33 ) }
8{
Write-Host -ForegroundColor Red 'Windows Server 2003 - End of life : 2016/10/09'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2003*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_server_2003.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_server_2003.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
9{
Write-Host -ForegroundColor Red 'Windows Server 2008 + 2008 R2 - End of life : 2020/01/14'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2008*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_server_2008.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_server_2008.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
10{
Write-Host -ForegroundColor Red 'Windows Server 2012 + 2012 R2 - End of life : 2023/10/10'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2012*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\unsupported_os_windows_server_2012.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\unsupported_os_windows_server_2012.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
11{
Write-Host -ForegroundColor Green 'Windows Server 2016 - End of life : 2027/01/12'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2016*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_server_2016.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_server_2016.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
12{
Write-Host -ForegroundColor Green 'Windows Server 2019 - End of life : 2029/01/09'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2019*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_server_2019.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_server_2019.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
13{
Write-Host -ForegroundColor Green 'Windows Server 2022 - End of life : 2031/10/14'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2022*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\os_windows_server_2022.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\os_windows_server_2022.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
14{
Write-Host -ForegroundColor Cyan 'All Systems in 1 file (enabled)'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'true'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\all_computers.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\all_computers.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
15{
Write-Host -ForegroundColor Cyan 'All computers who have not been connected for more than 3 months'
Search-ADAccount -ComputersOnly -AccountInActive -TimeSpan 90:00:00:00 -ResultPageSize 2000 -ResultSetSize $null | ?{$_.Enabled -eq $True} | Select-Object Name, SamAccountName, LastLogonDate, DistinguishedName | Export-CSV -Encoding UTF8 c:\Users\$user\Desktop\inactive_computers.csv -NoTypeInformation
Write-Host ''
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\inactive_computers.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
if (( Read-Host 'Do you want to disable inactive accounts ? - Administrator rights needed - Answer "sure" to validate' ) -eq 'sure' ){
Search-ADAccount -ComputersOnly -AccountInActive -TimeSpan 90:00:00:00 -ResultPageSize 2000 -ResultSetSize $null | ?{$_.Enabled -eq $True} | Select-Object SamAccountName | Export-CSV -Encoding UTF8 c:\Users\$user\Desktop\inactive_computers_to_disable.csv -NoTypeInformation
$file_comput_dis=import-csv C:\Users\$user\Desktop\inactive_computers_to_disable.csv
foreach ($entry in $file_comput_dis)
{
Set-ADComputer -Identity $($entry.SamAccountName) -Enabled $false
}
}
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
16{
Write-Host -ForegroundColor Cyan 'All disabled computers'
Write-Host ''
Get-ADComputer -Filter {enabled -eq 'false'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\all_disabled_computers.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\all_disabled_computers.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
17{
Write-Host -ForegroundColor Red 'Duplicated computers accounts'
Write-Host ''
Get-adobject -ldapfilter '(cn=*cnf:*)' ; Get-adobject -ldapfilter '(sAMAccountName=$duplicate)' | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\duplicated_computers_accounts.csv
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\duplicated_computers_accounts.csv'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
18{
Write-Host -ForegroundColor Red 'All computers with unsupported OS in separated files'
Write-Host ''
Mkdir C:\Users\$user\Desktop\Unsupported_OS
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2000*' } -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_2000.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*XP*' } -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_xp.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*Embedded*' -and OperatingSystemVersion -Like '*5.1*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_xp_embedded.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*vista*' } -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_vista.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*windows*7*' } -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_7.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*Embedded*' -and OperatingSystemVersion -Like '*6.1*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_7_embedded.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*windows*8*' -and OperatingSystemVersion -Like '*6.2*' } -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_8.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*windows*8*' -and OperatingSystemVersion -Like '*6.3*' } -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_8-1.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*10240*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_1507.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*10586*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_1511.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*14393*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_1607.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*15063*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_1703.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*16299*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_1709.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*17134*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_1803.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*17134*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_1803_e.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*17763*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_1809.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*17763*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_1809_e.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*18362*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_1903.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*18363*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_1909.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*18363*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_1909_e.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*19041*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_2004.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*19042*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_20H2.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*19042*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_20H2_e.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*19043*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_10_21H1.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2003*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_server_2003.csv
Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2008*'} -Properties SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Select SamAccountName, LastLogonDate, OperatingSystem, OperatingSystemVersion, CanonicalName | Export-CSV -Encoding UTF8 C:\Users\$user\Desktop\Unsupported_OS\unsupported_os_windows_server_2008.csv
Write-Host ''
Write-Host 'All files are exported in :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\Unsupported_OS'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
19{
Write-Host -ForegroundColor Cyan 'Computers Statistics (Number of computers by OS)'
$all_computers = Get-ADComputer -Filter {enabled -eq 'true'}
$innactive_computers = Search-ADAccount -ComputersOnly -AccountInActive -TimeSpan 90:00:00:00 -ResultPageSize 2000 -ResultSetSize $null | ?{$_.Enabled -eq $True}
$disabled_computers = Get-ADComputer -Filter {enabled -eq 'false'}
$windows2000 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2000*' }
$windowsxp = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*XP*' }
$windowsxpembedded = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*Embedded*' -and OperatingSystemVersion -Like '*5.1*'}
$windowsvista = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*vista*' }
$windows7 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*windows*7*' }
$windows7embedded = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*Embedded*' -and OperatingSystemVersion -Like '*6.1*'}
$windows8 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*windows*8*' -and OperatingSystemVersion -Like '*6.2*' }
$windows8_1 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*windows*8*' -and OperatingSystemVersion -Like '*6.3*' }
$windows10_1507 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*10240*'}
$windows10_1507_ltsc = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*LTSC*' -and OperatingSystemVersion -Like '*10240*'}
$windows10_1511 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*10586*'}
$windows10_1607 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*14393*'}
$windows10_1607_ltsc = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*LTSC*' -and OperatingSystemVersion -Like '*14393*'}
$windows10_1703 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*15063*'}
$windows10_1709 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*16299*'}
$windows10_1803 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*17134*'}
$windows10_1803e = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*17134*'}
$windows10_1809 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*17763*'}
$windows10_1809e = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*17763*'}
$windows10_1809_ltsc = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*LTSC*' -and OperatingSystemVersion -Like '*17763*'}
$windows10_1903 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*18362*'}
$windows10_1909 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*18363*'}
$windows10_1909_e = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*18363*'}
$windows10_2004 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*19041*'}
$windows10_20h2 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*19042*'}
$windows10_20h2_e = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*19042*'}
$windows10_21h1 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystemVersion -Like '*19043*'}
$windows10_21h2 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -Like '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*19044*'}
$windows10_21h2_e = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystem -NotLike '*LTSC*' -and OperatingSystemVersion -Like '*19044*'}
$windows10_21h2_ltsc = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*10*LTSC*' -and OperatingSystemVersion -Like '*19044*'}
$windows11_21h2 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*22000*'}
$windows11_21h2_e = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*22000*'}
$windows11_22h2 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*22621*'}
$windows11_22h2_e = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*22621*'}
$windows10_22h2 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*19045*'}
$windows10_22h2_e = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*19045*'}
$windows11_23h2 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystem -Like '*pro*' -and OperatingSystemVersion -Like '*22631*'}
$windows11_23h2_e = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*11*' -and OperatingSystem -NotLike '*pro*' -and OperatingSystemVersion -Like '*22631*'}
$windows2003 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2003*'}
$windows2008 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2008*'}
$windows2012 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2012*'}
$windows2016 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2016*'}
$windows2019 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2019*'}
$windows2022 = Get-ADComputer -Filter {enabled -eq 'true' -and OperatingSystem -Like '*2022*'}
Write-Output '-----------------------------------------------------------------------------------------' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt
Write-Output 'Computers Statistics' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '-----------------------------------------------------------------------------------------' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Number of computers :' $all_computers.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'All computers who have not been connected for more than 3 months :' $innactive_computers.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'All disabled computers :' $disabled_computers.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '-----------------------------------------------------------------------------------------' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Client OS' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '-----------------------------------------------------------------------------------------' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 2000 + 2000 Server - End of life : 2010/07/13 :' $windows2000.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows XP - End of life : 2014/04/08 :' $windowsxp.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows XP Embedded - End of life : 2014/04/08 :' $windowsxpembedded.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows Vista - End of life : 2017/04/11 :' $windowsvista.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 7 - End of life : 2020/01/14 :' $windows7.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 7 Embedded - End of life : 2020/01/14 :' $windows7embedded.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 8 - End of life : 2016/01/12 :' $windows8.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 8.1 - End of life : 2023/01/10 :' $windows8_1.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 1507 - End of life : 2017/05/09 :' $windows10_1507.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows 10 1507 LTSC - End of life : 2025/10/14 :' $windows10_1507_ltsc.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 1511 - End of life : 2017/10/10 :' $windows10_1511.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 1607 - End of life : 2019/04/09 :' $windows10_1607.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows 10 1607 LTSC - End of life : 2026/10/13 :' $windows10_1607_ltsc.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 1703 - End of life : 2019/10/08 :' $windows10_1703.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 1709 - End of life : 2020/10/13 :' $windows10_1709.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 1803 - End of life : 2019/11/12 :' $windows10_1803.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 1803 Enterprise / Education - End of life : 2021/05/11 :' $windows10_1809e.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 1809 - End of life : 2020/11/10 :' $windows10_1809.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 1809 Enterprise / Education - End of life : 2021/05/11 :' $windows10_1809e.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows 10 1809 LTSC - End of life : 2029/01/09 :' $windows10_1809_ltsc.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 1903 (19H1) - End of life : 2020/12/08 :' $windows10_1903.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 1909 (19H2) - End of life : 2021/05/11 :' $windows10_1909.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported Windows : 10 1909 (19H2) Enterprise / Education - End of life : 2022/05/10 :' $windows10_1909_e.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 2004 (20H1) - End of life : 2021/12/14 :' $windows10_2004.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 20H2 - End of life : 2022/05/10 :' $windows10_20h2.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 20H2 Enterprise / Education - End of life : 2023/05/09 :' $windows10_20h2_e.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 21H1 - End of life : 2022/12/13 :' $windows10_21h1.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 11 21H2 - End of life : 2023/10/10 :' $windows11_21h2.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows 11 21H2 Enterprise / Education - End of life : 2024/10/08 :' $windows11_21h2_e.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 21H2 - End of life : 2023/06/13 :' $windows10_21h2.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows 10 21H2 Enterprise / Education - End of life : 2024/06/11 :' $windows10_21h2_e.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows 10 21H2 LTSC - End of life : 2027/01/12 :' $windows10_21h2_ltsc.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows 11 22H2 - End of life : 2024/10/08 :' $windows11_22h2.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows 11 22H2 Enterprise / Education - End of life : 2025/10/14 :' $windows11_22h2_e.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows 10 22H2 - End of life : 2024/05/14 :' $windows10_22h2.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows 10 22H2 Enterprise / Education - End of life : 2025/05/13 :' $windows10_22h2_e.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows 11 23H2 - End of life : 2025/11/11 :' $windows11_23h2.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows 11 23H2 Enterprise / Education - End of life : 2026/11/10 :' $windows11_23h2_e.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '-----------------------------------------------------------------------------------------' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Server OS' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '-----------------------------------------------------------------------------------------' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows Server 2003 - End of life : 2016/10/09 :' $windows2003.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows Server 2008 + 2008 R2 - End of life : 2020/01/14 :' $windows2008.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Unsupported OS : Windows Server 2012 + 2012 R2 - End of life : 2023/10/10 :' $windows2012.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows Server 2016 - End of life : 2027/01/12 :' $windows2016.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows Server 2019 - End of life : 2029/01/09 :' $windows2019.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output '' | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Output 'Windows Server 2022 - End of life : 2031/10/14 :' $windows2022.count | Out-File -FilePath c:\Users\$user\Desktop\computers_statistics.txt -Append
Write-Host ''
Write-Host 'Exported file :'
Write-Host ''
Write-Host 'C:\Users\'$user'\Desktop\computers_statistics.txt'
Write-Host ''
Write-Host '-----------------------------------------------------------------------------------------'
Write-Host ''
}
}
}
} while ( $os_version -ne 20 ) }
<#----------------------------------------------------------------------------------------------------
User Selection
----------------------------------------------------------------------------------------------------#>
2{
do {
[string]$user_extract = 0
while ( $user_extract -lt 1 -or $user_extract -gt 23) {
Write-Host ' ////^\\\\'
Write-Host ' | ^ ^ |'
Write-Host ' @ (o) (o) @'
Write-Host ' | < |'
Write-Host ' | ___ |'
Write-Host ' \_____/'
Write-Host ' ____| |____'
Write-Host ' / \__/ \'
Write-Host ' / \ _ _ '
Write-Host ' /\_/| |\_/\ | | | | '
Write-Host ' / / | | \ \ | | | |___ ___ _ __ ___ '
Write-Host '( < | | > ) | | | / __|/ _ \ __/ __|'
Write-Host ' \ \ | | / / | |__| \__ \ __/ | \__ \'
Write-Host ' \ \ |________| / / \____/|___/\___|_| |___/'