function RefreshStorageJobStatus () { while($true) { Get-VirtualDisk | ft; Write-Host "-----------"; Get-StorageJob;Start-Sleep -s 1;Clear-Host; } }
Enter the above in powershell on one line. Then enter "RefreshStorageJobStatus" to start the script. The output should look similar to the following and refresh every second:
Name IsBackgroundTask ElapsedTime JobState PercentComplete BytesProcessed BytesTotal
---- ---------------- ----------- -------- --------------- -------------- ----------
Repair True 00:00:13 Suspended 0 0 7784628224
Repair True 00:00:06 Suspended 0 0 7784628224
FriendlyName ResiliencySettingName OperationalStatus HealthStatus IsManualAttach Size
------------ --------------------- ----------------- ------------ -------------- ----
vd01 OK Healthy True 1 TB
vd03 Degraded Warning True 1 TB
vd02 Degraded Warning True 1 TB
vd04 OK Healthy True 1 TB
You can press ctrl-c to stop the execution.
Update 8/16/2018: Here is an updated RefreshStorageJobStatus function that shows the bytes processed and bytes remaining in gigabytes instead of bytes:
function RefreshStorageJobStatus () { while($true) { Get-VirtualDisk | ft; Write-Host "-----------"; Get-StorageJob | Select Name,IsBackgroundTask,ElapsedTime,JobState,PercentComplete,@{label=”BytesProcessed (GB)”;expression={$_.BytesProcessed/1GB}},@{label=”Total Size (GB)”;expression={$_.BytesTotal/1GB}} | ft;Start-Sleep -s 1;Clear-Host; } }
Run the same as before, enter "RefreshStorageJobStatus" to start the script. Output looks like this:
FriendlyName ResiliencySettingName OperationalStatus HealthStatus IsManualAttach Size
------------ --------------------- ----------------- ------------ -------------- ----
test2dfsb Incomplete Warning True 3.5 TB
vd02b {Degraded, Incomplete} Warning True 1 TB
vd01b {Degraded, Incomplete} Warning True 1 TB
-----------
Name IsBackgroundTask ElapsedTime JobState PercentComplete BytesProcessed (GB) Total Size (GB)
---- ---------------- ----------- -------- --------------- ------------------- ---------------
Repair True 00:00:41 Suspended 0 0 70.25
Repair True 00:00:01 Suspended 0 0 122.25
nice script! allowed me to watch a very scary repair!
ReplyDelete