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
