diff --git a/Plugins/60 VM/60 Powered Off VMs.ps1 b/Plugins/60 VM/60 Powered Off VMs.ps1 index 77add5d8..8b67a79d 100644 --- a/Plugins/60 VM/60 Powered Off VMs.ps1 +++ b/Plugins/60 VM/60 Powered Off VMs.ps1 @@ -3,7 +3,10 @@ $IgnoredVMs = "Windows7*" # End of Settings -$DecommedVMs = ($VM | Where { $_.PowerState -eq "PoweredOff"} | Where {$_.Name -notmatch $IgnoredVMs} | Select Name, LastPoweredOffDate) | Sort-Object -Property LastPoweredOffDate +$DecommedVMs = @($VM | + Where-Object {$_.ExtensionData.Config.ManagedBy.ExtensionKey -ne 'com.vmware.vcDr' -and $_.PowerState -eq "PoweredOff" -and $_.Name -notmatch $IgnoredVMs} | + Select-Object -Property Name, LastPoweredOffDate | + Sort-Object -Property LastPoweredOffDate) $DecommedVMs $Title = "Powered Off VMs" @@ -11,5 +14,5 @@ $Header = "VMs Powered Off - Number of Days" $Comments = "May want to consider deleting VMs that have been powered off for more than 30 days" $Display = "Table" $Author = "Adam Schwartzberg" -$PluginVersion = 1.1 +$PluginVersion = 1.2 $PluginCategory = "vSphere"