Get-VMCreationReport (modification of post by view diff)
embed code: <script type="text/javascript" src="http://PoshCode.org/embed/1679"></script>download | new post
Produces a report of the number of and names of VMs created broken down by month and year.
- # Report VMs created per month.
- # Before you begin run Alan's "Who Created that VM?" script.
- # http://www.virtu-al.net/2010/02/23/who-created-that-vm/
- function Get-VMCreationReport {
- Get-VM | Group {
- if ($_.CustomFields["CreatedOn"] -as [DateTime] -ne $null) {
- "{0:Y}" -f [DateTime]$_.CustomFields["CreatedOn"]
- } else {
- "Unknown"
- }
- }
- }
- # To create a CSV of this stuff try:
- # Get-VMCreationReport | select Count, Name, { $_.Group -as [String] } |
- # export-csv c:\report.csv -NoTypeInformation
Submit a correction or amendment below (click here to make a fresh posting)
After submitting an amendment, you'll be able to view the differences between the old and new posts easily.
PowerShell Code Repository