forked from andreipintica/TSSV2
-
Notifications
You must be signed in to change notification settings - Fork 0
/
TSSv2_DND.psm1
6205 lines (5440 loc) · 300 KB
/
TSSv2_DND.psm1
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
<#
.SYNOPSIS
DND module for collecting ETW traces and various custom tracing functionality
.DESCRIPTION
Define ETW traces for Windows DND components
Add any custom tracing functinaliy for tracing DND components
For Developers:
1. Switch test: .\TSSv2.ps1 -Start -DND_TEST1
2. Scenario test: .\TSSv2.ps1 -start -Scenario DND_MyScenarioTest
.NOTES
Dev. Lead: sabieler
Authors : sabieler; cleng; mamakigu
Requires : PowerShell V4 (Supported from Windows 8.1/Windows Server 2012 R2)
Version : see $global:TssVerDateDND
.LINK
TSSv2 https://internal.support.services.microsoft.com/en-us/help/4619187
DND https://internal.support.services.microsoft.com/en-us/help/4643331
#>
<# latest changes
2023.05.23.0 [sb] _DND: DND_SETUPReport, added logic to check drivers in SYSTEM\DriverDatabase against DriverStore\FileRepository.
2023.05.18.0 [mm] _DND: DND_Setup, fix an issue that exception (0x80070020) may occur while calling FwGetMsInfo32 function.
2023.05.11.0 [sb] _DND: improved Get-DNDDeploymentLogs to collect MDT logs if they haven't been moved to 'C:\Windows\Temp\DeploymentLogs'
2023.05.09.0 [mm] _DND: replaced "DND_Setup" code with "DND_SetupEx" code and remove "DND_SetupEx" function to avoid confusion, commented "DND_SETUPDiag" out since it is no longer in use
2023.05.06.0 [mm] _DND: added a collection function "DND_SetupEx" which will replace the previously released collection function "DND_Setup".
2023.05.05.0 [sb] _DND: Feature 404: collect USB\AutomaticSurpriseRemoval\AttemptRecoveryFromUsbPowerDrain
2023.05.02.1 [sb] _DND: Feature 404: _DND: Decode MBAM event log on customer machines (which has MBAM server installed)
2023.05.02.0 [sb] _DND: Feature 404: _DND: Decode MBAM event log on customer machines (which has MBAM agent installed)
2023.04.21.1 [sb] _DND: improving Get-DNDWindowsUpdateInfo
2023.04.21.0 [sb] _DND: using framework function 'FwExportFileVerToCsv' to collect UUS file versions
2023.04.21.0 [sb] _DND: adding powercfg commands (DEVICEQUERY, LASTWAKE, REQUESTS)
2023.04.19.3 [sb] _DND: fixed an issue with data type conversion (int/string) and OS detection, improved WU log collection from Windows.old
2023.04.19.2 [sb] _DND: enhanced readability, set back FlushLogs default to 0
2023.04.19.0 [sb] _DND: collecting UUS file versions
2023.04.18.0 [sb] _DND: replaced logic to evaluate variables retrieved from tss_config.cfg, re-formatted misc file, corrected indenting, replaced double-quotes by single-quotes where possible
2023.04.17.0 [sb] _DND: code optimizations
2023.04.12.0 [sb] _DND: moved OS detection logic out of functions
2023.04.11.0 [sb] _DND: added Windows.old evtx logs
2023.04.07.0 [we] _DND: add CollectDND_PnPLog (consolidate NET_PnP)
2023.03.31.0 [sb] _DND: improved ReservedStorageState output
2023.03.29.0 [sb] _DND: fixed typo in DND_WULogs
2023.03.27.1 [sb] _DND: replacing redirect with Out-File
2023.03.27.0 [sb] _DND: building dynamic disk part script and execute it
2023.03.22.4 [sb] _DND: adding mandatory parameter to LogException calls
2023.03.22.3 [sb] _DND: displaying hint when downloading symbols
2023.03.22.2 [sb] _DND: satisfy CTAC query requirements (AnalyticsInfo.GetSystemPropertiesAsync was introduced in 10.0.17134.0)
2023.03.22.1 [sb] _DND: improved symbol server detection
2023.03.22.0 [sb] _DND: if folder Windows.~WS is present, collect panther logs
2023.03.21.0 [sb] _DND: extended proxy output and cleaned up for readability
2023.03.20.0 [sb] _DND: added method to retrieve CTAC attributes
2023.03.14.0 [sb] _DND: increased sleepstudy days to maximum of 28 days
2023.03.13.0 [sb] _DND: replaced "timeout" with "Start-Sleep"
2023.03.09.0 [sb] _DND: added collection of Get-DeliveryOptimizationPerfSnapThisMonth
2023.03.06.0 [sb] _DND: renamed files Hotfixes.csv Hotfix-WindowsUpdateDatabase.txt to WindowsUpdate_Hotfixes.csv WindowsUpdate-Database.txt
2023.01.30.0 [sb] _DND: added waketimers output to Get-DNDEnergyInfo
2023.01.25.0 [sb] _DND: added Windows Update per user reg key collection
2023.01.20.0 [sb] _DND: added delivery optimization cmdLets
2023.01.16.0 [sb] _DND: add -Scenario DND_AudioETW which collects audio ETW traces
2023.01.12.0 [sb] _DND: Get-DNDPBRLogs: added AppxLogs
2023.01.11.0 [sb] _DND: add -Scenario DND_AudioWPR which collects audio traces the old fashioned way, https://matthewvaneerde.wordpress.com/2017/01/09/collecting-audio-logs-the-old-fashioned-way/
2023.01.10.0 [sb] Get-DNDPBRLogs: fixed escape issue and replaced xcopy with robocopy
2022.12.07.0 [we] _DND: add -Scenario DND_General
2022.12.06.1 [sb] #_# DND_SETUPReport, added InstallService\State
2022.12.06.0 [sb] #_# DND_WULogs, added symbol server check for winver 1607
2022.12.06.0 [sb] #_# DND_SETUPReport, added ReservedStorageState output, modified Windows detection logic
2022.11.29.0 [sb] #_# DND_SETUPReport, improved mounting of system partition
2022.11.28.0 [sb] #_# DND_SETUPReport, added function to collect Device Guard specific information
2022.11.22.1 [sb] #_# DND_SETUPReport, added Windows 11 detection logic
2022.11.22.0 [sb] #_# DND_SETUPReport, added CHID export from registry
2022.10.14.1 [sb] #_# DND_SETUP, fixed path error for systeminfo output
2022.10.14.0 [sb] #_# Get-DNDEventLogs, re-adding "Microsoft-Windows-Store/Operational","Microsoft-Client-Licensing-Platform/Admin" to TXT export
2022.10.11.0 [il] #_# Get-DNDWindowsUpdateInfo, Remove RedirectUrls:System.__ComObject from output of WindowsUpdateConfiguration.txt
2022.10.10.0 [sb] #_# wrapped "standalone" Get-CimInstance in try / catch block, fixed minor bugs
2022.10.07.0 [il] #_# Get-DNDWindowsUpdateInfo, translate UpdateID,Category fields and remove Uninstallation fields
2022.10.04.0 [sb] #_# DND_WULogs, added computer name to file names
2022.09.23.0 [we] #_# add DND_WU as provider tracing in FW
2022.09.15.0 [we] #_# DND_SETUPReport, added results.xml to make RFLckeck happy
2022.08.01.0 [we] _NET: add var $PublicSymSrv to make PSScriptAnalyzer happy
2022.07.25.1 [sb] #_# added new function to retrieve AppLocker policy
2022.07.25.0 [sb] #_# added info from storage cmdLets
2022.07.11.0 [sb] #_# enabled _NETBASIC
2022.07.04.0 [sb] #_# Get-DNDSetupLogs, moving back to robocopy to leverage filters
2022.07.01.0 [sb] #_# FwCopyFiles, changed wildcard usage from "*.*"" to "*"
2022.06.29.0 [sb] #_# Get-DNDWindowsUpdateInfo, fixed typo
2022.06.28.1 [sb] #_# CollectDND_WULogsLog, fixed typo
2022.06.28.0 [sb] #_# Get-DNDMiscInfo, reg_Drivers.hiv no longer overwrites reg_Components.hiv
2022.06.21.1 [sb] #_# Get-DNDEventLogs, exclude archived event logs, Get-DNDWindowsUpdateInfo added 1607 detection logic
2022.06.21.0 [sb] #_# Get-DNDCbsPnpInfo, re-added files
2022.06.20.0 [sb] #_# [Get-DNDDeploymentLogs] fixed output filename
2022.06.17.0 [sb] #_# [Get-DNDEnergyInfo] change output for system power report to Powercfg-systempowerreport.html
2022.06.06.0 [we] #_# [DND_WUlogs] fix msinfo/systeminfo
2022.06.03.0 [we] #_# fix While loop in [Get-DNDMiscInfo], use FW function FwGet-SummaryVbsLog
2022.05.31.0 [we] #_# replaced LogMessage .. with LogInfo/LogDebug; replaced some code with FW functions i.e. using FwExportFileVerToCsv
FYI: RunCommands will mirror each commandline in output file, if last item separated by space ' ' is a output file-name; FW functions have better error handling
2022.05.25.0 [sb] #_# DND_SETUPReport, enhanced configuration granularity through tss_config.cfg
2022.05.24.3 [sb] #_# DND_SETUPReport, replaced [System.ServiceProcess.ServiceControllerStatus] with [System.ServiceProcess.ServiceStartMode]
2022.05.24.2 [sb] #_# DND_SETUPReport, added try block to Get-DNDWindowsUpdateInfo
2022.05.24.1 [sb] #_# DND_SETUPReport, added abnormal sleepstudy ETLs
2022.05.24.0 [sb] #_# DND_SETUPReport, minor changes in Get-DNDNetworkBasic
2022.04.13.0 [cl] #_# DND_SETUPLog and DND_WULogs replaced WMIC with Get-CimInstance
2022.03.14.0 [sb] #_# DND_SETUPReport, adding extra logging to Get-DNDEventLogs
2022.02.21.0 [sb] #_# DND_SETUPReport, adding pattern to servicing state query
2022.02.16.0 [sb] #_# DND_SETUPReport, removed function placeholder
2022.02.15.0 [sb] #_# DND_SETUPReport, added servicing scenario "-Scenario DND_ServicingProcmon"
2022.02.09.1 [sb] #_# DND_SETUPReport, added function Get-DNDRFLCheckPrereqs
2022.02.09.0 [sb] #_# DND_SETUPReport, fixed bug in Get-DNDWindowsUpdateInfo
2022.02.06.0 [we] #_# added description for DND_SETUPReport in framework
2022.02.03.1 [sb] #_# DND_SETUPReport, split network functions into Get-DNDNetworkBasic and Get-DNDNetworkSetup
2022.02.03.0 [sb] #_# DND_SETUPReport, check if wuauserv is disabled before querying it to prevent runtime exception
2022.02.02.0 [sb] #_# DND_SETUPReport, removed duplicate collection of reg_SoftwareProctectionPlatform.txt, fixed typo and moved collection from Get-DNDMiscInfo into Get-DNDActivationState
2022.02.01.0 [sb] #_# DND_SETUPReport, added parameters to tss_config.cfg and use them to be more flexible
2022.01.26.1 [sb] #_# DND_SETUPReport, disabled progress display from Test-NetConnection
2022.01.26.0 [sb] #_# DND_SETUPReport, added hours to runtime calculation
2022.01.20.0 [sb] #_# DND_SETUPReport, added connection test to public symbol server msdl.microsoft.com to prevent long running Get-WindowsUpdateLog cmdLet
2022.01.07.2 [sb] #_# DND_SETUPReport, removed xray overwrite to have telemetry working
2022.01.07.1 [sb] #_# DND_WULogs, added noBasicLog to global parameter array to skip basic log collection, ($global:ParameterArray += 'noBasicLog')
2022.01.07.0 [sb] #_# DND_SETUPReport, added noBasicLog to global parameter array to skip basic log collection, ($global:ParameterArray += 'noBasicLog')
2022.01.05.0 [sb] #_# typo in "Token Activation" section and output certutil info into new text file.
2022.01.04.0 [sb] #_# added storage cmdLets for Windows 8 and higher
2022.01.02.0 [we] #_# _NET: moved NET_ '_WinUpd' to _DND, https://microsoft.ghe.com/css-windows/WindowsCSSToolsDevRep/pull/394
2021.12.23.0 [sb] #_# split up DND_SETUPReport collection into functions in preparation of different log collection purposes or scenarios
2021.12.20.0 [sb] #_# surface log collection: removed unneeded closing brace, escaped pipeline variable
2021.12.02.1 [sb] #_# migrating common CMD commands to use TSSv2 framework functions (section: activation, directory listing, surface, slow processing)
2021.12.02.0 [sb] #_# added cidiag to scenario "-DND_CodeIntegrity", example: .\TSSv2.ps1 -Start -DND_CodeIntegrity -noBasicLog -noUpdate
2021.11.30.0 [sb] #_# migrating common CMD commands to use TSSv2 framework functions (section: network)
2021.11.27.0 [cl] #_# added variuos taracing GUIDs
2021.11.10.0 [we] #_# replaced all 'Get-WmiObject' with 'Get-CimInstance' to be compatible with PowerShell v7
2021.03.23.0 [cl] #_# initial version of TSSv2 DND module
#>
$global:TssVerDateDND = '2023.05.23.0'
# ----- Setup initial stuff
$PublicSymSrv = 'msdl.microsoft.com'
# OS Version checks
$_osVersion = [environment]::OSVersion.Version
$_major = $_osVersion.Major
$_minor = $_osVersion.Minor
$_build = $_osVersion.Build
# Check for Windows 8 or later
$_WIN8_OR_LATER = (([int]$_osVersion.Major -eq 6) -and ([int]$_osVersion.Minor -ge 2)) -or ([int]$_osVersion.Major -ge 6)
$_WINBLUE_OR_LATER = ([int]$_osVersion.Major -ge 6)
# Check for Windows 10 or later
$_WIN10 = [int]($_osVersion.Major -eq 10)
$_WIN10_OR_LATER = ($_WIN10) -or ([int]$_osVersion.Major -gt 10)
# Check for Windows 10 versions and later
$_WIN10_1607 = ($_WIN10) -and ([int]$_osVersion.Build -eq 14393)
$_WIN10_1607_OR_LATER = ($_WIN10_1607) -or ([int]$_osVersion.Build -gt 14393)
$_WIN10_1809_OR_LATER = ($_WIN10_1607_OR_LATER) -and ([int]$_osVersion.Build -ge 17763)
$_WIN10_1909_OR_LATER = ($_WIN10_1809_OR_LATER) -and ([int]$_osVersion.Build -ge 18363)
$_WIN10_2004_OR_LATER = ($_WIN10_1909_OR_LATER) -and ([int]$_osVersion.Build -ge 19041)
# Check for Windows 11 versions and later
$_WIN11_OR_LATER = ($_WIN10_2004_OR_LATER) -and ([int]$_osVersion.Build -ge 22000)
$_WIN11_21H1 = ($_WIN11_OR_LATER) -and ([int]$_osVersion.Build -eq 22000)
$_WIN11_22H2 = ($_WIN11_OR_LATER) -and ([int]$_osVersion.Build -eq 22621)
$_PS4ormore = 0
#$_PS5=0
# Get Powershell version
$_PS4ormore = [int]($PSVersionTable.PSVersion.Major -ge 4)
#$_PS5 = [int]($PSVersionTable.PSVersion.Major -eq 5)
#region --- ETW component trace Providers ---
$DND_AudioETWProviders = @(
'{F3F14FF3-7B80-4868-91D0-D77E497B025E}' # Microsoft-Windows-WMP
'{AE4BD3BE-F36F-45B6-8D21-BDD6FB832853}' # Microsoft-Windows-Audio
'{7C314E58-8246-47D1-8F7A-4049DC543E0B}' # Microsoft-Windows-WMPNSSUI
'{614696C9-85AF-4E64-B389-D2C0DB4FF87B}' # Microsoft-Windows-WMPNSS-PublicAPI
'{BE3A31EA-AA6C-4196-9DCC-9CA13A49E09F}' # Microsoft-Windows-Photo-Image-Codec
'{02012A8A-ADF5-4FAB-92CB-CCB7BB3E689A}' # Microsoft-Windows-ShareMedia-ControlPanel
'{B20E65AC-C905-4014-8F78-1B6A508142EB}' # Microsoft-Windows-MediaFoundation-Performance-Core
'{3F7B2F99-B863-4045-AD05-F6AFB62E7AF1}' # Microsoft-Windows-TerminalServices-MediaRedirection
'{42D580DA-4673-5AA7-6246-88FDCAF5FFBB}' # Microsoft.Windows.CastQuality
'{1F930302-F484-4E01-A8A7-264354C4B8E3}' # Microsoft.Windows.Cast.MiracastLogging
'{596426A4-3A6D-526C-5C63-7CA60DB99F8F}' # Microsoft.Windows.WindowsMediaPlayer
'{E27950EB-1768-451F-96AC-CC4E14F6D3D0}' # AudioTrace
'{A9C1A3B7-54F3-4724-ADCE-58BC03E3BC78}' # Windows Media Player Trace
'{E2821408-C59D-418F-AD3F-AA4E792AEB79}' # SqmClientTracingGuid
'{6E7B1892-5288-5FE5-8F34-E3B0DC671FD2}' # Microsoft.Windows.Audio.Client
'{AAC97853-E7FC-4B93-860A-914ED2DEEE5A}' # MediaServer
'{E1CCD9F8-6E9F-43ad-9A32-8DBEBE72A489}' # WMPDMCCoreGuid
'{d3045008-e530-485e-81b7-c6d54dbd9044}' # CTRLGUID_EVR_WPP
'{00000000-0dc9-401d-b9b8-05e4eca4977e}' # CTRLGUID_MF_PLATFORM
'{00000001-0dc9-401d-b9b8-05e4eca4977e}' # CTRLGUID_MF_PIPELINE
'{00000002-0dc9-401d-b9b8-05e4eca4977e}' # CTRLGUID_MF_CORE_SINKS
'{00000003-0dc9-401d-b9b8-05e4eca4977e}' # CTRLGUID_MF_CORE_SOURCES
'{00000004-0dc9-401d-b9b8-05e4eca4977e}' # CTRLGUID_MF_NETWORK
'{00000005-0dc9-401d-b9b8-05e4eca4977e}' # CTRLGUID_MF_CORE_MFTS
'{00000006-0dc9-401d-b9b8-05e4eca4977e}' # CTRLGUID_MF_PLAY
'{00000007-0dc9-401d-b9b8-05e4eca4977e}' # CTRLGUID_MF_CAPTURE_ENGINE
'{00000008-0dc9-401d-b9b8-05e4eca4977e}' # CTRLGUID_MF_VIDEO_PROCESSOR
'{C9C074D2-FF9B-410F-8AC6-81C7B8E60D0F}' # MediaEngineCtrlGuid
'{982824E5-E446-46AE-BC74-836401FFB7B6}' # Microsoft-Windows-Media-Streaming
'{8F2048E0-F260-4F57-A8D1-932376291682}' # Microsoft-Windows-MediaEngine
'{8F0DB3A8-299B-4D64-A4ED-907B409D4584}' # Microsoft-Windows-Runtime-Media
'{DD2FE441-6C12-41FD-8232-3709C6045F63}' # Microsoft-Windows-DirectAccess-MediaManager
'{D2402FDE-7526-5A7B-501A-25DC7C9C282E}' # Microsoft-Windows-Media-Protection-PlayReady-Performance
'{B8197C10-845F-40CA-82AB-9341E98CFC2B}' # Microsoft-Windows-MediaFoundation-MFCaptureEngine
'{4B7EAC67-FC53-448C-A49D-7CC6DB524DA7}' # Microsoft-Windows-MediaFoundation-MFReadWrite
'{A4112D1A-6DFA-476E-BB75-E350D24934E1}' # Microsoft-Windows-MediaFoundation-MSVProc
'{F404B94E-27E0-4384-BFE8-1D8D390B0AA3}' # Microsoft-Windows-MediaFoundation-Performance
'{BC97B970-D001-482F-8745-B8D7D5759F99}' # Microsoft-Windows-MediaFoundation-Platform
'{B65471E1-019D-436F-BC38-E15FA8E87F53}' # Microsoft-Windows-MediaFoundation-PlayAPI
'{323DAD74-D3EC-44A8-8B9D-CAFEB4999274}' # Microsoft-Windows-WLAN-MediaManager
'{F4C9BE26-414F-42D7-B540-8BFF965E6D32}' # Microsoft-Windows-WWAN-MediaManager
'{4199EE71-D55D-47D7-9F57-34A1D5B2C904}' # TSMFTrace
'{A9C1A3B7-54F3-4724-ADCE-58BC03E3BC78}' # CtlGuidWMP
'{3CC2D4AF-DA5E-4ED4-BCBE-3CF995940483}' # Microsoft-Windows-DirectShow-KernelSupport
'{968F313B-097F-4E09-9CDD-BC62692D138B}' # Microsoft-Windows-DirectShow-Core
'{9A010476-792D-57BE-6AF9-8DE32164F021}' # Microsoft.Windows.DirectShow.FilterGraph
'{E5E16361-C9F0-4BF4-83DD-C3F30E37D773}' # VmgTraceControlGuid
'{A0386E75-F70C-464C-A9CE-33C44E091623}' # DXVA2 (DirectX Video Acceleration 2)
'{86EFFF39-2BDD-4EFD-BD0B-853D71B2A9DC}' # Microsoft-Windows-MPEG2_DLNA-Encoder
'{AE5CF422-786A-476A-AC96-753B05877C99}' # Microsoft-Windows-MSMPEG2VDEC
'{51311DE3-D55E-454A-9C58-43DC7B4C01D2}' # Microsoft-Windows-MSMPEG2ADEC
'{0A95E01D-9317-4506-8796-FB946ACD7016}' # CodecLogger
'{EA6D6E3B-7014-4AB1-85DB-4A50CDA32A82}' # Codec
'{7F2BD991-AE93-454A-B219-0BC23F02262A}' # Microsoft-Windows-MP4SDECD
'{2A49DE31-8A5B-4D3A-A904-7FC7409AE90D}' # Microsoft-Windows-MFH264Enc
'{55BACC9F-9AC0-46F5-968A-A5A5DD024F8A}' # Microsoft-Windows-wmvdecod
'{313B0545-BF9C-492E-9173-8DE4863B8573}' # Microsoft-Windows-WMVENCOD
'{3293F985-41D3-4B6A-B187-2FF4AA91F2FC}' # Multimedia-HEVCDECODER / Microsoft-OneCore-Multimedia-HEVCDECODER
'{D17B213A-C505-49C9-98CC-734253EF65D4}' # Microsoft-Windows-msmpeg2venc
'{B6C06841-5C8C-47A6-BEDE-6159F4D4A701}' # MyDriver1TraceGuid
'{E80ADCF1-C790-4108-8BB9-8A5CA3466C04}' # Microsoft-Windows-TerminalServices-RDP-AvcSoftwareDecoder
'{3f7b2f99-b863-4045-ad05-f6afb62e7af1}' # Microsoft-Windows-TerminalServices-MediaRedirection(tsmf.dll)
)
$DND_AudioWPRProviders = @(
)
$DND_WUProviders = @(
'{0b7a6f19-47c4-454e-8c5c-e868d637e4d8}' # WUTraceLogging
'{9906081d-e45a-4f41-a53f-2ac2e0225de1}' # SIHTraceLoggingProviderGuid
'{5251FD36-A05A-4033-ADAD-FA409644E282}' # SIHTraceLoggingSessionGuid
'{D48679EB-8AA3-4138-BE24-F1648C874E49}' # SoftwareUpdateClientTelemetry
)
$DND_CBSProviders = @(
'{5fc48aed-2eb8-4cd4-9c87-54700c4b7b26}' # CbsServicingProvider
'{bd12f3b8-fc40-4a61-a307-b7a013a069c1}' # Microsoft-Windows-Servicing
'{34c6b9f6-c1cf-4fe5-a133-df6cb085ec67}' # CBSTRACEGUID
)
$DND_CodeIntegrityProviders = @(
'{DDD9464F-84F5-4536-9F80-03E9D3254E5B}' # MicrosoftWindowsCodeIntegrityTraceLoggingProvider
'{2e1eb30a-c39f-453f-b25f-74e14862f946}' # MicrosoftWindowsCodeIntegrityAuditTraceLoggingProvider
'{4EE76BD8-3CF4-44a0-A0AC-3937643E37A3}' # Microsoft-Windows-CodeIntegrity
'{EB65A492-86C0-406A-BACE-9912D595BD69}' # Microsoft-Windows-AppModel-Exec
'{EF00584A-2655-462C-BC24-E7DE630E7FBF}' # Microsoft.Windows.AppLifeCycle
'{382B5E24-181E-417F-A8D6-2155F749E724}' # Microsoft.Windows.ShellExecute
'{072665fb-8953-5a85-931d-d06aeab3d109}' # Microsoft.Windows.ProcessLifetimeManager
)
$DND_PNPProviders = @(
'{63aeffcd-648e-5fc0-b4e7-a39a4e6612f8}' # Microsoft.Windows.InfRemove
'{2E5950B2-1F5D-4A52-8D1F-4E656C915F57}' # Microsoft.Windows.PNP.DeviceManager
'{F52E9EE1-03D4-4DB3-B2D4-1CDD01C65582}' # PnpInstall
'{9C205A39-1250-487D-ABD7-E831C6290539}' # Microsoft-Windows-Kernel-PnP
'{8c8ebb7e-a4b7-4336-bddb-4a0aea0f535a}' # Microsoft.Windows.Sysprep.PnP
'{0e0fe12b-e926-44d2-8cf1-8a62a6d44036}' # Microsoft.Windows.DriverStore
'{139299bb-9394-5058-dd33-9422e5903fc3}' # Microsoft.Windows.SetupApi
'{a23bd382-12ab-4f02-a0d7-273153f8b65a}' # Microsoft.Windows.DriverInstall
'{059a2460-1077-4446-bdeb-5221de48b9e4}' # Microsoft.Windows.DriverStore.DriverPackage
'{96F4A050-7E31-453C-88BE-9634F4E02139}' # Microsoft-Windows-UserPnp
'{A676B545-4CFB-4306-A067-502D9A0F2220}' # PlugPlay
'{84051b98-f508-4e54-82fa-8865c697c3b1}' # Microsoft-Windows-PnPMgrTriggerProvider
'{D5EBB80C-4407-45E4-A87A-015F6AF60B41}' # Microsoft-Windows-Kernel-PnPConfig
'{FA8DE7C4-ACDE-4443-9994-C4E2359A9EDB}' # claspnp
'{F5D05B38-80A6-4653-825D-C414E4AB3C68}' # Microsoft-Windows-StorDiag
'{5590bf8b-9781-5d78-961f-5bb8b21fbaf6}' # Microsoft.Windows.Storage.Classpnp
'{B3A0C2C8-83BB-4DDF-9F8D-4B22D3C38AD7}' # Microsoft-Windows-Kernel-PnP-Rundown
)
$DND_TPMProviders = @(
'{1B6B0772-251B-4D42-917D-FACA166BC059}' # TPM
'{3A8D6942-B034-48E2-B314-F69C2B4655A3}' # TpmCtlGuid
'{470baa67-2d7f-4c9c-8bf4-b1b3226f7b17}' # Microsoft.Tpm.ProvisioningTask
'{7D5387B0-CBE0-11DA-A94D-0800200C9A66}' # Microsoft-Windows-TPM-WMI
'{84FF4863-8173-5F91-9E83-B4C3B38042D5}' # Microsoft.Tpm.Drv_20
'{6FCC5608-58C2-56AE-5ACD-B2A70F6323CF}' # Microsoft.Tpm.Drv_12
'{61D3C72E-6B1B-454C-A34D-B39EB95B8D99}' # Microsoft.Tpm.Tbs
)
#endregion --- ETW component trace Providers ---
#region --- Scenario definitions ---
$DND_ServicingProviders = @( # all Providers need to be defined already above
$DND_CBSProviders
$DND_PNPProviders
$DND_WUProviders
)
$DND_AudioETW_ETWTracingSwitchesStatus = [Ordered]@{
'DND_AudioETW' = $true
'noBasicLog' = $true
'CollectComponentLog' = $true
}
$DND_AudioWPR_ETWTracingSwitchesStatus = [Ordered]@{
'DND_AudioWPR' = $true
'noBasicLog' = $true
'CollectComponentLog' = $true
}
$DND_General_ETWTracingSwitchesStatus = [Ordered]@{
#'NET_Dummy' = $true
'CommonTask NET' = $True ## <------ the commontask can take one of "Dev", "NET", "ADS", "UEX", "DnD" and "SHA", or "Full" or "Mini"
'NetshScenario InternetClient_dbg' = $true
'Procmon' = $true
#'WPR General' = $true
'PerfMon ALL' = $true
'PSR' = $true
'Video' = $true
'SDP NET' = $True
'xray' = $True
'CollectComponentLog' = $True
}
$DND_Servicing_ETWTracingSwitchesStatus = [Ordered]@{
'DND_Servicing' = $True
'Procmon' = $True
'noBasicLog' = $True
'CollectComponentLog' = $True
}
#endregion --- Scenario definitions ---
#region Functions
function CollectDND_PnPLog {
EnterFunc $MyInvocation.MyCommand.Name
LogInfo "[$($MyInvocation.MyCommand.Name)] exporting PNP info"
$outFile = $PrefixTime + 'PnP_info_Stop_.txt'
'/enum-devices /problem', '/enum-devices' | ForEach-Object {
$Commands = @("pnputil.exe $_ | Out-File -Append $outFile"); RunCommands $LogPrefix $Commands -ThrowException:$False -ShowMessage:$False }
EndFunc $MyInvocation.MyCommand.Name
}
# [we] _NET: moved NET_ '_WinUpd' to _DND, #394
function CollectDND_WinUpdLog {
EnterFunc $MyInvocation.MyCommand.Name
LogInfo "[$($MyInvocation.MyCommand.Name)] collecting 'Get-WindowsUpdateLog -LogPath WindowsUpdate.log'"
$Commands = @(
'Set-Alias Out-Default Out-Null'
"Get-WindowsUpdateLog -LogPath $PrefixCn`WindowsUpdate.log"
)
RunCommands $LogPrefix $Commands -ThrowException:$False -ShowMessage:$False
EndFunc $MyInvocation.MyCommand.Name
}
########## CollectLog Function ############
#For CopyLogs.cmd
Function CollectDND_WULogsLog {
EnterFunc $MyInvocation.MyCommand.Name
# do we run elevated?
if (!(FwIsElevated) -or ($Host.Name -match 'ISE Host')) {
if ($Host.Name -match 'ISE Host') {
LogInfo 'Exiting on ISE Host.' 'Red'
}
LogInfo 'This script needs to run from elevated command/PowerShell prompt.' 'Red'
return
}
# Skipping unneccessary basic log collection
$global:ParameterArray += 'noBasicLog'
# $TempDir="$LogFolder\WU_Logs$LogSuffix"
# Create a string variable named $TempDir that concatenates the values of two variables $LogFolder and $LogSuffix.
# The -join operator is used for joining the strings, which is faster and more memory-efficient than string concatenation.
$TempDir = "$LogFolder\WU_Logs$LogSuffix" -join ''
FwCreateLogFolder $TempDir
$Prefix = Join-Path $TempDir $env:COMPUTERNAME'_'
$RobocopyLog = $Prefix + 'robocopy.log'
$ErrorFile = $Prefix + 'Errorout.txt'
$Line = '--------------------------------------------------------------------------------------------------------'
$validValues = '0', '1'
# use tss_config.cfg to modify these parameters on the fly as you need them
# Flush Windows Update logs by stopping services before copying...usually not needed.
# $global:DND_SETUPReport_FlushLogs set in tss_config.cfg?
$FlushLogs = if ($DND_SETUPReport_FlushLogs -in $validValues) { $DND_SETUPReport_FlushLogs } else { 0 }
$_WUETLPATH = "$env:windir\Logs\WindowsUpdate"
$_SIHETLPATH = "$env:windir\Logs\SIH"
$_WUOLDETLPATH = "$env:windir.old\Windows\Logs\WindowsUpdate"
$_OLDPROGRAMDATA = "$env:windir.old\ProgramData"
$_OLDLOCALAPPDATA = $env:LOCALAPPDATA -replace '^.{2}', "$env:windir.old"
LogInfo ("[OS] Version: $_major.$_minor.$_build")
# starting MsInfo early
FwGetMsInfo32 'nfo' -Subfolder "WU_Logs$LogSuffix"
FwGetSysInfo -Subfolder "WU_Logs$LogSuffix"
Write-Output '-------------------------------------------'
Write-Output 'Copying logs ...'
Write-Output '-------------------------------------------'
$SourceDestinationPaths = New-Object 'System.Collections.Generic.List[Object]'
$SourceDestinationPaths = @(
@("$env:windir\windowsupdate.log", "$($Prefix)WindowsUpdate.log"),
@("$env:windir\SoftwareDistribution\ReportingEvents.log", "$($Prefix)WindowsUpdate_ReportingEvents.log"),
@("$env:LOCALAPPDATA\microsoft\windows\windowsupdate.log", "$($Prefix)WindowsUpdatePerUser.log"),
@("$env:windir\windowsupdate (1).log", "$($Prefix)WindowsUpdate(1).log"),
@("$env:windir.old\Windows\windowsupdate.log", "$($Prefix)WindowsUpdate.old.log"),
@("$env:windir.old\Windows\SoftwareDistribution\ReportingEvents.log", "$($Prefix)ReportingEvents.old.log"),
@("$_OLDLOCALAPPDATA\microsoft\windows\windowsupdate.log", "$($Prefix)WindowsUpdatePerUser.old.log"),
@("$env:windir\SoftwareDistribution\Plugins\7D5F3CBA-03DB-4BE5-B4B36DBED19A6833\TokenRetrieval.log", "$($Prefix)WindowsUpdate_TokenRetrieval.log")
)
FwCopyFiles $SourceDestinationPaths -ShowMessage:$False
# -------------------------------------------------------------
# CBS & PNP logs
$Commands = @(
"robocopy.exe `"$env:windir\logs\cbs`" $TempDir\CBS *.log /W:1 /R:1 /NP /LOG+:$RobocopyLog | Out-Null"
"robocopy.exe `"$env:windir\logs\cbs`" $TempDir\CBS *.cab /W:1 /R:1 /NP /LOG+:$RobocopyLog | Out-Null"
"robocopy.exe `"$env:windir\logs\dpx`" $TempDir\CBS *.log /W:1 /R:1 /NP /LOG+:$RobocopyLog | Out-Null"
"robocopy.exe `"$env:windir\inf`" $TempDir\CBS *.log /W:1 /R:1 /NP /LOG+:$RobocopyLog | Out-Null"
"robocopy.exe `"$env:windir\WinSxS`" $TempDir\CBS poqexec.log /W:1 /R:1 /NP /LOG+:$RobocopyLog | Out-Null"
"robocopy.exe `"$env:windir\WinSxS`" $TempDir\CBS pending.xml /W:1 /R:1 /NP /LOG+:$RobocopyLog | Out-Null"
"robocopy.exe `"$env:windir\servicing\sessions`" $TempDir\CBS sessions.xml /W:1 /R:1 /NP /LOG+:$RobocopyLog | Out-Null"
)
RunCommands 'CBS_PNP' $Commands -ThrowException:$False -ShowMessage:$True
# UUP logs and action list xmls
if ((Test-Path -Path "$env:windir\SoftwareDistribution\Download\*.log") -or (Test-Path -Path "$env:windir\SoftwareDistribution\Download\*.xml")) {
robocopy "$env:windir\SoftwareDistribution\Download" "$TempDir\UUP" *.log *.xml /W:1 /R:1 /NP /LOG+:$RobocopyLog
}
# -------------------------------------------------------------
# Windows Store logs.
cmd /r copy "$env:TEMP\winstore.log" "$($Prefix)winstore-Broker.log" /y >$null 2>&1
robocopy "$env:USERPROFILE\AppData\Local\Packages\WinStore_cw5n1h2txyewy\AC\Temp" "$TempDir winstore.log" /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
# -------------------------------------------------------------
# WU ETLs for Win10+
# Newer build has multiple ETLs
if (Test-Path -Path $_WUETLPATH) {
$LogPrefixFlushLogs = 'FlushLogs'
LogInfo ("[$LogPrefixFlushLogs] Flushing USO/WU logs")
$CommandsFlushLogs = @(
'Stop-Service -Name usosvc'
'Stop-Service -Name wuauserv'
)
RunCommands $LogPrefixFlushLogs $CommandsFlushLogs -ThrowException:$False -ShowMessage:$True
robocopy $_WUETLPATH $TempDir\WU *.etl /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
$LogPrefixWU = 'WU'
if ($_WIN10_1607) {
LogInfo ("[$LogPrefixWU] Public symbol server: Trying to connect...")
# temporarily save $ProgressPreference
$OriginalProgressPreference = $Global:ProgressPreference
$Global:ProgressPreference = 'SilentlyContinue'
$pubsymsrvcon = Test-NetConnection -ComputerName $PublicSymSrv -CommonTCPPort HTTP -ErrorAction SilentlyContinue -WarningAction SilentlyContinue
# reset $ProgressPreference
$Global:ProgressPreference = $OriginalProgressPreference
if (($false -eq ($pubsymsrvcon).TcpTestSucceeded)) {
LogWarn ("[$LogPrefixWU] Public symbol server: Connection failed.")
@("Public symbol server: Wasn't able to connect to $PublicSymSrv.", 'Please convert ETL files from logs\WindowsUpdate instead.', 'Use a internet connected Windows Server 2016 to convert logs with Get-WindowsUpdateLog.', $Line, $pubsymsrvcon) | Out-File -FilePath ($Prefix + 'WindowsUpdateETL_PublicSymbolsFailed.log') -Append
}
# only run if public symbol server is reachable
elseif ($true -eq ($pubsymsrvcon).TcpTestSucceeded) {
LogInfo ("[$LogPrefixWU] Public symbol server: Connected.")
@("Public symbol server: Successfully connected to $PublicSymSrv.", $Line, $pubsymsrvcon) | Out-File -FilePath ($Prefix + 'WindowsUpdateETL_PublicSymbolsConnected.log') -Append
LogInfo ("[$LogPrefixWU] Getting Windows Update log.")
LogInfo ("[$LogPrefixWU] tracerpt.exe retrieving public symbols for ETL conversion - this might take a while...") 'Cyan'
# Suppress script output by using a job
$WULogsJobLog = "$($Prefix)WindowsUpdateETL_Converted.log"
$WULogsJob = Start-Job -ScriptBlock { Get-WindowsUpdateLog -Log $args } -ArgumentList $WULogsJobLog
$WULogsJob | Wait-Job | Remove-Job
# robocopy "$env:SystemDrive\ $TempDir\$_WINDOWSUPDATE WindowsUpdateVerbose.etl" /W:1 /R:1 /NP /LOG+:$RobocopyLog
}
}
elseif ($_WIN10_1607_OR_LATER) {
LogInfo ("[$LogPrefixWU] Getting Windows Update log.")
# Suppress script output by using a job
$WULogsJobLog = "$($Prefix)WindowsUpdateETL_Converted.log"
$WULogsJob = Start-Job -ScriptBlock { Get-WindowsUpdateLog -Log $args } -ArgumentList $WULogsJobLog
$WULogsJob | Wait-Job | Remove-Job
}
}
# Copy SIH ETLs
if (Test-Path -Path $_SIHETLPATH) {
robocopy $_SIHETLPATH $TempDir\SIH *.etl /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
}
# Older build has ETL in windir
if (Test-Path -Path "$env:windir\windowsupdate.etl") {
# windowsupdate.etl is not flushed until service is stopped.
$LogPrefixFlushLogs = 'FlushLogs'
LogInfo ("[$LogPrefixFlushLogs] Flushing USO/WU logs")
$CommandsFlushLogs = @(
'Stop-Service -Name usosvc'
'Stop-Service -Name wuauserv'
)
RunCommands $LogPrefixFlushLogs $CommandsFlushLogs -ThrowException:$False -ShowMessage:$True
robocopy "$env:windir" $TempDir windowsupdate.etl /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
}
# Verbose Logging redirects WU ETL to systemdrive in newer builds
if (Test-Path -Path "$env:SystemDrive\windowsupdateverbose.etl") {
# windowsupdateverbose.etl is not flushed until service is stopped.
$LogPrefixFlushLogs = 'FlushLogs'
LogInfo ("[$LogPrefixFlushLogs] Flushing USO/WU logs")
$CommandsFlushLogs = @(
'Stop-Service -Name usosvc'
'Stop-Service -Name wuauserv'
)
RunCommands $LogPrefixFlushLogs $CommandsFlushLogs -ThrowException:$False -ShowMessage:$True
robocopy $env:SystemDrive $TempDir windowsupdateverbose.etl /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
}
Write-Output '-------------------------------------------'
Write-Output 'Copying upgrade logs'
Write-Output '-------------------------------------------'
cmd /r mkdir "$TempDir\UpgradeSetup" >$null 2>&1
cmd /r mkdir "$TempDir\UpgradeSetup\NewOS" >$null 2>&1
cmd /r mkdir "$TempDir\UpgradeSetup\UpgradeAdvisor" >$null 2>&1
robocopy "$env:SystemDrive\Windows10Upgrade" "$TempDir\UpgradeSetup\UpgradeAdvisor" Upgrader_default.log /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
robocopy $env:SystemDrive\Windows10Upgrade "$TempDir\UpgradeSetup\UpgradeAdvisor" Upgrader_win10.log /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
robocopy "$env:SystemDrive\$GetCurrent\logs" "$TempDir\UpgradeSetup\UpgradeAdvisor" *.* /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
robocopy "$env:windir\logs\mosetup" "$TempDir\UpgradeSetup" *.log /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
cmd /r copy "$env:windir.old\Windows\logs\mosetup\*.log" "$TempDir\UpgradeSetup\bluebox_windowsold.log" /y >$null 2>&1
robocopy "$env:windir\Panther\NewOS" "$TempDir\UpgradeSetup\NewOS" *.log /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
robocopy "$env:windir\Panther\NewOS" "$TempDir\UpgradeSetup\NewOS" miglog.xml /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
robocopy "$env:windir\Panther" "$TempDir\UpgradeSetup" *.log /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
robocopy "$env:windir\Panther" "$TempDir\UpgradeSetup" miglog.xml /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
cmd /r copy "$env:SystemDrive\`$Windows.~BT\Sources\Panther\setupact.log" "$TempDir\UpgradeSetup\setupact_tildabt.log" /y >$null 2>&1
cmd /r copy "$env:SystemDrive\`$Windows.~BT\Sources\Panther\setuperr.log" "$TempDir\UpgradeSetup\setuperr_tildabt.log" /y >$null 2>&1
cmd /r copy "$env:SystemDrive\`$Windows.~BT\Sources\Panther\miglog.xml" "$TempDir\UpgradeSetup\miglog_tildabt.xml" /y >$null 2>&1
if (Test-Path -Path "$env:SystemDrive\`$Windows.~BT\Sources\Rollback") {
robocopy "$env:SystemDrive\`$Windows.~BT\Sources\Rollback" "$TempDir\UpgradeSetup\Rollback" /W:1 /R:1 /NP /LOG+:$RobocopyLog /S >$null
}
if (Test-Path -Path "$env:windir\Panther\NewOS") {
robocopy "$env:windir\Panther\NewOS" "$TempDir\UpgradeSetup\PantherNewOS" /W:1 /R:1 /NP /LOG+:$RobocopyLog /S >$null
}
# Copying the datastore file
if (Test-Path -Path "$env:windir\softwaredistribution\datastore\datastore.edb") {
Write-Output 'Copying WU datastore ...'
Stop-Service -Name usosvc >$null 2>&1
Stop-Service -Name wuauserv >$null 2>&1
robocopy "$env:windir\softwaredistribution\datastore" $TempDir DataStore.edb /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
}
# Also copy ETLs pre-upgrade
if (Test-Path -Path $_WUOLDETLPATH) {
robocopy $_WUOLDETLPATH "$TempDir\Windows.old\WU" *.etl /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
}
# -------------------------------------------------------------
# Copy DISM Logs and DISM output
robocopy "$env:windir\logs\dism" $TempDir\DISM * /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
dism /online /get-packages /format:table > $Prefix'DISM_GetPackages.txt'
dism /online /get-features /format:table > $Prefix'DISM_GetFeatures.txt'
# -------------------------------------------------------------
# MUSE logs for Win10+
if ($null -ne (Get-Service -Name usosvc -ErrorAction SilentlyContinue)) {
Write-Output 'Copying MUSE logs ...'
Stop-Service -Name usosvc >$null 2>&1
robocopy "$env:ProgramData\UsoPrivate\UpdateStore" "$TempDir\MUSE" /W:1 /R:1 /NP /LOG+:$RobocopyLog /S >$null
robocopy "$env:ProgramData\USOShared\Logs" "$TempDir\MUSE" /W:1 /R:1 /NP /LOG+:$RobocopyLog /S >$null
SCHTASKS /query /v /TN \Microsoft\Windows\UpdateOrchestrator\ > "$TempDir\MUSE\updatetaskschedules.txt"
robocopy "$_OLDPROGRAMDATA\USOPrivate\UpdateStore" "$TempDir\Windows.old\MUSE" /W:1 /R:1 /NP /LOG+:$RobocopyLog /S >$null
robocopy "$_OLDPROGRAMDATA\USOShared\Logs" "$TempDir\Windows.old\MUSE" /W:1 /R:1 /NP /LOG+:$RobocopyLog /S >$null
}
# -------------------------------------------------------------
# DO logs for Win10+
if ($_WIN10_OR_LATER) {
Get-DNDDoLogs $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# -------------------------------------------------------------
# WU BVT logs.
$bvtPaths = "$env:SystemDrive\wubvt", "$env:SystemDrive\dcatebvt", "$env:SystemDrive\wuappxebvt", "$env:SystemDrive\wuuxebvt", "$env:SystemDrive\wuauebvt", "$env:SystemDrive\WUE2ETest", "$env:SystemDrive\taef\wubvt", "$env:SystemDrive\taef\wuappxebvt", "$env:SystemDrive\taef\wuuxebvt", "$env:SystemDrive\taef\wuauebvt", "$env:SystemDrive\taef\WUE2ETest", "$env:SystemDrive\taef\WUE2ETest"
foreach ($bvtPath in $bvtPaths) {
if (Test-Path $bvtPath) {
FwCreateFolder $TempDir\BVT
robocopy $bvtPath $TempDir\BVT *.log /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
}
}
Write-Output '-------------------------------------------'
Write-Output 'Copying token cache and license store ...'
Write-Output '-------------------------------------------'
robocopy "$env:windir\ServiceProfiles\LocalService\AppData\Local\Microsoft\WSLicense" $TempDir tokens.dat /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
robocopy "$env:windir\SoftwareDistribution\Plugins\7D5F3CBA-03DB-4BE5-B4B36DBED19A6833" $TempDir 117CAB2D-82B1-4B5A-A08C-4D62DBEE7782.cache /W:1 /R:1 /NP /LOG+:$RobocopyLog >$null
Write-Output '-------------------------------------------'
Write-Output 'Copying event logs ...'
Write-Output '-------------------------------------------'
$_event_logs = 'Application', 'Microsoft-Windows-AppXDeployment/Operational', 'Microsoft-Windows-AppXDeploymentServer/Operational', 'Microsoft-Windows-AppXDeploymentServer/Restricted', 'Microsoft-Windows-AppxPackaging/Operational', 'Microsoft-Windows-Bits-Client/Operational', 'Microsoft-Windows-Kernel-PnP/Configuration', 'Microsoft-Windows-Store/Operational', 'Microsoft-Windows-WindowsUpdateClient/Operational', 'System'
$EVTX = $false
$_format = '/TXT'
Get-DNDEventLogs $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs $_event_logs $EVTX $_format
$_event_logs = ($_event_logs).replace('/', '%4')
foreach ($_event_log in $_event_logs) {
if (Test-Path "$env:windir\System32\winevt\Logs\$($_event_log).evtx") {
Copy-Item "$env:windir\System32\winevt\Logs\$($_event_log).evtx" "$($Prefix)evt_$(($_event_log).replace('Microsoft-Windows-','')).evtx"
}
}
Write-Output '-------------------------------------------'
Write-Output 'Logging registry ...'
Write-Output '-------------------------------------------'
$RegKeysMiscInfoExport = @(
('HKLM:Software\Microsoft\Windows\CurrentVersion\WindowsUpdate', "$($Prefix)reg_wu.txt"),
('HKLM:Software\Policies\Microsoft\Windows\WindowsUpdate', "$($Prefix)reg_wupolicy.txt"),
('HKLM:SYSTEM\CurrentControlSet\Control\MUI\UILanguages', "$($Prefix)reg_langpack.txt"),
('HKLM:Software\Policies\Microsoft\WindowsStore', "$($Prefix)reg_StorePolicy.txt"),
('HKLM:Software\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate', "$($Prefix)reg_StoreWUApproval.txt"),
('HKLM:SYSTEM\CurrentControlSet\Control\FirmwareResources', "$($Prefix)reg_FirmwareResources.txt"),
('HKLM:Software\Microsoft\WindowsSelfhost', "$($Prefix)reg_WindowsSelfhost.txt"),
('HKLM:Software\Microsoft\WindowsUpdate', "$($Prefix)reg_wuhandlers.txt"),
('HKLM:Software\Microsoft\Windows NT\CurrentVersion\Superfetch', "$($Prefix)reg_superfetch.txt"),
('HKLM:Software\Setup', "$($Prefix)reg_Setup.txt"),
('HKCU:Software\Microsoft\Windows\CurrentVersion\Policies\WindowsUpdate', "$($Prefix)reg_peruser_wupolicy.txt"),
('HKLM:Software\Microsoft\PolicyManager\current\device\Update', "$($Prefix)reg_wupolicy_mdm.txt"),
('HKLM:Software\Microsoft\WindowsUpdate\UX\Settings', "$($Prefix)reg_wupolicy_ux.txt"),
('HKLM:Software\Microsoft\Windows\CurrentVersion\WaaSAssessment', "$($Prefix)reg_WaasAssessment.txt"),
('HKLM:Software\Microsoft\sih', "$($Prefix)reg_sih.txt")
)
FwExportRegistry 'MiscInfo' $RegKeysMiscInfoExport -RealExport $true
$RegKeysMiscInfoProperty = @(
('HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'BuildLab', "$($Prefix)reg_BuildInfo.txt"),
('HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'BuildLabEx', "$($Prefix)reg_BuildInfo.txt"),
('HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'UBR', "$($Prefix)reg_BuildInfo.txt"),
('HKLM:SOFTWARE\Microsoft\Windows NT\CurrentVersion', 'ProductName', "$($Prefix)reg_BuildInfo.txt"),
('HKLM:SOFTWARE\Microsoft\Windows\CurrentVersion\AppModel', 'Version', "$($Prefix)reg_AppModelVersion.txt")
)
FwExportRegistry 'MiscInfo' $RegKeysMiscInfoProperty
Write-Output '-------------------------------------------'
Write-Output 'Collecting other stuff ...'
Write-Output '-------------------------------------------'
Write-Output 'Getting networking configs ...'
$Commands = @(
"ipconfig /all | Out-File -Append $($Prefix)ipconfig.txt"
"cmd /r netsh winhttp show proxy | Out-File -Append $($Prefix)winhttp_proxy.txt"
"cmd /r copy `"$env:windir\System32\drivers\etc\hosts`" `"$($Prefix)hosts_file.txt`" /y"
)
RunCommands 'Network_config' $Commands -ThrowException:$False -ShowMessage:$True
Write-Output 'Getting directory lists ...'
$Commands = @(
"cmd /r dir $env:windir\SoftwareDistribution /s | Out-File -Append $($Prefix)dir_softwaredistribution.txt"
"cmd /r dir $env:windir\SoftwareDistribution /ah | Out-File -Append $($Prefix)dir_softwaredistribution_hidden.txt"
)
RunCommands 'directory_lists' $Commands -ThrowException:$False -ShowMessage:$True
Write-Output 'Getting app list ...'
if ($_WIN8_OR_LATER) {
try { Import-Module appx; Get-AppxPackage -AllUsers | Out-File -FilePath $Prefix'GetAppxPackage.log' }
catch { LogException ('Get-Appxpackage failed') $_ }
}
if ($_WINBLUE_OR_LATER) {
try { Get-AppxPackage -packagetype bundle | Out-File -FilePath $Prefix'GetAppxPackageBundle.log' }
catch { LogException ('Get-Appxpackage failed') $_ }
}
Write-Output 'Getting download list ...'
bitsadmin /list /allusers /verbose > $Prefix'bitsadmin.log'
Write-Output 'Getting certificate list ...'
certutil -store root > $Prefix'certs.txt' 2>&1
Write-Output 'Getting installed update list ...'
$Commands = @(
"Get-CimInstance -ClassName win32_quickfixengineering | Out-File -Append $($Prefix)InstalledUpdates.log"
"sc.exe query wuauserv | Out-File -Append $($Prefix)wuauserv-state.txt"
"SCHTASKS /query /v /TN \Microsoft\Windows\WindowsUpdate\ | Out-File -Append $($Prefix)WUScheduledTasks.log"
)
RunCommands 'installed_update' $Commands -ThrowException:$False -ShowMessage:$True
Write-Output '-------------------------------------------'
Write-Output 'Collecting file versions ...'
Write-Output '-------------------------------------------'
$binaries = @('wuaext.dll', 'wuapi.dll', 'wuaueng.dll', 'wucltux.dll', 'wudriver.dll', 'wups.dll', 'wups2.dll', 'wusettingsprovider.dll', 'wushareduxresources.dll', 'wuwebv.dll', 'wuapp.exe', 'wuauclt.exe', 'storewuauth.dll', 'wuuhext.dll', 'wuuhmobile.dll', 'wuau.dll', 'wuautoappupdate.dll')
foreach ($file in $binaries) {
FwFileVersion -Filepath ("$env:windir\system32\$file") | Out-File -FilePath "$($Prefix)FilesVersion.txt" -Append
}
$muis = @('wuapi.dll.mui', 'wuaueng.dll.mui', 'wucltux.dll.mui', 'wusettingsprovider.dll.mui', 'wushareduxresources.dll.mui')
foreach ($file in $muis) {
FwFileVersion -Filepath ("$env:windir\system32\en-US\$file") | Out-File -FilePath ($Prefix + 'FilesVersion.txt') -Append
}
# end
Write-Output '-------------------------------------------'
Write-Output 'Restarting services ...'
Write-Output '-------------------------------------------'
$Commands = @(
'Start-Service -Name dosvc'
'Start-Service -Name usosvc'
'Start-Service -Name wuauserv'
)
RunCommands 'Restart_services' $Commands -ThrowException:$False -ShowMessage:$True
FwWaitForProcess $global:msinfo32NFO 300
Write-Output '-------------------------------------------'
Write-Output 'Finished DND_WUlogs!'
Write-Output '-------------------------------------------'
EndFunc $MyInvocation.MyCommand.Name
}
#For SetupReport
Function CollectDND_SETUPReportLog {
EnterFunc $MyInvocation.MyCommand.Name
# Skipping unneccessary basic log collection
$global:ParameterArray += 'noBasicLog'
# do we run elevated?
if (!(FwIsElevated) -or ($Host.Name -match 'ISE Host')) {
if ($Host.Name -match 'ISE Host') {
$GETWINSXS
LogInfo 'Exiting on ISE Host.' 'Red'
}
LogInfo 'This script needs to run from elevated command/PowerShell prompt.' 'Red'
return
}
$TempDir = Join-Path $LogFolder "Setup_Report$LogSuffix"
FwCreateLogFolder $TempDir
$Prefix = Join-Path $TempDir ($env:COMPUTERNAME + '_')
$RobocopyLog = $Prefix + 'robocopy.log'
$ErrorFile = $Prefix + 'Errorout.txt'
$Line = '--------------------------------------------------------------------------------------------------------'
# use tss_config.cfg to modify these parameters on the fly as you need them
$validValues = '0', '1'
# check if only activation logs are wanted
$ACTONLY = if ($DND_SETUPReport_ACTONLY -in $validValues) { $DND_SETUPReport_ACTONLY } else { 0 }
# configure defaults in int so that it can be converted to boolean, too
@(
('FlushLogs', '0'),
('DATASTORE', '0'),
('UPGRADE', '1'),
('DXDIAG', '0'),
('GETWINSXS', '0'),
('APPCOMPAT', '0'),
('POWERCFG', '0'),
('Min', '0'),
('Max', '0'),
('SURFACE', '0'),
('Summary', '1'),
('NETDETAIL', '0'),
('RFLCHECK', '1'),
('WU', '1'),
('CBSPNP', '1'),
('EVTX', '1'),
('PERMPOL', '1'),
('ACTIVATION', '1'),
('BITLOCKER', '1'),
('DIR', '1'),
('SLOW', '1'),
('PERF', '1'),
('DO', '1'),
('TWS', '1'),
('PROCESS', '1'),
('STORAGE', '1'),
('MISC', '1'),
('NETBASIC', '1'),
('DEFENDER', '1'),
('FILEVERSION', '1'),
('APPLOCKER', '1'),
('DEVICEGUARD', '1')
) | ForEach-Object {
# if $global:DND_SETUPReport_ACTONLY is set, disable anything else
if ($ACTONLY) {
Set-Variable -Name $_[0] -Value '0'
}
# evaluate settings from tss_config.cfg and set variables accordingly
else {
$DND_SETUPReport_TssConfig = (Get-Variable $('DND_SETUPReport_' + $_[0]) -ErrorAction SilentlyContinue).Value
if ($DND_SETUPReport_TssConfig -in $validValues) { Set-Variable -Name $_[0] -Value ([int]$DND_SETUPReport_TssConfig) } else { Set-Variable -Name $_[0] -Value ([int]$_[1]) }
#Get-Variable $($_[0])
}
}
# Get MBAM info
$MBAM_SYSTEM = 0
$DND_SETUPReport_Start = (Get-Date)
LogInfo ('[DND_SETUPReport] Starting...')
LogInfo ("[OS] Version: $_major.$_minor.$_build")
# =================================================================================================================================================
# Section For things that need to be started early
# - Write script version info to MiscInfo
Write-Output "TssVerDateDND:`t`t$global:TssVerDateDND" | Out-File -FilePath ($Prefix + 'MiscInfo.txt')
# - Now lets setup Error output file header
Write-Output $Line | Out-File -FilePath ($Prefix + 'MiscInfo.txt') -Append
#Write-Output "Beginning error recording" | Out-File -FilePath ($Prefix+"MiscInfo.txt") -Append
#Write-Output $Line | Out-File -FilePath ($Prefix+"MiscInfo.txt") -Append
Write-Output ("Starting at`t`t`t`t$DND_SETUPReport_Start") | Out-File -FilePath ($Prefix + 'MiscInfo.txt') -Append
# =================================================================================================================================================
# New logic flow with functions
# Determine if Surface by seeing if manufacturer is Microsoft
$LogPrefixComputerSystem = 'ComputerSystem'
try {
LogInfo ("[$LogPrefixComputerSystem] Trying to determine if this is a Surface device.")
$_manufacturer = (Get-CimInstance -Class:Win32_ComputerSystem).Manufacturer
$_isVirtual = (Get-CimInstance -Class:Win32_ComputerSystem).Model.Contains('Virtual')
}
catch { LogException ("[$LogPrefixComputerSystem] Failed to query Win32_ComputerSystem class.") $_ }
if ((($_manufacturer -eq 'microsoft') -or ($_manufacturer -eq 'microsoft corporation')) -and ($_isVirtual -ne $true)) { $SURFACE = 1 }
if ($SURFACE -and !($ACTONLY)) { $POWERCFG = 1 }
if ($SURFACE) {
# call function SurfaceInfo
Get-DNDSurfaceInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
if ($DXDIAG) {
# call function dxdiag
Get-DNDDxDiag $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# - App Compat check
if ($APPCOMPAT -or $Max) {
#------------------AppcompatFunc--------------------------
# call function appcompat info
Get-DNDAppCompatInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# call function Windows Update
if ($WU) {
Get-DNDWindowsUpdateInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# Get Datastore if set
if ($DATASTORE) {
Get-DNDDatastore $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# call function delivery optimization logs
if ($_WIN10_1809_OR_LATER) {
if ($DO) {
Get-DNDDoLogs $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
}
# call function general file info
if ($_PS4ormore -and $FILEVERSION) {
Get-DNDGeneralFileVersionInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
if ($GETWINSXS) { $_WINSXSVER = 1 }
if (!($_PS4ormore)) { $_WINSXSVER = 0 }
if ($_WINSXSVER) {
# call function WinSxS version info
Get-DNDWinSxSVersionInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# call function CBS and PNP
if ($CBSPNP) {
Get-DNDCbsPnpInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
if ($_WIN8_OR_LATER) {
if ((Test-Path "$env:SystemRoot\system32\appxdeploymentserver.dll") -and ($TWS)) {
# call function store info
Get-DNDStoreInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
}
if ($UPGRADE -or $Max) {
# Windows Setup/Upgrade logs
# call function upgrade logs
Get-DNDSetupLogs $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
# call function PBR logs
Get-DNDPbrLogs $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
# call function deployment logs
Get-DNDDeploymentLogs $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# call function event logs
if ($EVTX) {
Get-DNDEventLogs $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs $_event_logs $EVTX $_format
}
# call function PermissionsAndPolicies
if ($PERMPOL) {
Get-DNDPermissionsAndPolicies $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# call function BitlockerInfo
if ($BITLOCKER) {
Get-DNDBitlockerInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# call function ReliabilitySummary
if ($Summary -or $Max) {
Get-DNDReliabilitySummary $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# call function ActivationState
if ($ACTIVATION) {
Get-DNDActivationState $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# call function DirInfo
if ($DIR) {
Get-DNDDirInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
if ($POWERCFG -or $Max) {
#call function EnergyInfo
Get-DNDEnergyInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
if (!$Min) {
# call function StorageInfo
if ($STORAGE) {
Get-DNDStorageInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# call function ProcessInfo
if ($PROCESS) {
Get-DNDProcessInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# call function MiscInfo
if ($MISC) {
Get-DNDMiscInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# call function NetworkSetup
if ($NETBASIC) {
Get-DNDNetworkBasic $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
if ($NETDETAIL) {
# call function NetworkSetup
Get-DNDNetworkSetup $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
}
if ($_WIN10_OR_LATER) {
# call function defender info
if ($DEFENDER) {
Get-DNDDefenderInfo $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# call function device guard
if ($DEVICEGUARD) {
Get-DNDDeviceGuard $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
}
if (Test-Path $env:windir\Minidump) {
# call funciton minidumps$ErrorFile$Line
Get-DNDMiniDumps $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# call function SlowProcessing
if ($SLOW) {
Get-DNDSlowProcessing $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
LogInfo ('[DND_SETUPReport] Finalizing.')
# LEAVE THIS HERE AT END OF FILE AND RUN EVEN ON MIN OUTPUT
# call function 15 sec perfmon
if ($PERF) {
Get-DNDGeneralPerfmon $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
if ($RFLCHECK) {
# call function RFLcheck prereqs
Get-DNDRFLCheckPrereqs $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
# Windows 10 1607 or higher
if ($_WIN10_1607_OR_LATER) {
# call function applocker function
if ($APPLOCKER) {
# call function applocker prereqs
Get-DNDAppLocker $Prefix $TempDir $RobocopyLog $ErrorFile $Line $FlushLogs
}
}
# ---------------------------------------------------------------------------------------------