Hi gurus
Trying to run a PS that will give me datastore name and Vlan used by all VM in a cluster.
I got this far and sort of work but not entirely
Get-VM | Select Name,
@{N = "Datastore"; E = {[string]::Join(',', (Get-Datastore -Id $_.DatastoreIdList ))}},
@{N="Vlan" , E={[string]::join (',',(Get-VMNetworkAdapterVlan))}}
its all screwy, any help appreciated
Thanks
The Get-VMNetworkAdapterVlan cmdlet is a Hyper-V cmdlet I'm afraid.
With PowerCLI you could do something like this
Select Name,
@{N='Datastore';E={(Get-Datastore -Id $_.DatastoreIdList).Name -join '|'}},
@{N='VLAN';E={(Get-VirtualPortgroup -Name (Get-NetWorkAdapter -VM $_).NetworkName).VlanId -join '|'}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
The Get-VMNetworkAdapterVlan cmdlet is a Hyper-V cmdlet I'm afraid.
With PowerCLI you could do something like this
Select Name,
@{N='Datastore';E={(Get-Datastore -Id $_.DatastoreIdList).Name -join '|'}},
@{N='VLAN';E={(Get-VirtualPortgroup -Name (Get-NetWorkAdapter -VM $_).NetworkName).VlanId -join '|'}}
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
as always you are crazy goooooddddd