I assume this error is my laptop running out of memory?
Get-View : 12/7/2010 3:39:12 PM Get-View 0649D347-80B8-4980-8912-A9C15638A760 Exception of type 'System.OutOfMemory
Exception' was thrown.
At C:\scripts\hostinfo.ps1:4 char:9
+ Get-View <<<< -ViewType HostSystem | % {
+ CategoryInfo : NotSpecified: ( , VimException
+ FullyQualifiedErrorId : Core_BaseCmdlet_UnknownError,VMware.VimAutomation.Commands.DotNetInterop.GetVIView
Do I need to run my script from somewhere with more system memory available, or is there a way to split up the results? I have about 110 hosts in my virtual center. Here is my script if it helps:
Connect-viserver -Server VirtualCenterHost
$filelocation = "c:\scripts\result_host_info.csv"
$report = @()
Get-View -ViewType HostSystem | % {
$row = "" | select name, vendor, model, BIOSversion, BIOSrelease, memoryGB, CpuModel, CpuMhz, NumCpuPkgs, NumCpuCores, NumCpuThreads, NumNics, NumHBAs
$row.name = $_.name
$row.vendor = $_.Summary.Hardware.vendor
$row.model = $_.Summary.Hardware.model
$row.BIOSversion = $_.Hardware.Biosinfo.biosversion
$row.BIOSrelease = $_.Hardware.Biosinfo.releasedate
$row.memoryGB = ($_.Summary.Hardware.MemorySize/1GB)
$row.CpuModel = $_.Summary.Hardware.CpuModel
$row.cpuMhz = $_.Summary.Hardware.CPUMhz
$row.NumCpuPkgs = $_.Summary.Hardware.NumCpuPkgs
$row.NumCpuCores = $_.Summary.Hardware.NumCpuCores
$row.NumCpuThreads = $_.Summary.Hardware.NumCpuThreads
$row.NumNics = $_.Summary.Hardware.NumNics
$row.NumHBAs = $_.Summary.Hardware.NumHBAs
$report += $row
}
$report | export-csv $filelocation
PowerCLI isn't that memory hungry or you must really have little memory on that portable.
What PowerCLI version are you running ? Is it 4.1.1
Get-PowerCLIVersion
Did you run that script from the PowerCLI prompt ?
Or from a GUI ?
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
You're running 2 builds behind. Perhaps you should consider an upgrade ?
Did you try seeing if the PowerCLI prompt and the script actually take that much memory ?
Use something like Process Explorer from Syinternals.
Have a look at Andrei's question in another thread, see
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
Are there other places I could pull the bios information from? I cut down what I was gathering to just this, and I can succesfully run against 2 of my 3 virutal cneter, the biggest one still gives me the memory error. When it completes, I only get the BIOS info from a few hosts, even though I can see it on the hardware tab in virutal center for all my hosts.
$filelocation = "c:\scripts\hostinfo\result_host_info.csv"
$report = @()
Get-View -ViewType HostSystem | % {
$row = "" | select name, vendor, model, BIOSversion, BIOSrelease
$row.name = $_.name
$row.vendor = $_.Summary.Hardware.vendor
$row.model = $_.Summary.Hardware.model
$row.BIOSversion = $_.Hardware.Biosinfo.biosversion
$row.BIOSrelease = $_.Hardware.Biosinfo.releasedate
write-host $row
$report += $row
}
#$report | export-csv $filelocation
THanks
The retrieval of the BIOS information depends on type of HW you have.
These properties are populated for some but not for others.
Btw, can you try the following ?
It should use a bit less memory than the other version.
$filelocation = "c:\result_host_info.csv" Get-View -ViewType HostSystem | Select Name, @{N="Vendor";E={$_.Summary.Hardware.vendor}}, @{N="Model";E={$_.Summary.Hardware.model}}, @{N="BIOSversion";E={$_.Hardware.Biosinfo.biosversion}}, @{N="BIOSrelease";E={$_.Hardware.Biosinfo.releasedate}} | export-csv $filelocation -NoTypeInformation
____________
Blog: LucD notes
Twitter: lucd22
Blog: lucd.info Twitter: @LucD22 Co-author PowerCLI Reference
I was trying to modify his original, I don't get the out of memory error here but it doesn't show the BIOs information.
$filelocation = "c:\scripts\result_host_info.csv" $report = @() Get-View -ViewType HostSystem | % { $row = "" | select name, vendor, model, BIOSversion, BIOSrelease $row.name = $_.name $row.vendor = $_.Summary.Hardware.vendor $row.model = $_.Summary.Hardware.model $row.BIOSversion = $_.Extensiondata.Hardware.Biosinfo.biosversion $row.BIOSrelease = $_.Extensiondata.Hardware.Biosinfo.releasedate $report = $row $report } $report | export-csv $filelocation
This pulls the vendor name and model number without errors but nothing for the bios version or date.
Cheers,
Bradley Sessions
If you found this or other information useful, please consider awarding points for "Correct" or "Helpful".
the hardware is all fujitsu, and I have atleast 15 or so of the same model in one datacenter, but only 1 of them returned the BIOS information. This is confusing for me. Trying to run LucD modification now to see if that helps me with memory issue.