I have been working on a scripts for updating the vmware tools on my guest servers. I have a requirement to do a specific set of servers at a specific time. This is based around our patching windows for each server as it was negociated with the clients. I have written the script below to push the tools update out but i am getting extreamly slow respose from the get-vm command it takes several minutes to complete as you can see from the measure-command output below. Does anyone have any idea why I am getting such slow response? It is almost faster to manually triger the updates. It looks like most of the time is consumed in the get-vm commandlet
Details:
I am running the script from a windows 2003 server fully patched in the same datacenter as my virtual center server and database server.
Script:
$VirtualCenter = "ap-vmvc-p01","ap-vmvc-p001"
$InputFile = $args[0].split(",")
Write-Host "Processing Input file"
write-Host "$inputfile"
write-host " "
foreach ($VC in $virtualcenter)
{
write-host "Connecting to Virtual Center ($VC)"
connect-viserver $vc
Foreach ($In in $InputFile)
{
$Input= import-csv $In
foreach ($Server in $Input.Name)
{
write-Host "Processing - $Server"
Get-VM $Server | update-tools
}
}
}
Command Time: (executing against only one vm)
Days : 0
Hours : 0
Minutes : 10
Seconds : 23
Milliseconds : 49
Ticks : 6230490894
TotalDays : 0.0072112163125
TotalHours : 0.1730691915
TotalMinutes : 10.38415149
TotalSeconds : 623.0490894
TotalMilliseconds : 623049.0894
Truth is a three edged sword