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
  • Modify CSS to be easily customizable
    1 Posts | Last post June 09, 2015
    • It would be nice if the CSS were setup in a way that they styles could be easily modified from a single location instead of changing embedded styles for each item.  I find that certain font colors and sizes are hard to read and having a simple way to customize would be awesome.
  • Report on all domain hosts
    1 Posts | Last post June 09, 2015
    • Great script.  
      
      Feature request.
      - It would be helpful to have an option for finding all the Hyper-V hosts on a domain.
  • Awesome Script
    1 Posts | Last post June 08, 2015
    • Thank you very much for the hard work. Works perfect first time out on Server 2012 R2!!
  • VM Disk - reporting the volume the disk is on
    1 Posts | Last post June 05, 2015
    • Hi Serhat,
      
      Thanks for the excellent work on this script!
      
      I hoping you can assist me with the following:
      
      Is it possible to report what volumes specific disks of a VM are on and assign a color to show that it is part of one set of volumes vs another set of volume? I am looking to report on disk vs flash storage assigned to a VM.
      
      Thanks.
  • Get-VMProcessor in report ?
    1 Posts | Last post June 01, 2015
    • When you have hyperv nodes with different CPU's, it is essential to set this flag on every VM. Could you incorporate this in the report ? Not everyone wants this info, maybe an option if you want this in the output ?
  • Script failed to fetch the Disk information if VHDs are connected using IDE Controller
    5 Posts | Last post May 19, 2015
    • Hello Serhat,
      
      Thanks for the nice script.
      Can you please help me with one issue, I am not getting the Disk information in the Virtual Machine Table & when I checked I found that if the disks are connected using the SCSI Controller then your script works fine but does not provide the information when the same disks are connected to VMs using IDE Controller.
      
      Can you please give your valuable support in this point.
      Also, would it be possible to have an idea as to how I can fetch the reports of the Storage Pool.
      
      Regards,
      Ankur Dahiya
    • Hi,
      
      Get-HyperVReport.ps1 script collects VHD information of the VMs by using Get-VHD and collects Controller Type information by using Get-VMHardDiskDrive cmdlets. What is the result when you try to run the following commands directly on a Hyper-V host and can you see the information that vhd controller type?
      
      Get-VM -Name vm01 | Select-Object vmid | Get-VHD
      Get-VMHardDiskDrive -VMName vm01
      * vm01 is example.
    • When I run the command Get-VM -Name VM01 | Select-Object vmid | Get-VHD
      I am getting the below listed output:
      
      PS C:\Windows\system32> Get-VM -Name VM01 | Select-Object vmid | Get-VHD
      
      ComputerName            : HyperVHost01
      Path                    : D:\Virtual Machines\VM01\VM01.vhdx
      VhdFormat               : VHDX
      VhdType                 : Dynamic
      FileSize                : 46745518080
      Size                    : 128849018880
      MinimumSize             : 128847970304
      LogicalSectorSize       : 512
      PhysicalSectorSize      : 4096
      BlockSize               : 33554432
      ParentPath              :
      FragmentationPercentage : 2
      Alignment               : 1
      Attached                : False
      DiskNumber              :
      IsDeleted               : False
      Number                  :
      
      ComputerName            : HyperVHost01
      Path                    : D:\Virtual Machines\VM01\VM01_1.vhdx
      VhdFormat               : VHDX
      VhdType                 : Dynamic
      FileSize                : 3359637504
      Size                    : 26843545600
      MinimumSize             : 26841448448
      LogicalSectorSize       : 512
      PhysicalSectorSize      : 4096
      BlockSize               : 33554432
      ParentPath              :
      FragmentationPercentage : 1
      Alignment               : 1
      Attached                : False
      DiskNumber              :
      IsDeleted               : False
      Number                  :
      
      And the output when I run the second command is:
      PS C:\Windows\system32> Get-VMHardDiskDrive -VMName VM01
      
      VMName      ControllerType ControllerNumber ControllerLocation DiskNumber Path
      ------      -------------- ---------------- ------------------ ---------- ----
      VM01 IDE            0                0                             D:\Virtual Machines\VM01\VM0...
      VM01 SCSI           0                0                             D:\Virtual Machines\VM01\VM0...
      
      
    • I tried fetching the same report from our newly build cluster & there I can see all the VM Disks listed in the report.
      Both are Windows 2012 R2 Hyper V Cluster, the 2 differences that I could make out:
      1. Disk Path
      C:\ClusterStorage\volume1\VM01\ (New Cluster)
      D:\Virtual Machines\VM01\       (Old Cluster)
      
      2. In Old Cluster VM Disk hosting OS is connected using IDE Controller
         In New Cluster All Disks of the VMs are connected using SCSI
      
      I tried to run the commands from your script that are used to fetch the information from the cluster in a similar way using PS ISE & there I see that the variable $VmDisks has the correct values but I dont know why it is hitting NULL while running in the script. I tried to publish the value of $VmDisks while running the script & found that there is no value assigned to the variable $VmDisks after the command $vmDisks = Get-VHD -ComputerName HyperVHost01 -VMId 81b2b966-7ff1-4e8e-bf1c-434p62b71d9m
      
      But when I tried to run the custom script against the new cluster to see if the variable $VmDisks gets the value, it does & report comes out okay.
    • Below are the commands from your script I used to come to this conclusion: (on Old Cluster)
      $VMs = Get-VM -ComputerName OldCluster01
      PS C:\Windows\system32> $VMs
      
      Name State   CPUUsage(%) MemoryAssigned(M) Uptime      Status
      ---- -----   ----------- ----------------- ------      ------
      VM01 Running 6           8192              16.00:04:40 Operating normally
      VM02 Running 0           4096              16.00:01:54 Operating normally
      VM03 Running 0           16384             4.01:54:45  Operating normally
      VM04 Running 0           8192              16.00:01:35 Operating normally
      VM05 Off     0           0                 00:00:00    Operating normally
       
      $vmDisks = Get-VHD -ComputerName OldCluster01 -VMId 3e9c683b-c549-7777-8353-51c0d50f2469
      
      PS C:\Windows\system32> $vmDisks
      
      ComputerName            : OldCluster01
      Path                    : D:\Virtual Machines\VM01\VM01.vhdx
      VhdFormat               : VHDX
      VhdType                 : Dynamic
      FileSize                : 46745518080
      Size                    : 128849018880
      MinimumSize             : 128847970304
      LogicalSectorSize       : 512
      PhysicalSectorSize      : 4096
      BlockSize               : 33554432
      ParentPath              :
      FragmentationPercentage : 2
      Alignment               : 1
      Attached                : False
      DiskNumber              :
      IsDeleted               : False
      Number                  :
      
      ComputerName            : OldCluster01
      Path                    : D:\Virtual Machines\VM01\VM01_1.vhdx
      VhdFormat               : VHDX
      VhdType                 : Dynamic
      FileSize                : 3359637504
      Size                    : 26843545600
      MinimumSize             : 26841448448
      LogicalSectorSize       : 512
      PhysicalSectorSize      : 4096
      BlockSize               : 33554432
      ParentPath              :
      FragmentationPercentage : 1
      Alignment               : 1
      Attached                : False
      DiskNumber              :
      IsDeleted               : False
      Number                  :
      
      I am really confused now. Please help.
  • Execution Error.
    5 Posts | Last post May 19, 2015
    • [INFO]    - 02:42:05 - Started! Hyper-V Reporting Script (Version 1.5)
      [INFO]    - 02:42:08 - Logging started: C:\\ScriptLog.txt
      [ERROR]   - 02:42:11 - Hyper-V target parameter is missing. Use -Cluster or -VMHost parameter to define target.
      [WARNING] - 02:42:11 - For technical information, type: Get-Help .\Get-HyperVReport.ps1 -examples
      [ERROR]   - 02:42:11 - Script terminated!
      
      I run the powershell on Windows 8.1 with Hyper-V. I have no idea what is going on.
      
      Please help.
    • PS C:\> .\Get-HyperVReport.ps1 -VMHost Host1
      [INFO]    - 10:33:00 - Started! Hyper-V Reporting Script (Version 1.5)
      [INFO]    - 10:33:03 - Logging started: C:\\ScriptLog.txt
      [INFO]    - 10:33:06 - Checking prerequisites to run script on the HP...
      [INFO]    - 10:33:08 - Checking prerequisites for standalone Hyper-V host(s) reporting...
      [ERROR]   - 10:33:39 - HOST1: The RPC server is unavailable. (Exception from HRESULT: 0x800706BA)
      [WARNING] - 10:33:42 - No valid server for reporting.
      [ERROR]   - 10:33:42 - Script terminated!
    • First error : You must use -Cluster or -VMHost parameter to define target Hyper-V cluster or standalone host.
      
      Second error : The Hyper-V cluster or Host name may be incorrect or really it could not be reached.
    • Serhat AKINCI - please tell us exactly where to put the -Cluster or _VMHost parameter to definte the target cluster or host. 
      
      We hardly know anything about Hyper-V or your script. Where EXACTLY do these parameters go in the script? What line of text? Do we need to know the name of our cluster?
    • You must run the script using the following parameter:
      Get-HyperVReport.ps1 -Cluster yourhyperVclusterName
  • report display and email
    4 Posts | Last post May 14, 2015
    • Very good script and job to easily report HV environnement.
      
      I have two errors:
      
      1 - Once transmitting report by email, it arrives as only chinese chars. Our mail server is currently EXCH2003.
      
      2- Virtual Machines chart doesn't display correctly. Each VM are notified but the chart starts normally for the first VM and on second line for the next VMs, it adds new columns and so on.
      
      VM1
      empty columns - VM2
      empty columns - empty columns - VM3
      ......
      
      Any ideas?
      
      regards
      
    • Problem about email and asian chars are only when sending email to a public folder @. When directly to MB it works.
    • Finally, the Virtual machines Charts displays well in Google Chrome and IE. Not in Firefox
    • An interesting case :) Thanks for feedback.
  • A quick fox for you and SOFS Reporting
    2 Posts | Last post March 30, 2015
    • Best Script I have found of this type, I appreciate the work you have done!
      
      I found a quick fix for you.
      When doing a Cluster report the Cluster Name "HVCluster" was hard coded.
      I made the following change to Line 3332 of version 1.5:
      <h2>Cluster Overview <span style=""font-size:16px;color:#BDBDBD"">(" + $Cluster + ")</span></h2><br>
      
      Also I would like to up-vote and ask about the SMB/SOFS volume reporting.
      All of my recent implementations have been Storage Spaces, SOFS, Hyper-V Clusters and VMM.
      Can you give a rough idea of time frame and/or complexity of this?
      
    • I did potentially find some of the solution.
      By enabling Constrained Delegation, in AD, on each Host in a hyper-v cluster for cifs (SMB) on the SOFS cluster service name, the detail list of VM's contains the vhd(x) info but, the Clustered Disk/Volumes section of the report is still blank.
  • Multi Cluster in a report
    3 Posts | Last post March 20, 2015
    • Hi,
      
      Thank you for this script which is awesome :). However I would like a single report from several Hyper-V Clusters. Do you think it is possible to indicate an array for the -Cluster parameter and run the report on each cluster ?
      
      Thanks in advance.
      
      Romain.
    • Hi Romain, the -Cluster parameter supports only one Hyper-V Cluster for this version. May be in the feature releases I will implement multiple Hyper-V Cluster reporting.
    • This would be useful especially querying a scvmm installation.
81 - 90 of 101 Items