Get the list of all VMs in VMM server and enumerate their virtual hard drives

The following tool will get the list of all virtual machines in System Center Virtual Machine Manager deployment or all virtual machines in a particular VMM Host Group, then the tool will enumerate all the virtual hard disks and send you a nice formatted HTML email report.

5 Star
2,996 times
Add to favorites
System Center
E-mail Twitter Digg Facebook
  • Emailing of Report
    3 Posts | Last post September 02, 2019
    • Hi, I am having difficulty getting the report to be emailed. The report generates but does not get emailed. Is there a way of getting the report saved to the local computer.
    • Hello Adrian,
      Yes, you can save the report locally on the computer.
      Please add the following line at the end of the script under ($WarningVMs -and $CriticalVMs) and ($WarningVMs -or $CriticalVMs).
      $report | Out-File C:\HVReplica.html
      If ($WarningVMs -and $CriticalVMs) {
           $email.Subject = "Virtual Machines Replication in Warning & Critical State! $($filedate)"
           Write-Verbose "Finalizing Report"
           $report +=  "</body></html>"
           Write-Verbose "Sending e-mail"
           $email.body = $report 
           $report | Out-File C:\HVReplica.html
          Elseif ($WarningVMs -or $CriticalVMs) {
           Write-Verbose "Finalizing Report"
      	 $report +=  "</body></html>"
           Write-Verbose "Sending e-mail" 
           $email.body = $report
           $report | Out-File C:\HVReplica.html
    • To anyone coming across this in more recent times here is what I did to update latest script version to only save report to disk instead of emailing it out:
      Final section # Send Email comment out entire section except the "Write-Verbose" and add the Out-File supplied by Charbel above.
      # Send Email
      Write-Verbose "Sending Report"
      #$email = new-object Net.Mail.MailMessage
      #$email.Priority = [System.Net.Mail.MailPriority]::High
      #$email.Subject = "Virtual Machines and Virtual Hard Disks Report: $($filedate)"
      #$email.From = new-object Net.Mail.MailAddress($FromEmail)
      #$email.IsBodyHtml = $true
      #$email.Body =  $report
      #Use your own writeable path to output file below
      $report | Out-File C:\scripts\output\HVReplica.html
      Hope this helps someone
  • Resouses
    1 Posts | Last post August 22, 2018
    • Whether probably to finish a script for gathering the information about VM (the central processor, RAM, a network)?
  • Improvments
    1 Posts | Last post February 27, 2018
    • This is a great scrip, but have two issues
      1. I would like to select a Host Group to run the script against. VMM has many host groups and not sure which one is failing the script
      2. Can the script log an error and continue if an object cannot be retieved, see below?
      Get-SCVirtualHardDisk : VMM cannot find a required object. (Error ID: 20404)
      Ensure the object is valid, and then try the operation again.
      At C:\temp\Scripts\Get-SCVMVirtualDisk.ps1:116 char:68
      + $SCVHDs = Get-SCVirtualMachine $SCVM.Name -VMHost $SCVM.HostName | Get-SCVirtual ...
  • Can the script be modified to only show VM`s without SCSI controllers?
    1 Posts | Last post June 28, 2016
    • Good day
      Thank you very much for this script it really helped me a lot.
      I would like to find out if your script can be modified to only show servers that does not have SCSI controller's installed? or maybe there is such a script out there already?
      Michael Erasmus