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)
30,929 times
Add to favorites
Servers
3/5/2015
E-mail Twitter del.icio.us Digg Facebook
  • Very Useful Script
    1 Posts | Last post March 09, 2017
  • Windows Server 2016 support
    1 Posts | Last post January 12, 2017
    • Hello
      
      I have the script as Mark Saddon1 said but still get incompatible error when I run it against a Win2016 Hyper-V cluster.(running it on a standalone Win2016 Hyper-V host works fine)
      
      <Mark Seddon1>
      In the file replace each instance of:
       if (($OsVersion -like "6.2*") -or ($OsVersion -like "6.3*"))
      with
       if (($OsVersion -like "6.2*") -or ($OsVersion -like "6.3*") -or ($OsVersion -like "10.0*"))
      </Mark Seddon1>
      
  • Problem with Active VHD
    1 Posts | Last post January 11, 2017
    • When I list ClusterDisks/Volume, I got 16 Active VHD, but this is not true, I have only 3 Active VHD and number under is incorrect (22,49TB* / 26,13TB*), because I have only 2TB on this VDH. Used Size, Free Size and Total Size is correct.
      Can you tell me what can be wrong?
  • Great script\report, could you update it please?
    1 Posts | Last post December 08, 2016
    • Please update it to support Server 2016 as user\Mark Seddon1 has answered few questions below.
      
      <Mark Seddon1>
      In the file replace each instance of:
      
      if (($OsVersion -like "6.2*") -or ($OsVersion -like "6.3*"))
      with
      if (($OsVersion -like "6.2*") -or ($OsVersion -like "6.3*") -or ($OsVersion -like "10.0*"))
      
      </Mark Seddon1>
      
      The other thing if you could add is for your script to import the Hyper-V and FailOverCluster powershell modules.  I didn't find it in the script, I found your prereq check for the management tools, but I didn't see where it actually imported the modules.
      
      sPrint -Type 5 -Message "$($env:COMPUTERNAME.ToUpper()): Hyper-V PowerShell Module is OK." -WriteToLogFile $True ; Import-Module Hyper-V
      
      sPrint -Type 5 -Message "$($env:COMPUTERNAME.ToUpper()): Failover Clustering PowerShell Module is OK." -WriteToLogFile $True ; Import-Module FailoverClusters
      
      Again, Great work on the scrip\report!!!
      
      THANKS!
  • I'm having some issues with this, help!! I'm getting information on the host only but it keep failing on the "Gathering VM Information".
    2 Posts | Last post December 08, 2016
    • Get-VMHost : A parameter cannot be found that matches parameter name 'ComputerName'.
      At C:\Hyper-V_Report\Get-HyperVReport.ps1:1356 char:29
      +     $vmHostGet = Get-VMHost -ComputerName $vmHostItem
      +                             ~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [Get-VMHost], ParameterBindingException
          + FullyQualifiedErrorId : NamedParameterNotFound,Get-VMHost
       
      Get-VM : A parameter cannot be found that matches parameter name 'ComputerName'.
      At C:\Hyper-V_Report\Get-HyperVReport.ps1:1357 char:25
      +     $vmHostVMs = Get-VM -ComputerName $vmHostItem
      +                         ~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [Get-VM], ParameterBindingException
          + FullyQualifiedErrorId : NamedParameterNotFound,Get-VM
      ......................................................................
      
      [WARNING] - 16:43:18 - CI7386: Does not have Virtual Machine.
      Get-VM : A parameter cannot be found that matches parameter name 'ComputerName'.
      At C:\Hyper-V_Report\Get-HyperVReport.ps1:1627 char:19
      +     $VMs = Get-VM -ComputerName $VMHostItem -ErrorVariable getVMerr -ErrorAction ...
      +                   ~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [Get-VM], ParameterBindingException
          + FullyQualifiedErrorId : NamedParameterNotFound,Get-VM
       
      Get-VMNetworkAdapter : The term 'Get-VMNetworkAdapter' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that 
      the path is correct and try again.
      At C:\Hyper-V_Report\Get-HyperVReport.ps1:1628 char:60
      +     $vNetworkAdapters = Get-VM -ComputerName $VMHostItem | Get-VMNetworkAdapter  ...
      +                                                            ~~~~~~~~~~~~~~~~~~~~
          + CategoryInfo          : ObjectNotFound: (Get-VMNetworkAdapter:String) [], CommandNotFoundException
    • You are importing the VMM(VirtualMachineManager) powershell module.  This script\report uses the Hyper-V(not VMM) and Fail Over Cluster powershell modules.  Don't import the VMM powershell module and only import the Hyper-V and FailOverCluster powershell modules and you'll be able to run the script\report.
      
      Import-Module Hyper-V, FailoverClusters
  • Windows 2016 Support?
    2 Posts | Last post November 21, 2016
    • This is a great script that we've been using for quite some time now. However, now that we've started upgrading to Windows Server 2016 the script doesn't detect that as a supported OS and the report stops.  Thank you in advance!
    • In the file replace each instance of:
      
      if (($OsVersion -like "6.2*") -or ($OsVersion -like "6.3*"))
      with
      if (($OsVersion -like "6.2*") -or ($OsVersion -like "6.3*") -or ($OsVersion -like "10.0*"))
  • Need information regarding Hyper-v script
    1 Posts | Last post September 30, 2016
    • Hello,
      
      We need on information regarding this script, actually we have 12 standalone hyper-v server in same domain and inside servers we have 2 virtual machine (One is DC & second is SCCM server).
      
      So could you please confirm can we use one script for all 12 servers or we can use only one server and add remaining servers in script. 
  • Such a great script
    2 Posts | Last post August 04, 2016
    • Thank you!
    • I'm having some issues with this, help!! I'm getting information on the host only but it keep failing on the "Gathering VM Information".
      
      [DEBUG]   - 03.Aug.2016 16:50:56 - ----- Start -----
      [INFO]    - 03.Aug.2016 16:50:56 - Logging started: C:\vReport\ScriptLog.txt
      [INFO]    - 03.Aug.2016 16:50:59 - Checking prerequisites to run script on the SCVMM...
      [DEBUG]   - 03.Aug.2016 16:50:59 - SCVMM: Operating system is supported as script runtime environment.
      [DEBUG]   - 03.Aug.2016 16:50:59 - SCVMM: Hyper-V PowerShell Module is OK.
      [INFO]    - 03.Aug.2016 16:50:59 - Checking prerequisites for standalone Hyper-V host(s) reporting...
      [DEBUG]   - 03.Aug.2016 16:51:05 - HOST1.LOCAL: Operating system version and Hyper-V role is OK.
      [INFO]    - 03.Aug.2016 16:51:05 - Available Hyper-V server(s) for reporting: HOST1.local
      [INFO]    - 03.Aug.2016 16:51:08 - Gathering Hyper-V Host information...
      [INFO]    - 03.Aug.2016 16:51:35 - Gathering Virtual Machine information...
      [ERROR]   - 03.Aug.2016 16:52:24 - HOST1.LOCAL: The destination host is not available. Specify another host and try the operation again.
      [WARNING] - 03.Aug.2016 16:52:24 - Gathering VM Information for 'HOST1.LOCAL' failed.
      [INFO]    - 03.Aug.2016 16:52:27 - Gathering Disk/Volume information...
      [INFO]    - 03.Aug.2016 16:52:28 - Writing output to file C:\vReport\HyperVReport-3Aug16-045055PM.html
      [INFO]    - 03.Aug.2016 16:52:28 - Report created successfully.
      [INFO]    - 03.Aug.2016 16:52:28 - Sending e-mail...
      [INFO]    - 03.Aug.2016 16:52:28 - E-mail has been sent to the address(es): (email address)
      [INFO]    - 03.Aug.2016 16:52:28 - Completed!
      [DEBUG]   - 03.Aug.2016 16:52:28 - ----- End   -----
  • Question about emailing standalone hyper-v server reports
    2 Posts | Last post July 18, 2016
    • Great script and report output - thank you!
      
      I am running into a problem with the script when I try to run it + email report for standalone hosts.  If I manually run the report I get the report output with no issues, but if I try to run the report and send to email recipients I get the error "-Cluster and -VMHost parameters can not be used together."
      
      Run the script and report output is successful:
      .\Get-HyperVReport.ps1 -VMHost HOST1,HOST2
      Command output:
      [INFO]    - 15:01:26 - Started! Hyper-V Reporting Script (Version 1.5)
      [INFO]    - 15:01:29 - Logging started: C:\Hyper-V_Report\ScriptLog.txt
      [INFO]    - 15:01:32 - Checking prerequisites to run script on the SERVERNAME...
      [INFO]    - 15:01:33 - Checking prerequisites for standalone Hyper-V host(s) reporting...
      [INFO]    - 15:01:41 - Available Hyper-V server(s) for reporting: HOST1 HOST2
      [INFO]    - 15:01:44 - Gathering Hyper-V Host information...
      [INFO]    - 15:02:28 - Gathering Virtual Machine information...
      [INFO]    - 15:06:25 - Gathering Disk/Volume information...
      [INFO]    - 15:06:26 - Writing output to file C:\Hyper-V_Report\HyperVReport-15Jul16-030129PM.html
      [INFO]    - 15:06:26 - Report created successfully.
      [INFO]    - 15:06:26 - Completed!
      
      Run the script with email parameters and I get an error:
      .\Get-HyperVReport.ps1 -VMHost HOST1,HOST2 -SendMail $true -SMTPServer SERVERNAME -MailFrom sending_user@validdomain.com -MailTo recipient_user1@validdomain.com,recipient_user2@validdomain.com,recipient_user3@validdomain.com
      Command output:
      [INFO]    - 14:39:57 - Started! Hyper-V Reporting Script (Version 1.5)
      [INFO]    - 14:40:00 - Logging started: C:\Hyper-V_Report\ScriptLog.txt
      [ERROR]   - 14:40:03 - -Cluster and -VMHost parameters can not be used together.
      [WARNING] - 14:40:03 - For technical information, type: Get-Help .\Get-HyperVReport.ps1 -examples
      [ERROR]   - 14:40:03 - Script terminated!
      
      Thank you in advance for any assistance!
    • I guess all it takes is to post the question to fix your own problem :)  I recreated the folder structure and now it works.
  • feature request
    1 Posts | Last post July 14, 2016
    • hi,
      
      thank you for the script, very nice.
      Would it be possible to add "Startup | Min | Max | Assigned" Memory to the Cluster Node Table please?
      
      thank you
51 - 60 of 101 Items