Hi,

I have a Windows Server 2016 packer build which completes the build of the 
OS to VirtualBox, but i am having an issue installing Puppet via a 
Powershell Provisioner. I upload the powershell file to a local directory 
and then run the script, but it just hangs giving no output in the cmd 
line. 

The script i am using is:
[Cmdletbinding()]
Param (
   # Command to execute against the wrapper
   [Parameter(Mandatory = $True)]
   [String]$Bucket
)
$ErrorActionPrefrence = "Stop";
       
$Key = "puppet-agent-5.5.0-x64.msi"
$Path = "C:\Installers";
$ErrorActionPrefrence = "Stop";

New-Item -Type Directory $Path -ErrorAction SilentlyContinue

try {
   # download Puppet agent from bucket
   Write-Host "Downloading Puppet Agent" -ForegroundColor Green;
   "Copy-Item resources/puppet-agent-5.5.0-x64.msi -Destination 
C:\Installers\puppet-agent-5.5.0-x64.msi"
   # gsutil cp gs://$Bucket/$Key $Path\$Key
   Write-Host "Downloaded $Object" -ForegroundColor Green;
}
catch {
   $_.Exception.Message ;
}
   
try {
   # install Puppet agent
   Write-Host "Installing Puppet Agent" -ForegroundColor Green;
   Invoke-Expression "cmd.exe /C start /wait msiexec /i '$Path\$Key' /qn 
PUPPET_AGENT_STARTUP_MODE=Disabled /L* 'C:\Windows\Temp\PuppetInstall.log'";
}
catch {
   throw $_.Exception.Message;
}
Remove-Item -Recurse -Force C:\ProgramData\PuppetLabs\code

I have also tried to remove the "Downloading Puppet Agent" part and used a 
provisioner to upload the file and then run the rest of the script, but the 
script will not run (the file uploads successfully).

Any ideas would be welcome and please let me know if any more detail is 
needed.

Thanks

-- 
This mailing list is governed under the HashiCorp Community Guidelines - 
https://www.hashicorp.com/community-guidelines.html. Behavior in violation of 
those guidelines may result in your removal from this mailing list.

GitHub Issues: https://github.com/mitchellh/packer/issues
IRC: #packer-tool on Freenode
--- 
You received this message because you are subscribed to the Google Groups 
"Packer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/packer-tool/fa8cf3f4-3e4a-4441-a0ec-fa0bee536e50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to