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
  • "Does not have Virtual Machine" errors
    6 Posts | Last post March 12, 2015
    • Thanks for the script. I have been trying to run it but all I get are tons of errors like this:
      
      Get-SCVirtualMachine : A parameter cannot be found that matches parameter name 'ComputerName'.
      At C:\Get-HyperVReport.ps1:1206 char:25
      +     $vmHostVMs = Get-VM -ComputerName $vmHostItem
      +                         ~~~~~~~~~~~~~
          + CategoryInfo          : InvalidArgument: (:) [Get-SCVirtualMachine], ParameterBindingException
          + FullyQualifiedErrorId : NamedParameterNotFound,Microsoft.SystemCenter.VirtualMachineManager.Cmdlets.GetVMCmdlet
      
      I suspect it is caused by System Center Virtual Machine Manager running on that host.
    • This is an interesting situation.
      
      I see there is an error when I review the output "Get-SCVirtualMachine : A parameter cannot be found......" But Get-SCVirtualMachine is a System Center Virtual Machine Manager cmdlet. In other words, this script does not use "Get-SCVirtualMachine" cmdlet.
      
      Which parameters (and value) do you use to run Get-HyperVReport.ps1 ?
    • Also you can try run the Get-HyperVReport.ps1 in a new Powershell window.
    • Hi Serhat,
      
      I had the same problem. I was running the script in a VMM command shell. When I run the script in a normal Powershell window it's working fine :-)
      
      Thanks,
      Arno
    • I check this situation. This is not a bug, this is the default behavior of SCVMM powershell module imported sessions :)
      
      When you run Hyper-V powershell cmdlets in the "virtualmachinemanager" module imported powershell window, some commands maybe replaced with SCVMM commands(For eg: Get-VM replaces with Get-SCVirtualMachine). This behavior may occur on the VMM Console installed and virtualmachinemanager powershell module imported machines. You can use Get-Module cmdlet to check which modules are imported in a powershell window. 
      
      Hyper-V Reporting Script uses some Clustering and Hyper-V powershell cmdlets like "Get-VM". If you run the script in a powershell window where virtualmachinemanager module is not imported, Get-HyperVReport.ps1 script works fine.
      
    • I ran into this issue as well.  It's definitely the VMM cmdlets that get in the way.  "Get-VM" is an alias for "Get-SCVirtualMachine", which has different arguments.  However, I was able to get around this particular point by replacing "-ComputerName" with "-VMhost".  There are other script edits needed to make this run with VMM, but that's the only one I noted.
  • Windows Server 2008R2 Cluster
    2 Posts | Last post February 16, 2015
    • Hi, your script is great! But as we still have 2008R2 Cluster, is there anything similar for those Clusters, or is it possible to support 2008R2 in your script?
      Thanks,
      Oliver
    • This version supports just Windows Server 2012 Hyper-V and R2 Hyper-V. When the RTM version of Windows Server vNext is released, the script will support. But Windows Server 2008 R2 Hyper-V will not be supported. 
  • Extended Replica health info
    2 Posts | Last post January 30, 2015
    • Thanks for the great script, it works so well and the report is great.
      I don't see any information regarding the extended replica health, is this something that can be easily added?
      If i run get-vmreplication the extended replica info is there.
    • Yes, this is possible. I added the feature list for next release. Thanks for feedback.
  • VHD Path and settings
    2 Posts | Last post January 30, 2015
    • Hi Serhat,
      
      Great Script !! Congratz
      
      Can you add the VHD Path into this report, its very important on big cluster or many nodes know where the VHD disk is located ?
      
      Example:
      
      Physical Disk | Path | CSV | CSV Path | 
      No               No    Yes   C:\ClusterStorage\Volume"x"\ServerVHD-OS.vhdx |
      Yes              C:\Hyper-V\Server\Virtual Hard Disk\ServerVHD-Data.vhdx | No | No
      
      And
      
      If you could expand each VM could and see each settings (NICs | State | vFC | State | vSwitch) basic information about each one.
      
      Thanks a lot!!
        
    • You can see full VHD path info on the VHD file name (as a tooltip) in report.
      
      I'm working on virtual network reporting and it may be available in the next release... Thanks for feedback.
  • Missing disk information on standalone server
    2 Posts | Last post January 28, 2015
    • The report is indicating that there are no disks on two of my 2012 guests. I ran these two commands on the servers in question:
      
      gwmi Win32_DiskDrive | select DeviceID,SerialNumber
      gwmi -Namespace root\Microsoft\Windows\Storage -Class MSFT_Disk | select SerialNumber
      
      The serial numbers come back blank for the two servers. 
      
      Is there something I can do to fix this?
      
      Unrelated, will there be support for 2008R2 servers in a future version? 
    • Hi, which version are you using of Get-HyperVReport.ps1? You can try the 1.1 version.
  • SOFS?
    4 Posts | Last post January 22, 2015
    • Great script.
      Any chance of adding SOFS storage reporting?
    • Hi Nick, I'm working on this feature and it may be available in the next "major" release :)
    • Thanks for working on this. We use SOFS and FC - so the addition of SOFS reporting will make this a "must have".
    • Ditto for incorporating SOFS into this script. It is a great script on it's own, but once the SOFS component is added it will be over the top. Thanks again!!
      
      Ron
  • Does not have a virtual disk Issue
    3 Posts | Last post January 21, 2015
    • Good Day, 
      Great script. Having one problem, running on a 2012 Cluster using shared SAS storage cluster all guests come back with "Does not have a virtual disk" in report. Running against individual non clustered hosts with local storage works correctly. 
    • Get-HyperVReport.ps1 script collects VHD information of the VMs by using Get-VHD powershell cmdlet.
      
      What is the result when you try to run Get-VHD cmdlet directly on a Cluster node?
      
      For example: Get-VHD -VMId (Get-VM -VMName exVM1).VMId
      *You should change the VM name "exVM1"
    • Actually, never mind, it is working perfectly now. Thanks!
  • Parameter SendMail - cannot convert value
    4 Posts | Last post January 14, 2015
    • Script is reporting that it cannot process the value on parameter 'SendMail' as it cannot convert value "System.String" to type "System.Boolean".  I tried passing both -SendMail $true and -SendMail 1 but neither work.  What should I do?
    • -SendMail parameter is activates the e-mail sending feature and accept only Boolean values and numbers, such as $true, $false, 1 or 0. And of course with the correct spelling...
      
      Correct Usage (is considered as System.Boolean value)
      -SendMail $true
      or
      -SendMail 1
      
      Incorrect Usage (is considered as System.String value)
      -SendMail "$true"
      -SendMail "1"
      
      -SendMail '$true'
      -SendMail '1'
      
      * String was not recognized as a valid Boolean.
    • I'm having this issue too, and i'm not putting the value in quotes.  
      
      When you try to run the script from task scheduler and execute it as a trigger with powershell.exe as program and the parameters you want in the parameters field, this error comes up. 
      
      I'm not sure how to work around it other than editing your script and changing the default parameter value to $true if i want to send mail.
    • Can you try using the following steps on a Windows task?
      
      In the Actions tab of a Windows task;
      Action: Start a program
      Program/script: powershell
      Add arguments (optional): -c "c:\tools\Get-HyperVReport.ps1 -Cluster hvcluster -SendMail $true -SMTPServer 10.29.5.111 -MailTo recipient@hyperv.report -MailFrom sende@hyperv.report"
      Start in (optional): c:\tools
      
      *In this example, Get-HyperVReport.ps1 is in the c:\tools folder.
  • Can someone give me some pointers on how to schedule this in Task Scheduler to report on 10 Hosts please?
    4 Posts | Last post January 14, 2015
    • I need to schedule this to run automatically to report on 10 hosts (for ease of typing I've only put 4 in the example), but am having issues getting it to work. I'm attempting to use:
      
       c:\windows\system32\windowspowershell\v1.0\powershell.exe
      
      and passing arguments of:
      
       -noprofile -executionpolicy bypass -command "& 'C:\Get-HyperVReport.ps1' '-VMhost Host1, Host2, Host3, Host4'"
      
      This results in the script telling me the Cluster Name is wrong, which I get it will be as we don't have a cluster, so my Host names are being passed to the Cluster Name parameter.
      
      For background I started out using the normal method instead of -command and didn't get any joy on that either.
      
      I'm not sure how to make sure that this gets passed to the correct parameter, as I've not had much experience is scheduling PowerShell scripts. Can anyone give me some pointers.
      
      My lack of knowledge not withstanding - this is a fantastic script and is just what I've been looking for!
    • update - using arguments of -command "& '<path to script>' $vmhost= host1, etc"
      
      results in the message that I cannot use -Cluster and -VMHost at the same time.
    • I appear to have answered my own question - sorry for being a pain!
      
      -command "& '<path to script>' -VMHost Host1, Host2, Host3"
      
      I was almost there with my first attempt.
    • You can also use the following steps to periodically reporting via a scheduled windows task.
      
      Action: Start a program
      Program/script: powershell
      Add arguments (optional): -c "c:\tools\Get-HyperVReport.ps1 -Cluster hvcluster -SendMail $true -SMTPServer 10.29.5.111 -MailTo recipient@hyperv.report -MailFrom sende@hyperv.report"
      Start in (optional): c:\tools
      *In this example, Get-HyperVReport.ps1 is in the c:\tools folder.
      
      And second one, -Cluster and -VMHost parameters can not be used together. For technical information, type: Get-Help .\Get-HyperVReport.ps1 -examples
  • Added two lines to the script
    3 Posts | Last post January 13, 2015
    • So i dont have to click on the Report to open it.
      Maybe you could integrate it ?
      
      After line 2591:
              $mailMessage.Body = $outFullHTML
              $mailMessage.IsBodyHtml = $True
      
      Very nice script so far !
    • Hi,
      If you have time for this, to extend the Mail Feature. So can I customize the sender
      
      $username = "account@myprovider.com"
       $password = ConvertTo-SecureString "P@ssw0rd" -AsPlainText -Force
       $creds = New-Object System.Management.Automation.PSCredential ($username, $password)
       
      Thanks
      Reinhard
    • Hi Marcus, It's possible. I'll release a new minor update (v1.1) within a few days which fixes several issues and some minor improvements (including this). Thanks for feedback.
91 - 100 of 101 Items