-
Notifications
You must be signed in to change notification settings - Fork 3
/
Set-VmFromVhds.ps1
22 lines (16 loc) · 995 Bytes
/
Set-VmFromVhds.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
param
(
[Parameter(Mandatory=$false, HelpMessage="Configuration File, see example in directory")]
[ValidateNotNullOrEmpty()]
[string] $ConfigFile = "config.csv",
[Parameter(Mandatory=$false, HelpMessage="How many minutes to wait before starting the next parallel lab creation")]
[int] $SecondsBetweenLoop = 10,
[Parameter(HelpMessage="String containing comma delimitated list of patterns. The script will (re)create just the VMs matching one of the patterns. The empty string (default) recreates all labs as well.")]
[string] $ImagePattern = "",
[ValidateSet("Delete","Leave","Error")]
[Parameter(Mandatory=$true, HelpMessage="What to do if a VM with the same name exist in the lab (Delete, Leave, Error)")]
[string] $IfExist
)
$ErrorActionPreference = "Stop"
. "./Utils.ps1"
"./Set-VmFromVhd.ps1" | Invoke-RSForEachLab -ConfigFile $ConfigFile -SecondsBetweenLoop $SecondsBetweenLoop -CustomRole $null -ImagePattern $ImagePattern -IfExist $IfExist