Andys scripting corner - Beginners guide *UPDATE2*

PowerShell script exchange

Andys scripting corner - Beginners guide *UPDATE2*

Veeam Logoby Adnanbhai » Tue Mar 01, 2016 6:24 pm

In our environment we have 2 hyper-v clusters backed up by one VEEAM virual server and sql express database. to add a new VM in a JOB we run the script below, which takes 40-50 minutes to add thru script.
We use to have one 21 Node Cluster backing up with VEEAM, the same script use to add new VMS in a job between 5-10 seconds.
After adding a 3 Node Cluster to be backed up with same VEEAM server and using the same script, it now takes 40-50 minutes per VM to be added in a JOB.
Can you please see what needs to be fixed or are there files that we need to clean up to make this faster.

Code: Select all
Clear-Host
Add-PsSnapIn VeeamPSSnapIn -ErrorAction SilentlyContinue

$myCrmJob = Get-VBRJob -Name "JOBNAME1"

$myVMs = Get-Content .\veeam-add-list.txt

foreach ($myVM in $myVMs)
{
Find-VBRHvEntity -Name $myVM | Add-VBRHvJobObject -Job $myCrmJob
}


Thanks,
Adnan
Adnanbhai
Lurker
 
Posts: 1
Liked: never
Joined: Tue Mar 01, 2016 6:13 pm
Full Name: Adnan Syed

Re: Andys scripting corner - Beginners guide *UPDATE2*

Veeam Logoby v.Eremin » Wed Mar 02, 2016 2:50 pm

The Find-VBRHvEntity is heavy query taking some time to process. You'd be better run it outside of a cycle once without any filtering parameters. Assign result to a variable, and filter it out later on, using the corresponding VM names. Thanks.
v.Eremin
Veeam Software
 
Posts: 13266
Liked: 968 times
Joined: Fri Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin


Return to PowerShell



Who is online

Users browsing this forum: No registered users and 5 guests