Skip to content

Commit

Permalink
Merge pull request #305 from rvdnieuwendijk/patch-6
Browse files Browse the repository at this point in the history
Update 60 Powered Off VMs.ps1
  • Loading branch information
Sneddo committed Jan 1, 2015
2 parents 617e20c + 19f4b99 commit 420fbe1
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Plugins/60 VM/60 Powered Off VMs.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,16 @@
$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"
$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"

0 comments on commit 420fbe1

Please sign in to comment.