Hyper-V-Reporting-Script
Hyper-V-Reporting-Script copied to clipboard
Error on windows server 2022
Hi,
the script works on server 2012 R2 but i have this error on server 2022, could you help me ?
Get-VHD : Cannot validate argument on parameter 'Path'. The argument is null or empty. Provide an argument that is not null or empty, and then try the command again. At C:\Tools\Old\Get-HyperVReport.ps1:2226 char:83
- ... $vmDiffDisk = Get-VHD -ComputerName $VMHostItem -Path $parentPath
-
~~~~~~~~~~~- CategoryInfo : InvalidData: (:) [Get-VHD], ParameterBindingValidationException
- FullyQualifiedErrorId : ParameterArgumentValidationError,Microsoft.Vhd.PowerShell.Cmdlets.GetVHD
My solution : i have put in comment the line 2226 ($vmDiffDisk = Get-VHD -ComputerName $VMHostItem -Path $parentPath) and the the script works...
Change Until ($parentPath -eq $null) to Until ($parentPath -eq "")