Closed DDZERO9999 closed 6 years ago
Reason could be wrong provisioners section entry in windows_2008_r2.json:
First type should be:
{
"type": "windows-shell",
"remote_path": "C:/Windows/Temp/script.bat",
"execute_command": "{{.Vars}} cmd /c C:/Windows/Temp/script.bat",
"scripts": [
"{{user scripts_dir
}}/configs/update_root_certs.bat",
"{{user scripts_dir
}}/installs/vm-guest-tools.bat",
"{{user scripts_dir
}}/configs/vagrant-ssh.bat",
"{{user scripts_dir
}}/configs/disable-auto-logon.bat",
"{{user scripts_dir
}}/configs/enable-rdp.bat"
]
},
instead of: "type": "shell", "remotepath": "/tmp/script.bat",
Thanks, this worked. I had two issues after, accessing the file in \packer\builds. I had to rename the file to get it to work after performing the manual install.
Fails on this step every time. Tried two versions of Vagrant with same outcome.
Host System
Command Output
PS C:\Users\dd099\Documents\metasploitable3> .\build_win2008.ps1 Compatible version of VirtualBox found. Compatible version of packer found. Compatible version of Vagrant found. Compatible version of vagrant-reload plugin found. All requirements found. Proceeding... Building the Vagrant box... virtualbox-iso output will be in this color.
==> virtualbox-iso: Downloading or copying Guest additions virtualbox-iso: Downloading or copying: file:///C:/Program%20Files/Oracle/VirtualBox/VBoxGuestAdditions.iso ==> virtualbox-iso: Downloading or copying ISO virtualbox-iso: Found already downloaded, initial checksum matched, no download needed: http://download.microsoft.com/download/7/5/E/75EC4E54-5B02-42D6-8879-D8D3A25FBEF7/7601.17514.101119-1850_x64fre_server_eval_en-us-GRMSXEVAL_EN_DVD.iso ==> virtualbox-iso: Creating floppy disk... virtualbox-iso: Copying files flatly from floppy_files virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../answer_files/2008_r2/Autounattend.xml virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../scripts/configs/microsoft-updates.bat virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../scripts/configs/win-updates.ps1 virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../scripts/installs/openssh.ps1 virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../scripts/installs/install_dotnet45.ps1 virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../scripts/installs/install_wmf.ps1 virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources/certs/oracle-cert.cer virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources/certs/gdig2.crt virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources/certs/comodorsadomainvalidationsecureserverca.crt virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources/certs/comodorsacertificationauthority.crt virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources/certs/addtrust_external_ca.cer virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources/certs/baltimore_ca.cer virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources/certs/digicert.cer virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources/certs/equifax.cer virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources/certs/globalsign.cer virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources/certs/gte_cybertrust.cer virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources/certs/microsoft_root_2011.cer virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources/certs/thawte_primary_root.cer virtualbox-iso: Copying file: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources/certs/utn-userfirst.cer virtualbox-iso: Done copying files from floppy_files virtualbox-iso: Collecting paths from floppy_dirs virtualbox-iso: Resulting paths from floppy_dirs : [] virtualbox-iso: Done copying paths from floppy_dirs ==> virtualbox-iso: Creating virtual machine... ==> virtualbox-iso: Creating hard drive... ==> virtualbox-iso: Attaching floppy disk... ==> virtualbox-iso: Creating forwarded port mapping for communicator (SSH, WinRM, etc) (host port 3433) ==> virtualbox-iso: Executing custom VBoxManage commands... virtualbox-iso: Executing: modifyvm metasploitable3-win2k8 --memory 4096 virtualbox-iso: Executing: modifyvm metasploitable3-win2k8 --cpus 2 ==> virtualbox-iso: Starting the virtual machine... ==> virtualbox-iso: Waiting 10m0s for boot... ==> virtualbox-iso: Typing the boot command... ==> virtualbox-iso: Waiting for SSH to become available... ==> virtualbox-iso: Connected to SSH! ==> virtualbox-iso: Uploading VirtualBox version info (5.2.8) ==> virtualbox-iso: Uploading VirtualBox guest additions ISO... ==> virtualbox-iso: Uploading C:\Users\dd099\Documents\metasploitable3\packer\templates/../../scripts => C:/vagrant ==> virtualbox-iso: Uploading C:\Users\dd099\Documents\metasploitable3\packer\templates/../../resources => C:/vagrant ==> virtualbox-iso: Provisioning with shell script: C:\Users\dd099\Documents\metasploitable3\packer\templates/../../scripts/configs/update_root_certs.bat ==> virtualbox-iso: Deregistering and deleting VM... ==> virtualbox-iso: Deleting output directory... Build 'virtualbox-iso' errored: Retryable error: Error uploading script: Process exited with status 1
==> Some builds didn't complete successfully and had errors: --> virtualbox-iso: Retryable error: Error uploading script: Process exited with status 1
==> Builds finished but no artifacts were created. Error building the Vagrant box using Packer. Please check the output above for any error messages. At C:\Users\dd099\Documents\metasploitable3\build_win2008.ps1:108 char:9