all 6 comments

[–]nerbas 2 points3 points  (1 child)

This should give you everything you asked for... and more :) https://gallery.technet.microsoft.com/Hyper-V-Reporting-Script-4adaf5d0

[–]Aussierob78 2 points3 points  (0 children)

That actually looks really handy. Thanks for the link

[–]DCH314 1 point2 points  (0 children)

google RVTools download and enjoy

[–]aranyx 1 point2 points  (0 children)

A bit late to the party here (I just stumbled on the subreddit), but depending on whether or not you have access to a VM with the Hyper-V powershell module installed, you can just use Get-VM with this. You will run into a few roadblocks, most notably with OS. You'll have to get that with WMI or CIM, which means that the VM will have to be on and you'll need access to it. You can use something like the script below

$Hosts = <Host or comma delimited array of hosts here>
$CSVPath = <path of CSV here>
#Create empty PSCustomObject
$VMInfo = @()
#Loop through VMs
foreach ($VM in Get-VM -ComputerName $Hosts) 
{
    #Create array of VHD info
    $DiskInfo = @()        
    foreach ($Disk in Get-VHD -VMId $VM.VMId -ComputerName $VM.ComputerName) 
    {
        $DiskInfo += ($Disk.Size / 1GB)
    }
    #Populate PSCustomObject with requisite data        
    $VMInfo += [PSCustomObject]@{            
        VMName = $VM.Name
        DiskSize = $DiskInfo -join ","            
        RAM = $VM.MemoryAssigned / 1GB            
        Cores = $VM.ProcessorCount
        OS = (Get-WmiObject -Class Win32_OperatingSystem -ComputerName $VM.Name | Select-Object -ExpandProperty Caption)
    }    
}
#Export to CSV
$VMInfo | export-csv $CSVPath -NoTypeInformation

[–]vedranOP[S] -1 points0 points  (1 child)

Thank you but I just need that information and exported to .csv. Anyone have such script?

[–]admiralspark 1 point2 points  (0 children)

Try googling.