Diag-V – A Hyper-V Diagnostic Utility

PowerShell based Hyper-V Diagnostic Tool

Diag-V

Diag-V is a PowerShell module that contains a collection of various Hyper-V diagnostics. With the module imported diagnostics can be run via the desired function name, alternatively, Diag-V can also present a simple choice menu that enables you to browse via console all diagnostics and execute the desired choice.

How can I use Diag-V?

There are several ways to get Diag-V and begin using it to get insight into your Hyper-V servers.

PowerShell Gallery (Recommended)

  1. Install-Module -Name "Diag-V" -Repository PSGallery
  2. Import module
    • Import-Module Diag-V
  3. Run desired diagnostic
    • Directly by calling function name (see Diagnsotic Functions section below)
    • Run GUI selection menu:
      • Show-DiagVMenu – select desired diagnostic

Technet

  1. Download Diag-V from Technet and extract zip
  2. Install module
    • For all users: %ProgramFiles%\WindowsPowerShell\Modules\Diag-V (Recommended)
    • For just you: %UserProfile%\Documents\WindowsPowerShell\Modules\Diag-V
  3. Open Administrator ISE or PowerShell console session
  4. Import module
    • Import-Module Diag-V
  5. Run desired diagnostic
    • Directly by calling function name (see Diagnsotic Functions section below)
    • Run GUI selection menu:
      • Show-DiagVMenu – select desired diagnostic

How do I use Diag-V?

Once the Diag-V module is installed simply run the desired diagnostic.

  • Directly by calling function name (see Diagnsotic Functions section below)
    • Ex. Get-VMInfo
  • Run GUI selection menu:
    • Show-DiagVMenu – select desired diagnostic

Diag-V GUI selection menu

I want to contribute to Diag-V

Great! If you find a bug or think a diagnostic should be added you can see the code and contribute via Git at the link below:

https://github.com/techthoughts2/Diag-V

What diagnostics can Diag-V perform?

VMs

  • Get-VMStatus – Displays status for all VMs on a standalone Hyper-V server or Hyper-V cluster
  • Get-VMInfo – Retrieves basic and advanced VM information for all VMs found on a standalone or cluster
  • Get-VMReplicationStatus – Gets VM replication configuration and replication status for all detected VMs
  • Get-VMLocationPathInfo – Identify the location of all of VM components.
  • Get-IntegrationServicesCheck – Displays IntegrationServicesVersion and enabled integration services for all VMs
  • Get-BINSpaceInfo – Determine if hard drive space is being taken up by the AutomaticStopAction setting

VHDs

  • Get-VMAllVHDs – VHD(x) information displayed for all discovered VMs
  • Get-SharedVHDs – Evaluates if a VHDX is shared for all discovered VMs

Overallocation

  • Test-HyperVAllocation – Determines the current resource allocation health of Hyper-V Server or Hyper-V Cluster

CSVs

  • Get-CSVtoPhysicalDiskMapping – Resolves CSV to a physicalDisk drive

Basic Diagnostics

  • Get-FileSizes – Scans specified path and gets total size as well as top 10 largest files
  • Get-HyperVLogs – Parses Hyper-V event logs and retrieves log entries based on user provided options

1 Comment

  1. I’ve spent a total of 30 seconds looking at this, so perhaps you’ve already built this into your scripts, however I noticed that you have a disclaimer stating that you have to be running as an admin for your functions to work. You could alternatively run the below line (returns true/false) to see if the PS session is being ran as an Administrator and then do an action based on the return value.

    (New-Object System.Security.Principal.WindowsPrincipal(([System.Security.Principal.WindowsIdentity]::GetCurrent()))).IsInRole(([System.Security.Principal.WindowsBuiltInRole]::Administrator))

Leave a Reply

Your email address will not be published.


*