Hi all,
I have the below script to get a report from some VMs and it works fine for me but I also need to get the VM volumes information, how can I achieve it within the same script?
$vms = Get-VM | Where-Object { $_.Name -like '*test*'};
foreach ($vm in $vms) {
$vmname = $vm.name;
$totalcores = [string]$vm.numcpu
$corespersocket = [string]((get-view $vm).config.hardware.numcorespersocket);
$sockets = [string]([int]($totalcores / $corespersocket));
$memorygb = [string]$vm.memorygb;
$ProvisionedSpace = [string]$vm.ProvisionedSpaceGB;
$UsedSpace = [string]$vm.UsedSpaceGB;
$out = $vmname + "," + $totalcores + "," + $sockets + "," + $corespersocket + "," + $memorygb + "," + $ProvisionedSpace + "," + $usedSpace;
$out >> c:\users\hello\documents\test.csv;
}
I have tried unsuccessfully with get-harddisk.
Moderator: Moved to PowerCLI
What exactly do you mean by "volumes"?
Are that the datastores on which the VM lives, or the drives inside the Guest OS?
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference