Quantcast
Channel: VMware Communities : Unanswered Discussions - Sample Exchange
Viewing all articles
Browse latest Browse all 70

How to increase speed get-vm get-view

$
0
0

 

Hi,

 

I'm new in PowerCLI.

I'm using next script to obtain Virtual Machine Inventory:

 

$outputFileVM = 'D:\PowerShell_scripts\Inventory.csv'
$VMReport = @()
get-vm | sort name | %{
$VM = Get-View $_.ID
$row = "" | Select-Object VM_Name, VM_Host, VM_Host_Model, VM_Memory, VM_vCpu, VM_CpuLimit, VM_CpuShares
$row.VM_Name = $VM.Config.Name
$row.VM_Host = Get-VMHost -VM $_
$row.VM_Host_Model = Get-VMHost -VM $_ | Get-View | % {$_.Hardware.SystemInfo.Model}
$row.VM_Memory = $VM.Config.Hardware.memoryMB
$row.VM_vCpu = $VM.Config.Hardware.numCPU
$row.VM_CpuLimit = $VM.Config.CpuAllocation.Limit
$row.VM_CpuShares = $VM.Config.CpuAllocation.Shares.Shares
$VMReport += $row
}
$VMReport | Export-Csv $outputFileVM -NoTypeInformation

 

This script runs very slow. I read something about how to increase speed using get-view -viewType. But I don't know how to use it to refactory in this script.

Anyone can help me?

Thanks.

 

 

 

 

 

Eduard.

 

 


Viewing all articles
Browse latest Browse all 70

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>