VMware Cloud Community
IKirill
Enthusiast
Enthusiast
Jump to solution

Check all disks vm have EagerZeroedThick format

Hi!

i start write small script to check, that all disks at vm have EagerZeroedThick format.

And add this to expression cell.
But I am sure that the script is incorrect:

Get-Vm -Location myvms | select @{N="VM Name";E={$_.Name}},
@{N="Storformat";E={ if ((Get-HardDisk $_).storageformat -eq 'EagerZeroedThick') {Write-Host "ALL EagerZeroedThick"} else {NOT ALL disks in EagerZeroedThick format} }}
Reply
0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

Try something like this

Get-Vm -Location myvms |
Select Name,
 @{N='StorFormat';E={
   if((Get-HardDisk -VM $_ | ForEach-Object -Process {
     $_.storageformat -eq 'EagerZeroedThick'
   }) -contains $false){'Not all disks in EagerZeroedThick'}
   else{'All EagerZeroedThick'}
 }}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

Reply
0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

Try something like this

Get-Vm -Location myvms |
Select Name,
 @{N='StorFormat';E={
   if((Get-HardDisk -VM $_ | ForEach-Object -Process {
     $_.storageformat -eq 'EagerZeroedThick'
   }) -contains $false){'Not all disks in EagerZeroedThick'}
   else{'All EagerZeroedThick'}
 }}


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

Reply
0 Kudos
IKirill
Enthusiast
Enthusiast
Jump to solution

Thank you LucD!

Reply
0 Kudos