Skip to content

Instantly share code, notes, and snippets.

@JustinGrote
Created May 22, 2018 16:18
Show Gist options
  • Save JustinGrote/6300ef709b646c03d3d862bba1c4db7c to your computer and use it in GitHub Desktop.
Save JustinGrote/6300ef709b646c03d3d862bba1c4db7c to your computer and use it in GitHub Desktop.
Use the Commvault CVDiskPerf program to test all fixed mounted disks except C: and report their performance
$CVDiskPerfEXE = 'C:\Program Files\Commvault\ContentStore\Base\cvdiskperf.exe'
$LogOutputDir = "$Home\desktop"
$drivesToTest = get-volume | where drivetype -match 'fixed' | where driveletter | where driveletter -notmatch 'C' | sort driveletter
foreach ($driveItem in $drivesToTest) {
[string]$driveletter = $driveitem.driveletter
write-verbose "Testing Drive $driveletter"
write-progress "Testing Drive $driveletter"
$args = @()
$ARGS += "-SEQUENTIAL"
$args += "-PATH"
$args += $($driveletter + ':\')
$args += "-OUTFILE"
$args += "$LogOutputDir\$driveletter-perf.log"
$args
#The pipe to out-null makes it wait to complete, so we don't run perf tests concurrently
&'C:\Program Files\Commvault\ContentStore\Base\cvdiskperf.exe' $args | Out-Null
}
$DiskPerfRegex = '(\w.+?) *: (\w.+) *'
$results = Get-childitem $LogOutputDir/*-perf.log | foreach {
$diskPerfResultProps = [ordered]@{}
get-content $PSItem | foreach {
if ($PSItem -match $diskperfregex) {
$diskPerfResultProps.($Matches.1) = ($Matches.2)
}
}
$diskperfresultprops.DriveLetter = $diskperfresultprops.'Path Used' -replace '^(\w).*$','$1'
$diskperfresultprops.VolumeLabel = (Get-Volume $diskPerfResultProps.DriveLetter).filesystemlabel
[PSCustomObject]$diskPerfResultProps
}
$results | export-csv -NotypeInformation "$home\desktop\CVPerfResult-$(get-date -format 'yyyyMMdd-hhmmss').csv"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment