pizzim13's Posts

Using goo.gl/fDVBd as an example, I broke my array of VM names into smaller pieces and started a job on each one. Without including the time suffered by the .NET compiling goo.gl/jMfMZ, I can que... See more...
Using goo.gl/fDVBd as an example, I broke my array of VM names into smaller pieces and started a job on each one. Without including the time suffered by the .NET compiling goo.gl/jMfMZ, I can query 850 VMs in three minutes instead of 15. $VMs = Get-View -ViewType "VirtualMachine" -Property Name -Filter @{"Runtime.PowerState"="PoweredOn"} | Select-Object -ExpandProperty Name $ArrayDivisor = 6 $VMLists = @{} $Counter = 0 $VMs | ForEach-Object {$VMLists[$Counter % $ArrayDivisor] += @($_);$Counter++} 0..($ArrayDivisor-1) | ForEach-Object `      {      Start-Job -ScriptBlock {                             param ($VIServer, $VMLists, $Creds)                             Add-PSSnapin -Name VMware.VimAutomation.Core -ErrorAction SilentlyContinue                             Connect-VIServer -Server $VIServer -Credential $Creds | Out-Null                             $VMObjs = get-vm -Name $VMLists                             $VMStats = $VMObjs | Get-Stat -Realtime -MaxSamples 1                             $VMStats | Export-Csv -Path "c:\temp\$(get-random).csv" #For testing only                             Disconnect-VIServer -Force -Confirm:$false                             } -ArgumentList ($VIServer, $VMLists[$_], $Creds)      }
As I have read about and witnessed in my own enivorment, W2k8 VMs will always show consumed memory maxed out, i.e. the vm has 8GB of memory allocated to it and will report 8GB consumed, and this ... See more...
As I have read about and witnessed in my own enivorment, W2k8 VMs will always show consumed memory maxed out, i.e. the vm has 8GB of memory allocated to it and will report 8GB consumed, and this is due to the OS doing background caching. Perfmon in the OS will show a much smaller number, because it will not report on this caching. Using the memory stats provided (http://www.vmware.com/support/developer/vc-sdk/visdk41pubs/ApiReference/memory_counters.html) is there any forumla to calculate what the OS shows as memory in use?
I am trying to get stats on ~800 vm in about 5 five minutes. The following command returns output in about 0.91 seconds per VM $vm | Get-Stat -Realtime -MaxSamples 1 where $vm is a VM obj... See more...
I am trying to get stats on ~800 vm in about 5 five minutes. The following command returns output in about 0.91 seconds per VM $vm | Get-Stat -Realtime -MaxSamples 1 where $vm is a VM object. If I run this as psjob, each job has to load the snapin and connect to the viserver, adding to the time to complete. Is there any way to pass an authenicated session to a job? Is there a faster way to do this?
#Create a local session for each vCenter server $vCenterSessions = New-Object System.Collections.ArrayList foreach ($vCenter in $Config.AppSettings.vCenters.HostName)     {     $vCenterSess... See more...
#Create a local session for each vCenter server $vCenterSessions = New-Object System.Collections.ArrayList foreach ($vCenter in $Config.AppSettings.vCenters.HostName)     {     $vCenterSessions.add((New-PSSession -ComputerName localhost -Name $vCenter)) | out-null     } $Config.AppSettings.vCenters.HostName is an array of vCenter servers gathered from an XML file. I have many more working examples of this using get-view. See below: ###Connect to each session to get VM info foreach ($SrvSession in $vCenterSessions)     {     Invoke-Command -session $SrvSession  -ScriptBlock { `         $VMInfo = @()         $VMInfo = Get-View -ViewType VirtualMachine -Property Guest.toolsVersionStatus, Config.Template, Runtime.PowerState, Config.guestfullname, Config.Version |         Select-Object   @{N="Tools Status";E={$_.Guest.toolsVersionStatus}}, @{N="Template";E={$_.Config.Template}}, `                         @{N="Power State";E={$_.Runtime.PowerState}}, @{N="Guest OS";E={$_.Config.guestfullname}}, `                         @{N="HW Version";E={$_.Config.Version}}, @{N="VI Server";E={$DefaultVIServer.Name}}, `                         @{N="VM";E={$_.Name}}         $VMInfo         } -AsJob -HideComputerName     } Get-Job | Wait-Job $VMInfo = @() $VMInfo += Get-Job | Receive-Job
I am making multiple pssessions that connect to my local host as to query multiple vCenter as jobs then using invoke-command as below foreach ($SrvSession in $vCenterSessions)     {     Inv... See more...
I am making multiple pssessions that connect to my local host as to query multiple vCenter as jobs then using invoke-command as below foreach ($SrvSession in $vCenterSessions)     {     Invoke-Command -session $SrvSession  -ScriptBlock { `         $SnapInfo = Get-VM | Get-Snapshot | Select-Object VM, Name, Description, Created, Powerstate, @{N="VI Server";E={$DefaultVIServer.Name}}         $SnapInfo         } -AsJob -HideComputerName     } It seems that running get-vm (even by itself) via invoke-command throws an error that fails the script WARNING: 'Description' property is obsolete. Use 'Notes' instead. WARNING: 'HardDisks' property is obsolete. Use 'Get-HardDisk' cmdlet instead. WARNING: 'NetworkAdapters' property is obsolete. Use 'Get-NetworkAdapter' cmdlet instead. WARNING: 'UsbDevices' property is obsolete. Use 'Get-UsbDevice' cmdlet instead. WARNING: 'CDDrives' property is obsolete. Use 'Get-CDDrive' cmdlet instead. WARNING: 'FloppyDrives' property is obsolete. Use 'Get-FloppyDrive' cmdlet instead. WARNING: 'Host' property is obsolete. Use 'VMHost' instead. WARNING: 'HostId' property is obsolete. Use 'VMHostId' instead. Processing data for a remote command failed with the following error message: The WSMan provider host process did not return a proper response.  A provider in the host process may have behaved improperly. For more information, see the about_Remote_Troubleshooting Help topic. Using this same process with get-view works without issue. Running get-vm outside of the pssession also works. Any ideas?
Good to go. Thanks for the info.
Also, is there an equivalent of != for filters?
That returns an error: 8/22/2011 2:21:39 PM    Get-View               At :line:1 char:9 + Get-View  <<<< -ViewType VirtualMachine `
Is it possible to use get-view's filter parameter with multiple properties? Works: Get-View -ViewType VirtualMachine -Filter @{"Guest.toolsVersionStatus" = "guestToolsUnmanaged"} Doesn't... See more...
Is it possible to use get-view's filter parameter with multiple properties? Works: Get-View -ViewType VirtualMachine -Filter @{"Guest.toolsVersionStatus" = "guestToolsUnmanaged"} Doesn't work: Get-View -ViewType VirtualMachine -Filter @{"Guest.toolsVersionStatus" = "guestToolsUnmanaged"} ` -and @{"RunTime.PowerState" = "PoweredOn"}
That worked.  Is it true that get-view is to be depreciated also?
When I run C:\>(Get-View -ViewType VirtualMachine -Filter @{"Name"="VM Name"}).Guest.ToolsStatus C:\>toolsOk But vSphere reports the tools as "Out of date" on that particular VM. When chec... See more...
When I run C:\>(Get-View -ViewType VirtualMachine -Filter @{"Name"="VM Name"}).Guest.ToolsStatus C:\>toolsOk But vSphere reports the tools as "Out of date" on that particular VM. When checking the tools version they are definitely out of date. Is this a bug in the cmdlet? Is there a better way to retrieve VM tool status with powercli?
Is possible to get the version or build number of a patch from VUM using the VMware.VimAutomation.Core or VMware.VumAutomation powershell snappins? For example: (Get-View -ViewType "virtualma... See more...
Is possible to get the version or build number of a patch from VUM using the VMware.VimAutomation.Core or VMware.VumAutomation powershell snappins? For example: (Get-View -ViewType "virtualmachine")[0].Config.Tools.ToolsVersion Returns: 8194 I would like to be able to take that number and compare it to the updates in VUM to see how many days have passed from the patch's release release date.
This i appears to be an issue with using PowerISO to edit the iso.  Apparently, with any other product to add files to the iso works without problem. https://patrickvanbeek.wordpress.com/2010... See more...
This i appears to be an issue with using PowerISO to edit the iso.  Apparently, with any other product to add files to the iso works without problem. https://patrickvanbeek.wordpress.com/2010/01/30/slipstreaming-drivers-in-the-esx4i-install-iso/
I am running into the same issue. On the esx 4.1 update 1 iso, those md5 hash files do not exist.
Excellent.  Thanks for the help
I am comparing running esxcfg-rescan <vmkernel SCSI adapter name> from the host via the console/SSH to using powercli, logging into the host and running Get-VMHostStorage -RescanAllHba. Do these ... See more...
I am comparing running esxcfg-rescan <vmkernel SCSI adapter name> from the host via the console/SSH to using powercli, logging into the host and running Get-VMHostStorage -RescanAllHba. Do these two commands use the same mechanism to do the rescan or are they separate mechanisms that accomplish the same goal? The reason for asking this question is that running the rescan all from vCenter or Get-VMHostStorage -RescanAllHba while connected vCenter to discover new LUNs doesn't always work. The new LUNs will not appear on all the hosts. Only by restarting the host or running esxcfg-rescan <vmkernel SCSI adapter name> from the host resolves this issue.
Using: Get-Stat -Entity "test-vm" -Stat cpu.ready.summation -Realtime | Select-Object -First 1  value | Format-List Works
I have a couple of lines in a script that are giving me an issue: Connect-VIServer "test-vcenter.test.com" -User user -Password pass Get-VM -Name "test-vm" | Get-Stat -Stat cpu.... See more...
I have a couple of lines in a script that are giving me an issue: Connect-VIServer "test-vcenter.test.com" -User user -Password pass Get-VM -Name "test-vm" | Get-Stat -Stat cpu.ready.summation -Realtime | Select-Object -First 1  value | Format-List When running this I receive this as output: Operation is not valid due to the current state of the object. At :line:0 char:0 If the second line is run a few seconds after the connection to  vCenter is made I receive the output I expect. What I believe is  happening is that my connection to vCenter hasn't completed before my  second line has started. I am not sure of the best way to wait for or  what to check for in a completed connection. Start-Sleep is not the way I want to go.