Hyper-V Reporting Script (Powershell & HTML)

It can be difficult to monitor and assess resources in large Hyper-V environments. This Powershell based script helps you to understand virtualization inventory, capacity and general resource availability in your Standalone or Clustered Hyper-V Environment.

 
 
 
 
 
4.9 Star
(96)
29,473 times
Add to favorites
Servers
3/5/2015
E-mail Twitter del.icio.us Digg Facebook
Sign in to ask a question


  • Update Hyper-V Server Cluster 2016
    1 Posts | Last post April 05, 2019
    • The best script ever.
      
      Sad that not received updates more.
      
      I really need this for Server 2016.
      
  • Running from remote machine
    1 Posts | Last post April 05, 2019
    • I am running the script from a remote machine that has Hyper-V powershell enabled. When it starts gathering Hyper-V Host info this is what I see:
        Get-VMHost : Hyper-V Management Tools could not access an expected WMI class on computer "remotecomputer" at C:\users\userid\documents\Get-HyperVReport.ps1:1357 char:17
      
      What modifications do I need to make to the script so it does not do this?
      
  • I fixed "InvalidData: (:) [Get-VHD]" for Server 2016
    2 Posts | Last post March 09, 2019
    • I fixed this problem for Server 2016:
      
      At C:\adminscripts\get-hypervreport.ps1:2248 char:83
      + ...     $vmDiffDisk = Get-VHD -ComputerName $VMHostItem -Path $parentPath
      +                                                               ~~~~~~~~~~~
          + CategoryInfo          : InvalidData: (:) [Get-VHD], ParameterBindingValidationException
          + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Vhd.PowerShell.Cmdlets.GetVHD
      
      
      Will Serhat please respond? I don't want to post the fix "just like that" without consent.
      
      regards,
      
      Joachim Otahal
    • just give it to us please!? :D
  • HELPPPP!!!! Shared VHD!!!!!!!!!!!!!!!!!!
    1 Posts | Last post December 27, 2018
    • Hello,
      
      I think that your script don't care about shared VHD.
      
      
      On my cluster I've 4 Vm that shared 10 VHD (This VHD can growth to 2.5 Tb). The dashboard report that the CSV here are the shared VHD can get over 10 TB. Sou I think that the script accumulate the information to this shared VHD 4 times.
      
      Can you check please?
  • Adding a feature
    4 Posts | Last post October 04, 2018
    • I have a question or request, but before that, this script ROCKS!!  I had a nice one that I build as well, but this has way more detail...excellent work.  I modified yours to automatically email this to my team weekly, and have it set to email as an HTML instead of attaching the HTML file.  Looks great.
      
      Anyway, I was wondering how hard it would be to have the disks sizes listed as a column for the Virtual Machines.  What I mean is this, in your report, It inventories the VMs and lists checkpoints (Yes/ NO) and then will list all the disks, and checkpoints with size for each.  I would like a column that takes the sizes of all that and gives me a SUM total size for the actual spaced used.
      
      The reason is so that if a VM is allocated 120GB disk and used is 90GB, but the VM has 4 Checkpoints all at 90GB, then the actual storage consumed is 450GB.  This is a major blind spot for most storage admins and could cause VM corruption as well.
      
      Is there a Way to do this?
    • hey robert, could you tell me how you modified the script that it sends the report directly as html, i have also tried it but without luck...
    • Hi, Robert, could you tell me too, how did you modified the script that sends the report directly as html in body in e-mail.
      Thanks !
    • Hi Guys,
      
      I am no expert on powershell but I managed to get the HTML into the body of the email by adding the below into the script.
      
      
          $BodyReport = Get-Content "$ReportFile" -Raw
          Send-MailMessage	            -To		"youremail@address.com" `
      		 	            -Subject 	"Hyper-V Environment Report" `
      			            -From 		"HyperV_Report@mwuk.com" `
                                          -Attachments 		"$ReportFile" `
      			            -SmtpServer 	"smtp.address.com" `
      			            -BodyAsHtml	-Body $BodyReport
      
      
      I kept the attachment included as it displays better in IE but you can remove that by deleting the -Attachments line.
      
      You do not need to run the script with the -sendemail prem as it will be hard coded into the script now.
      
      Cheers
      
      Lance
      
  • HPV 2016?
    1 Posts | Last post September 10, 2018
    • Howdy,
      
      I made the change sabout the OS Detection but now I get spammed with the error below.  Anyone know an easy way to fix this?
      
      
      Get-VHD : Cannot validate argument on parameter 'Path'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again.
      At C:\adminscripts\get-hypervreport.ps1:2248 char:83
      + ...     $vmDiffDisk = Get-VHD -ComputerName $VMHostItem -Path $parentPath
      +                                                               ~~~~~~~~~~~
          + CategoryInfo          : InvalidData: (:) [Get-VHD], ParameterBindingValidationException
          + FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Vhd.PowerShell.Cmdlets.GetVHD
  • Can this be made compatible with windows 10 standalone host and Server 2016 hyperv standalone and cluster?
    1 Posts | Last post July 16, 2018
    • I havent tested it on the 2016 cluster as i am yet to build it but i would like it for  a windows 10 host so i can test on local.
  • You cannot call a method on a null-valued expression
    1 Posts | Last post June 15, 2018
    • great script!
      after several years using, a new deployment with 3 HV servers and the trid server shows, right after the Gathering Disk/Volume information...
      
      You cannot call a method on a null-valued expression.
      At C:\Users\administrator.EDUCA\Desktop\Get-HyperVReport.ps1:3144 char:17
      +                 $physicalDiskName = (($physicalDiskNameData | where{($_.Path).Pa ...
      + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull
      
      You cannot call a method on a null-valued expression.
      At C:\Users\administrator.EDUCA\Desktop\Get-HyperVReport.ps1:3161 char:17
      +                 $outPhysicalDiskName = $physicalDiskName.Replace("PHYSICALDRIVE" ...
      +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
          + FullyQualifiedErrorId : InvokeMethodOnNull
      
      
      any ideas?
  • Unable to run the script
    1 Posts | Last post June 07, 2018
    • Get-WindowsFeature : A parameter cannot be found that matches parameter name 'ComputerName'.
      At C:\TEMP\Scripts\Get-HyperVReport.ps1:885 char:41
      +                 if ((Get-WindowsFeature -ComputerName $env:COMPUTERNA ...
      +                                         ~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [Get-WindowsFeature], ParameterBindingException
          + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Windows.ServerManager.Commands.GetWindowsFeatureCommand
      
      Get-WindowsFeature : A parameter cannot be found that matches parameter name 'ComputerName'.
      At C:\TEMP\Scripts\Get-HyperVReport.ps1:911 char:45
      +                     if ((Get-WindowsFeature -ComputerName $env:COMPUT ...
      +                                             ~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [Get-WindowsFeature], ParameterBindingException
          + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Windows.ServerManager.Commands.GetWindowsFeatureCommand
      
      [INFO]    - 09:27:43 - BMSCLUSTER is accessible. Gathering Node information...
      [INFO]    - 09:27:46 - Checking prerequisites for Hyper-V Cluster reporting...
      Get-WindowsFeature : A parameter cannot be found that matches parameter name 'ComputerName'.
      At C:\TEMP\Scripts\Get-HyperVReport.ps1:1175 char:41
      +                 if ((Get-WindowsFeature -ComputerName $clusterOwnerHo ...
      +                                         ~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [Get-WindowsFeature], ParameterBindingException
          + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.Windows.ServerManager.Commands.GetWindowsFeatureCommand
  • DMZ / Linux Virtual Machines
    1 Posts | Last post May 24, 2018
    • Hi,
      
      DMZ or Linux machines are stated as offline, i believe because security reasons? How can we bypass this?
      
      Many thanks
1 - 10 of 100 Items