Previously I wrote that the scripts I’m writing, are failing because Packer hangs.

Apparently, this was a known issue. And apparently, I was using an older version, 0.7.5. After I updated everything is working wonderfully!!!

And for my thanks, here is an updated PowerShell script for provisioning my dotnet stuff.


$source = "http://download.microsoft.com/download/1/6/7/167F0D79-9317-48AE-AEDB-17120579F8E2/NDP451-KB2858728-x86-x64-AllOS-ENU.exe"
$destination = "C:\Windows\Temp\dotnet.exe"
Write-Host 'Starting to download dotnet file.'
try {
  (New-Object System.Net.WebClient).DownloadFile($source, $destination)
} catch [Exception] {
  Write-Host "Exception during download. Probable cause could be that the directory or the file didn't exist."
  Write-Host '$_.Exception is' $_.Exception
}
Write-Host 'Download done. Checking if file exists.'
if (!(Test-Path $destination)) {
  Write-Host 'Downloading dotnet Failed!'
} else {
  Write-Host 'Download successful.'
}

Write-Host 'Starting install process.'
try {
  Start-Process -FilePath $source -ArgumentList "/q /norestart" -Wait -PassThru
} catch [Exception] {
  Write-Host 'Exception during install process.'
  Write-Host '$_.Exception is' $_.Exception
}

Write-Host 'All done. Goodbye.'

Thanks for reading!

Gergely.