PowerShell script exchange
Post Reply
Adnanbhai
Lurker
Posts: 1
Liked: never
Joined: Mar 01, 2016 6:13 pm
Full Name: Adnan Syed
Contact:

Andys scripting corner - Beginners guide *UPDATE2*

Post by Adnanbhai »

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
veremin
Product Manager
Posts: 20415
Liked: 2302 times
Joined: Oct 26, 2012 3:28 pm
Full Name: Vladimir Eremin
Contact:

Re: Andys scripting corner - Beginners guide *UPDATE2*

Post by veremin »

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.
Post Reply

Who is online

Users browsing this forum: No registered users and 14 guests