Get-VirtualDisk | Where-Object ResiliencySettingName -eq Parity

%3CLINGO-SUB%20id%3D%22lingo-sub-2183898%22%20slang%3D%22en-US%22%3EGet-VirtualDisk%20%7C%20Where-Object%20ResiliencySettingName%20-eq%20Parity%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2183898%22%20slang%3D%22en-US%22%3E%3CP%3EHello%20Geeks%2C%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EI'm%20not%20familiar%20with%20powershell%2C%20Can%20somebody%20help%20me%20to%20understand%20this%20command%20please.%20why%20and%20where%20and%20when%20this%20command%20will%20be%20used.%3C%2FP%3E%3CP%3E%3CSPAN%3E%22powershell.exe%20-ExecutionPolicy%20Restricted%20-Command%20%22%24Res%20%3D%200%3B%20%24VDisks%20%3D%20(Get-VirtualDisk%20%7C%20Where-Object%20ResiliencySettingName%20-eq%20Parity)%3B%20if%20(%24null%20-ne%20%24VDisks)%20%7B%20%24Res%20%3D%201%20%7D%3B%20Write-Host%20'Final%20result%3A'%2C%24Res%3B%3C%2FSPAN%3E%5D%22%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3CP%3EBest%20Regards%2C%3C%2FP%3E%3CP%3EKumar%3C%2FP%3E%3CP%3E%26nbsp%3B%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2183898%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EWindows%20PowerShell%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Occasional Visitor

Hello Geeks,

 

I'm not familiar with powershell, Can somebody help me to understand this command please. why and where and when this command will be used.

"powershell.exe -ExecutionPolicy Restricted -Command "$Res = 0; $VDisks = (Get-VirtualDisk | Where-Object ResiliencySettingName -eq Parity); if ($null -ne $VDisks) { $Res = 1 }; Write-Host 'Final result:',$Res;]"

 

Best Regards,

Kumar

 

1 Reply
This command will get all the Hyper-V virtual disk which have the ResiliencySettingName property is set to Parity, and if there were any returned value from the command, it would change the variable $Res value to 1
for the ResiliencySettingName result and meaning, you can see it over here in New-VirtualDisk
https://docs.microsoft.com/en-us/powershell/module/storage/new-virtualdisk?view=win10-ps



---------------
If this answer helped you, please don't forget to click on Best Response.