$StartTime = $(get-date)
Try {
$output = "Started: " + $StartTime
Write-Output $output
$containerName = 'bc1'
$password = 'P@ssw0rd'
$securePassword = ConvertTo-SecureString -String $password -AsPlainText -Force
$credential = New-Object pscredential 'admin', $securePassword
$auth = 'UserPassword'
$artifactUrl = Get-BcArtifactUrl -type 'Sandbox' -version '' -country 'us' -select 'Latest'
New-BcContainer `
-accept_eula `
-containerName $containerName `
-credential $credential `
-auth $auth `
-artifactUrl $artifactUrl `
-imageName 'myimage1' `
-dns '8.8.8.8' `
-updateHosts
}
Catch {
Write-Error "Um, something didn't go well:"
Write-Error $_
}
Finally {
$EndTime = $(get-date)
$output = "End time: " + $EndTime
Write-Output $output
$elapsedTime = $(get-date) - $StartTime
$totalTime = "{0:HH:mm:ss}" -f ([datetime]$elapsedTime.Ticks)
$output = "Elapsed time: " + $totalTime
Write-Output $output
}
No comments:
Post a Comment