@@ -88,6 +88,75 @@ function Export-EventLogs {
88
88
}
89
89
}
90
90
91
+ function Ensure-DiskSpd {
92
+ $scriptDir = $null
93
+ try {
94
+ $scriptDir = Split-Path - Parent $MyInvocation.MyCommand.Definition
95
+ } catch {}
96
+ if (-not $scriptDir -or $scriptDir -eq ' ' -or -not (Test-Path $scriptDir )) {
97
+ $scriptDir = (Get-Location ).Path
98
+ }
99
+
100
+ $diskspdExe = Join-Path $scriptDir ' diskspd.exe'
101
+ $zipPath = Join-Path $scriptDir ' DiskSpd.ZIP'
102
+ $extractDir = Join-Path $scriptDir ' DiskSpdExtracted'
103
+
104
+ if (-not (Test-Path $diskspdExe )) {
105
+ if (-not (Test-Path $zipPath )) {
106
+ Write-Warning " DiskSpd.zip not found. Please place it next to the script."
107
+ return $null
108
+ }
109
+ Expand-Archive - Path $zipPath - DestinationPath $extractDir - Force
110
+
111
+ $arch = $env: PROCESSOR_ARCHITECTURE
112
+ switch ($arch.ToLower ()) {
113
+ " amd64" { $subdir = " amd64" }
114
+ " arm64" { $subdir = " arm64" }
115
+ " x86" { $subdir = " x86" }
116
+ " x86_64" { $subdir = " amd64" }
117
+ " ia64" { $subdir = " amd64" }
118
+ default { $subdir = " amd64" ; Write-Host " DEBUG: Unknown arch '$arch ', defaulting to amd64" }
119
+ }
120
+ Write-Host " DEBUG: subdir is '$subdir '"
121
+
122
+ $diskspdSource = Get-ChildItem - Path $extractDir - Recurse - Filter " diskspd.exe" | Where-Object { $_.FullName -like " *\$subdir \*" } | Select-Object - First 1
123
+
124
+ if ($diskspdSource ) {
125
+ Copy-Item $diskspdSource.FullName $diskspdExe - Force
126
+ } else {
127
+ Write-Warning " Could not find diskspd.exe for platform $arch in $extractDir ."
128
+ return $null
129
+ }
130
+ }
131
+ return $diskspdExe
132
+ }
133
+
134
+ function Export-IOLimits {
135
+ try {
136
+ $diskspdExe = Ensure- DiskSpd
137
+ if (-not $diskspdExe ) {
138
+ Write-Warning " diskspd.exe not available. Skipping IO Limits collection."
139
+ return
140
+ }
141
+ $lunDisks = Get-Disk
142
+ foreach ($disk in $lunDisks ) {
143
+ $diskNumber = $disk.Number
144
+ $partitions = Get-Partition - DiskNumber $diskNumber | Where-Object { $_.DriveLetter }
145
+ foreach ($partition in $partitions ) {
146
+ $diskLetter = $partition.DriveLetter
147
+ $outputFile = Join-Path $logfolderPath " IO_results_$diskLetter .txt"
148
+ $testFile = " $diskLetter `:\test.dat"
149
+ $result = & $diskspdExe - b1M - d30 - o32 - t4 - W - r - L - w0 - c512M $testFile 2>&1 | Tee-Object - FilePath $outputFile
150
+ Remove-Item - Path $testFile - ErrorAction SilentlyContinue
151
+ $output = " Disk Letter: $diskLetter , DiskSpd output: $outputFile "
152
+ $output | Out-File - FilePath (Join-Path $logfolderPath ' IOLimits.txt' ) - Append
153
+ }
154
+ }
155
+ } catch {
156
+ Write-Warning " Failed to collect IO Limits: $_ "
157
+ }
158
+ }
159
+
91
160
function Export-DriversList {
92
161
try {
93
162
Get-WindowsDriver - Online - All | Select-Object - Property * | Export-Csv - Path (Join-Path $logfolderPath ' drv_list.csv' ) - NoTypeInformation
@@ -276,6 +345,7 @@ Write-Output "Log folder path: $logfolderPath"
276
345
try {
277
346
Start-Transcript - Path $progressFile - Append
278
347
$transcriptStarted = $true
348
+ Export-IOLimits
279
349
Export-SystemConfiguration
280
350
Export-EventLogs
281
351
Export-DriversList
0 commit comments