2018-05-24 16:57:55 +00:00
|
|
|
#Requires -Modules VagrantVM, VagrantMessages
|
|
|
|
|
|
|
|
param(
|
|
|
|
[parameter (Mandatory=$true)]
|
|
|
|
[string] $VMConfigFile,
|
|
|
|
[parameter (Mandatory=$true)]
|
|
|
|
[string] $DestinationPath,
|
|
|
|
[parameter (Mandatory=$true)]
|
|
|
|
[string] $DataPath,
|
|
|
|
[parameter (Mandatory=$true)]
|
|
|
|
[string] $SourcePath,
|
|
|
|
[parameter (Mandatory=$false)]
|
|
|
|
[switch] $LinkedClone,
|
|
|
|
[parameter (Mandatory=$false)]
|
|
|
|
[string] $VMName=$null
|
|
|
|
)
|
|
|
|
|
|
|
|
$ErrorActionPreference = "Stop"
|
|
|
|
|
|
|
|
try {
|
|
|
|
if($LinkedClone) {
|
|
|
|
$linked = $true
|
|
|
|
} else {
|
|
|
|
$linked = $false
|
|
|
|
}
|
|
|
|
|
|
|
|
$VM = New-VagrantVM -VMConfigFile $VMConfigFile -DestinationPath $DestinationPath `
|
|
|
|
-DataPath $DataPath -SourcePath $SourcePath -LinkedClone $linked -VMName $VMName
|
|
|
|
|
|
|
|
$Result = @{
|
|
|
|
id = $VM.Id.Guid;
|
|
|
|
}
|
2018-06-12 22:32:29 +00:00
|
|
|
Write-OutputMessage (ConvertTo-Json $Result)
|
2018-05-24 16:57:55 +00:00
|
|
|
} catch {
|
2018-06-12 22:32:29 +00:00
|
|
|
Write-ErrorMessage "${PSItem}"
|
2018-05-24 16:57:55 +00:00
|
|
|
exit 1
|
|
|
|
}
|