Last active
          August 14, 2025 20:13 
        
      - 
      
 - 
        
Save jwmoss/b9a3bd1c5ff8c2bd4add97c598909f94 to your computer and use it in GitHub Desktop.  
Revisions
- 
        
jwmoss revised this gist
Aug 14, 2025 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,7 +3,7 @@ # --- Settings --- $diskspdUrl = "https://github.com/microsoft/diskspd/releases/download/v2.2/DiskSpd.ZIP" $diskspdExe = "$env:TEMP\diskspd.exe" $tempFile = "D:\diskspd_testfile.dat" # test file now on D: $outFile = "$env:TEMP\diskspd_results.txt" $fileSize = "1G" # test file size  - 
        
jwmoss revised this gist
Aug 14, 2025 . No changes.There are no files selected for viewing
 - 
        
jwmoss revised this gist
Aug 14, 2025 . No changes.There are no files selected for viewing
 - 
        
jwmoss created this gist
Aug 14, 2025 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,65 @@ # Test C: drive speed with DiskSpd (fixed arg passing) # --- Settings --- $diskspdUrl = "https://github.com/microsoft/diskspd/releases/download/v2.2/DiskSpd.ZIP" $diskspdExe = "$env:TEMP\diskspd.exe" $tempFile = "$env:TEMP\diskspd_testfile.dat" $outFile = "$env:TEMP\diskspd_results.txt" $fileSize = "1G" # test file size $duration = 30 # seconds $threads = 4 # --- Download DISKSPD if not found --- if (-not (Test-Path $diskspdExe)) { Write-Host "Downloading DISKSPD..." $zip = Join-Path $env:TEMP "diskspd.zip" Invoke-WebRequest -Uri $diskspdUrl -OutFile $zip Expand-Archive -Path $zip -DestinationPath $env:TEMP -Force Remove-Item $zip -Force # Find the right exe (prefer amd64/x64) $exeFound = Get-ChildItem -Path $env:TEMP -Filter "diskspd.exe" -Recurse | Sort-Object { if ($_.FullName -match 'amd64|x64') {0} else {1} } | Select-Object -First 1 if ($exeFound) { Copy-Item $exeFound.FullName $diskspdExe -Force } else { Write-Error "DISKSPD executable not found after extraction." exit 1 } } # --- Run Test --- Write-Host "Running DISKSPD test on C: drive..." # Build argument list explicitly so variables interpolate correctly $args = @( "-c$($fileSize)" "-d$($duration)" "-Sh" "-L" "-b64K" "-t$($threads)" "-o4" "-w50" $tempFile ) try { & $diskspdExe @args | Tee-Object -FilePath $outFile $code = $LASTEXITCODE } finally { if (Test-Path $tempFile) { Remove-Item $tempFile -Force } } Write-Host "`n=== DISKSPD Results ===" if (Test-Path $outFile) { Get-Content $outFile } else { Write-Warning "No results file was produced (DiskSpd likely failed before writing output)." } if ($code) { exit $code } else { exit 0 }