PowerShell script exchange
Post Reply
pkelly_sts
Veteran
Posts: 600
Liked: 66 times
Joined: Jun 13, 2013 10:08 am
Full Name: Paul Kelly
Contact:

Quick backup script, wait for first to complete/

Post by pkelly_sts »

Bit of a noob powershell question here, I've wrote a script to start a quick backup of a VM that could be scheduled in Task Scheduler & it worked great but I was lazy & hard-coded the VM name into the script meaning to turn it into an argument later.

Finally got around to switching to arguments & wanted to be able to specify multiple VMs for quick-backup (i.e. run at a time 5 mins before a dev is scheduled to do some maintenance. However I've hit an issue where the first arg is read just fine & the quickbackup starts, but then it immediately tries to start the second one, which fails because it's in the same parent backup job.

So, what's the correct way to get further iterations of the quick backups to wait for one to complete before the next one starts?

Fundamentally all I'm doing is a simple:

foreach ($arg in $args)
{
Code for quick-backup
<need some delay/intelligence here>
}

Any pointers to Powershell noob code appreciated :)
tdewin
Veeam Software
Posts: 1775
Liked: 646 times
Joined: Mar 02, 2012 1:40 pm
Full Name: Timothy Dewin
Contact:

Re: Quick backup script, wait for first to complete/

Post by tdewin » 1 person likes this post

maybe you are looking for the wait parameter e.g.:

Code: Select all

Start-VBRQuickBackup -wait
pkelly_sts
Veteran
Posts: 600
Liked: 66 times
Joined: Jun 13, 2013 10:08 am
Full Name: Paul Kelly
Contact:

Re: Quick backup script, wait for first to complete/

Post by pkelly_sts »

Ah, perfect, thanks! :)
Post Reply

Who is online

Users browsing this forum: No registered users and 13 guests