VMware Cloud Community
dalo
Hot Shot
Hot Shot
Jump to solution

script needs a long time

I made a script to check if some snapshots are left.

In the past this works very well, but now I noticed, that the script needs a lot of time to complete. Also the CPU load of the VCenter goes up until this time.

Is this normal, that this takes such a long time? (37Hosts/670VMs)

$viserver = Connect-VIServer our_vcenter
$allvm = get-vm
$report = @()

foreach ($snap in ($allvm | get-snapshot)) {
	
	$row = "" | select vmname, pstate, created
	$row.vmname = $snap.vm.name
	$row.pstate = $snap.powerstate
	$row.created = $snap.Created
	$report += $row
}

$body = $report | ft -auto | out-string
$smtp = new-object Net.Mail.SmtpClient(”our_mailserver”)


$smtp.Send(”admin@domain","admin@domain”, “Snapshots”, $body)

Disconnect-VIServer -Server $viserver -confirm:$false

0 Kudos
1 Solution

Accepted Solutions
LucD
Leadership
Leadership
Jump to solution

The Get-Snapshot cmdlet has some issues in PowerCLI 4u1.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

View solution in original post

0 Kudos
2 Replies
LucD
Leadership
Leadership
Jump to solution

The Get-Snapshot cmdlet has some issues in PowerCLI 4u1.

____________

Blog: LucD notes

Twitter: lucd22


Blog: lucd.info  Twitter: @LucD22  Co-author PowerCLI Reference

0 Kudos
dalo
Hot Shot
Hot Shot
Jump to solution

Good to know. Thank you.

Here I found a thread about it:

http://communities.vmware.com/message/1465574#1465574

Daniel

0 Kudos