alanrenouf / vCheck-vSphere

vCheck Daily Report for vSphere
MIT License
733 stars 325 forks source link

109 Orphaned VMDK Files - Exclude Templates #413

Open mike9231 opened 8 years ago

mike9231 commented 8 years ago

This plugin is reporting .vmdk files associated with templates as being orphans. Is there any easy way to exclude templates from this check? Or better yet, to do the check against .vmtx files in addition to .vmx files.

Thanks!

notevenahint57 commented 8 years ago

To get around this I overread $FullVM in this plugin to include templates: $FullVM = Get-View -ViewType VirtualMachine

In 00 Conection Plugin for vCenter, $FullVM is initialized as such $FullVM = Get-View -ViewType VirtualMachine | Where {-not $_.Config.Template}

edybsd commented 8 years ago

Another way is adding the following line $arrUsedDisks += $VMTmpl | Get-HardDisk | %{$.Filename} below the line that reads $arrUsedDisks = $FullVM | % {$.Layout} | % {$.Disk} | % {$_.DiskFile} in 109 Orphaned VMDK Files.ps1