Hello,
I have a big issue after update to PowerCLI 6.3
I have a script that collects information about all my VMs in different vcenters (Name, Domain, Memory, CPU, space used, network names, IPs, harddrives and so on)
$vm.NetworAdapters and $vm.HardDisks properties have been deprecated.
So now I have to use $vm | get-networkAdapters and $vm | get-harddisks.
This has increased the time for my script from some hours to some days!!
A example of the code :
foreach($vm in (get-vm)) {
if ((($vm | Get-NetworkAdapter).count -eq 0) -and (($vm | Get-HardDisk).count -eq 0) -and ($vm.PowerState -eq 'PoweredOff')){}
else{
$VMs = "" | select Name, "Guest ID", "Num CPU", MemoryGB, Host, Id, NicNumber, HardDiskNumber, HardDisks, IPs, Nets, Platform,Provisioned,Used,Domain
$VMs.Platform = 'VMWare'
$VMs.Name = $vm.Name
$VMs.NicNumber = ($vm | Get-NetworkAdapter).coun [...]
The 'if statement' is to not include SRM VMs in the list (and avoid duplicated VMs).
So I would like to :
- Reduce the list of VMs, not including SRM VMs in get-vm. But I don't know how to do it without NetworkAdapter property (get-vm | where {($_.NetworkAdapter).count -eq 0 .... doesn't work any more).
- See how to improve the performance that I lost with this new commands instead of properties.
Thanks so much in advance.
Antonio