mirror of
https://github.com/tsmagnum/Hyper-V-Report.git
synced 2026-04-26 02:36:06 +02:00
Add files via upload
This commit is contained in:
committed by
GitHub
parent
5e31775980
commit
97a4703253
82
README.md
82
README.md
@@ -3,14 +3,11 @@
|
||||
|
||||
## Overview
|
||||
|
||||
This PowerShell script automates the collection of detailed information about a Hyper-V environment, including hosts, virtual machines, snapshots, replication status, virtual hard disks (VHDX), network adapters, and virtual switches. It generates an HTML report and optionally sends it via email.
|
||||
Support for clustered environments will be introduced in a future release.
|
||||
This PowerShell script automates the collection of detailed information about a Hyper-V environment, including hosts, virtual machines, snapshots, replication status, VHDX files, network adapters, virtual switches, and—new in this version—CSV health and space utilization, cluster configuration, and cluster network details. It generates a customizable HTML report and can optionally send it via email using MS Graph or MailKit.
|
||||
|
||||
The script can be scheduled like any other PowerShell script using the Task Scheduler in Windows.
|
||||
The script supports both standalone and clustered deployments.
|
||||
|
||||
Notice: Please be aware that the script installs the MS Graph or Send-MailKitMessage PowerShell modules if they are not already present. Do not run the script if installing these modules could cause issues in your environment.
|
||||
|
||||
---
|
||||
> ⚠️ Note: The script installs required modules (MS Graph or MailKit) if not already present. Avoid running it if module installation could impact your environment.
|
||||
|
||||
## Features
|
||||
|
||||
@@ -21,52 +18,52 @@ Notice: Please be aware that the script installs the MS Graph or Send-MailKitMes
|
||||
- Gathers VHDX file details
|
||||
- Extracts VM and management OS network adapter data
|
||||
- Lists virtual switch configurations
|
||||
- Generates a comprehensive HTML report
|
||||
- NEW: Reports CSV health and space utilization (clustered only)
|
||||
- NEW: Includes cluster configuration and network details
|
||||
- Generates a comprehensive HTML report with selectable styles
|
||||
- Sends the report via email using MS Graph or MailKit
|
||||
|
||||
---
|
||||
|
||||
## Prerequisites
|
||||
|
||||
- PowerShell 5.1 or later
|
||||
- Hyper-V role installed
|
||||
- Required modules:
|
||||
- `Hyper-V`
|
||||
- `CimCmdlets`
|
||||
- Hyper-V
|
||||
- CimCmdlets
|
||||
- External scripts in the same directory:
|
||||
- `GlobalVariables.ps1`
|
||||
- `StyleCSS.ps1`
|
||||
- `HtmlCode.ps1`
|
||||
- `Functions.ps1`
|
||||
|
||||
---
|
||||
- GlobalVariables.ps1
|
||||
- StyleCSS.ps1 (or variants like StyleCSS-Pro.ps1, StyleCSS-Colorful.ps1)
|
||||
- HtmlCode.ps1
|
||||
- Functions.ps1
|
||||
|
||||
## Script Parameters
|
||||
|
||||
These are expected to be defined in `GlobalVariables.ps1`:
|
||||
Defined in `GlobalVariables.ps1`:
|
||||
|
||||
- `$reportHtmlDir` – Directory to save the HTML report
|
||||
- `$reportHtmlName` – Base name for the report file
|
||||
- `$reportStyle` – Style of the HTML report (`minimal`, `pro`, `prodark`, `colorful`, `professional`)
|
||||
- `$clusterDeployment` – Boolean flag for cluster support
|
||||
- `$replicationInfoNeeded` – Boolean flag to include replication info
|
||||
- `$vhdxInfoNeeded` – Boolean flag to include VHDX info
|
||||
- `$vmnetInfoNeeded` – Boolean flag to include VM network adapter info
|
||||
- `$osNetInfoNeeded` – Boolean flag to include management OS network adapter info
|
||||
- `$vswitchInfoNeeded` – Boolean flag to include virtual switch info
|
||||
- `$reportHtmlRequired` – Boolean flag to generate HTML report
|
||||
- `$emailReport` – Boolean flag to send report via email
|
||||
- `$csvHealthInfoNeeded` – Include CSV health info (clustered only)
|
||||
- `$csvSpaceInfoNeeded` – Include CSV space utilization (clustered only)
|
||||
- `$clusterConfigInfoNeeded` – Include cluster configuration details
|
||||
- `$clusterNetworksInfoNeeded` – Include cluster network details
|
||||
- `$replicationInfoNeeded` – Include replication info
|
||||
- `$vhdxInfoNeeded` – Include VHDX info
|
||||
- `$vmnetInfoNeeded` – Include VM network adapter info
|
||||
- `$osNetInfoNeeded` – Include management OS network adapter info
|
||||
- `$vswitchInfoNeeded` – Include virtual switch info
|
||||
- `$reportHtmlRequired` – Generate HTML report
|
||||
- `$emailReport` – Send report via email
|
||||
- `$emailSystem` – Email system to use (`msgraph` or `mailkit`)
|
||||
|
||||
---
|
||||
- `$encryptedSMTPCredsFileName` – Filename for encrypted SMTP credentials
|
||||
|
||||
## Output
|
||||
|
||||
- **HTML Report**: Saved in `$reportHtmlDir` with timestamped filename.
|
||||
- **HTML Report**: Saved in `$reportHtmlDir` with a timestamped filename.
|
||||
- **Console Output**: Displays formatted tables for each section.
|
||||
- **Email**: Sent if `$emailReport` is enabled and `$reportHtmlRequired` is true.
|
||||
|
||||
---
|
||||
|
||||
## Usage
|
||||
|
||||
```powershell
|
||||
@@ -75,22 +72,23 @@ These are expected to be defined in `GlobalVariables.ps1`:
|
||||
|
||||
Ensure all required variables and modules are properly configured before execution.
|
||||
|
||||
---
|
||||
|
||||
## Sections in the Report
|
||||
|
||||
1. **Host Info** – CPU, RAM, OS version, VHD volume stats
|
||||
2. **VM Info** – Name, generation, memory, IP, state, uptime, replication
|
||||
3. **Snapshots** – Snapshot name, age, parent snapshot
|
||||
4. **Replication** – Status, health, last replication time
|
||||
5. **VHDX Info** – Format, type, size, fragmentation
|
||||
6. **VM Network Adapters** – MAC, IP, vSwitch, VLAN
|
||||
7. **Management OS Adapters** – IP, MAC, vSwitch, VLAN
|
||||
8. **Virtual Switches** – Name, type, uplinks, SET status
|
||||
|
||||
---
|
||||
2. **CSV Health Info** – CSV status and health (clustered only)
|
||||
3. **CSV Space Utilization** – CSV volume usage (clustered only)
|
||||
4. **VM Info** – Name, generation, memory, IP, state, uptime, replication
|
||||
5. **Snapshots** – Snapshot name, age, parent snapshot
|
||||
6. **Replication** – Status, health, last replication time
|
||||
7. **VHDX Info** – Format, type, size, fragmentation
|
||||
8. **VM Network Adapters** – MAC, IP, vSwitch, VLAN
|
||||
9. **Management OS Adapters** – IP, MAC, vSwitch, VLAN
|
||||
10. **Virtual Switches** – Name, type, uplinks, SET status
|
||||
11. **Cluster Configuration** – Cluster settings and roles
|
||||
12. **Cluster Networks** – Cluster network topology and status
|
||||
|
||||
## Notes
|
||||
|
||||
- Cluster support is marked as "Coming soon".
|
||||
- Cluster support is now implemented.
|
||||
- Email system must be explicitly selected (`msgraph` or `mailkit`).
|
||||
- Only the user who encrypted SMTP credentials can decrypt them.
|
||||
|
||||
Reference in New Issue
Block a user