Skip to content

Instantly share code, notes, and snippets.

@mczerniawski
Created December 2, 2017 22:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mczerniawski/42606920821c93ab64fe98c3998e3219 to your computer and use it in GitHub Desktop.
Save mczerniawski/42606920821c93ab64fe98c3998e3219 to your computer and use it in GitHub Desktop.
$StorageJobs = Get-StorageJob
foreach ($stJob in $StorageJobs) {
foreach ($jobObjectID in ($stJob | Select-Object -ExpandProperty ObjectId)) {
$objectID = $jobObjectID | Select-String -Pattern '([A-Za-z0-9]{8}\-?){1}([A-Za-z0-9]{4}){1}' -AllMatches |
Select-Object -ExpandProperty Matches |
Select-Object -ExpandProperty Value -Last 1
$vdisk = Get-VirtualDisk | Where-Object {$_.ObjectId -match $objectID}
[PSCustomObject]@{
VirtualDiskName = $vdisk.FriendlyName
HealthStatus = $vdisk.HealthStatus
JobState = $stJob.JobState
PercentComplete= $stJob.PercentComplete
Name = $stJob.Name
BytesProcessed = $stJob.BytesProcessed
BytesTotal = $stJob.BytesTotal
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment