Hello all, I'm looking to get a script that will allow me to input a list of VM's that will tell me which Cluster they belong to as well as Virtual Hardware information (CPU, Mem, Disk, Etc.)
Any help would be appreciated!!!
Thanks, Paul
You mean like this ?
$vmName = Read-Host -Prompt "Enter a VM name"
Get-VM -Name $vmName | Select Name,@{N='Cluster';E={(Get-Cluster -VM $_).Name}},NumCpu,MemoryGB
Or this ?
$vmNames = Get-Content vmnames.txt
Get-VM -Name $vmNames | Select Name,@{N='Cluster';E={(Get-Cluster -VM $_).Name}},NumCpu,MemoryGB
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Try like this (I only show a limited number of properties that are available on the VirtualMachine object.
Get-VM | Select Name,@{N='Cluster';E={(Get-Cluster -VM $_).Name}},NumCpu,MemoryGB
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Thanks but I was looking for a script that I can input my own VM's and get the Cluster info. Any ideas?
You mean like this ?
$vmName = Read-Host -Prompt "Enter a VM name"
Get-VM -Name $vmName | Select Name,@{N='Cluster';E={(Get-Cluster -VM $_).Name}},NumCpu,MemoryGB
Or this ?
$vmNames = Get-Content vmnames.txt
Get-VM -Name $vmNames | Select Name,@{N='Cluster';E={(Get-Cluster -VM $_).Name}},NumCpu,MemoryGB
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
That works perfectly! Thanks so much!