/Diag-V

Hyper-V PowerShell Diagnostic Utility

Primary LanguagePowerShellMIT LicenseMIT

Diag-V - ARCHIVED

Minimum Supported PowerShell Version downloads Cross Platform

master Enhancements
Build Status Build Status

This project is no longer actively maintained

04/03/2022 - I have decided to archive this project. The module is also now unlisted on the PSGallery.

If you are interested in picking up this project, feel free to reach out to me on Twitter.

Synopsis

Diag-V is a read-only PowerShell module containing several Hyper-V related diagnostics to assist with managing standalone Hyper-V Servers and Hyper-V clusters.

Diag-V PS Word Cloud

Description

Diag-V is a PowerShell Module collection of primarily Hyper-V diagnostic functions, as well as several windows diagnostic functions useful when interacting with Hyper-V servers. Hyper-V functions are cable of automatically detecting if being run against a standalone or Clustered Hyper-V instance. If a cluster is detected, data will be gathered from all nodes in the cluster. Diag-V is a read only, data gathering module that can provide rapid insight into your Hyper-V environment.

Diag-V provides the following functions:

Why

Current Hyper-V and Failover cmdlets are typically scoped to the host they are run on. ie If you run Get-VM it only returns VMs from the host specified.

Diag-V aims to leverage these cmdlets to provide more complete, and rapid operational insights into a Hyper-V environment.

Diag-V can quickly answer questions like these:

  • How many VMs are in this cluster?
  • Where are all the VMs stored?
  • Where are all the VHDXs stored?
  • Does the Hyper-V deployment have enough storage to accommodate dynamic VHD growth?
  • What is the health status of the CSVs?
  • Are any of the VMs using shared VHDXs?
  • What is the replication status of my VMs?
  • Do my Hyper-V servers have enough resources? Do I have room to grow?
  • Can my Hyper-V cluster withstand a node failure?

Installation

Prerequisites

  • Designed and tested on Server 2012R2 and Server 2016 Hyper-V servers running PowerShell 5.1
  • Nearly all functions require the console session to be running as administrator
  • Diag-V must be run as a user that has local administrator rights on the Hyper-V server
  • If running diagnostics that interact with all cluster nodes Diag-V must be run as a user that has local administrator right to all members of the cluster

Installing Diag-V via PowerShell Gallery

#from an administrative 5.1.0+ PowerShell session
Install-Module -Name 'Diag-V' -Scope CurrentUser

Quick start

#-----------------------------------------------------------------------------
#import the Diag-V module
Import-Module -Name "Diag-V"
#-----------------------------------------------------------------------------
#I need to know where all my VHDX files are, and how much space they could grow to
Get-AllVHD
#-----------------------------------------------------------------------------
#could I potentially save a lot of disk space based on my VMs BIN settings?
Get-BINSpaceInfo
#-----------------------------------------------------------------------------
#I need the current state, and detailed information about my CSVs
Get-CSVInfo
#-----------------------------------------------------------------------------
#i need to find out how big this folder is, and what's taking up so much space
Get-FileSizeInfo
#-----------------------------------------------------------------------------
#what errors did my hyper-v server have in the last 12 hours?
Get-HyperVLogInfo
#-----------------------------------------------------------------------------
#what version of Integration services are my VMs running (2012/R2) - or what features are activated?
Get-IntegrationServicesCheck
#-----------------------------------------------------------------------------
#are any of my VMs using shared VHDs?
Get-SharedVHD
#-----------------------------------------------------------------------------
#I want detailed VM information for all discovered VMs in my Hyper-V deployment
Get-VMInfo
#-----------------------------------------------------------------------------
#I want to know exactly where each component of my VMs are stored
Get-VMLocationPathInfo
#-----------------------------------------------------------------------------
#what is the current replication status of my VMs?
Get-VMReplicationStatus
#-----------------------------------------------------------------------------
#what is the current status of my VMs?
Get-VMStatus
#-----------------------------------------------------------------------------
#I want a complete health report of my Hyper-V deployment
#I want to know if my Hyper-V cluster can withstand a node failure
Test-HyperVAllocation
#-----------------------------------------------------------------------------

Author

Jake Morrison - https://techthoughts.info/

Contributors

Justin Saylor - Logo

Notes

This PowerShell project was created with Catesta.

Running Diag-V remotely

Diag-V leverages numerous existing cmdlets to provide rapid operational insight into your Hyper-V deployment. This makes it tricky to make Diag-V fully remote capable as some of these cmdlets support -ComputerName and -Credential while some do not. Diag-V is also cluster aware, and will scope your current or provided credentials to connect to other nodes in the cluster to retrieve operational data. This runs into the 'double-hop' issue as the remote machine has to pass credentials on to the other nodes to get data back.

For best results log into one Hyper-V server in the cluster and run your desired diagnostic. That said, I've enabled the majority of functions with a credential parameter. I've had success establishing a PSSession to a remote Hyper-V server, and I can specify the credential parameter which bypasses the double-hop issue. The configuration of your WinRM may affect your results. Consult each functions help for additional information.