methods/pe_client.rb
# Populate Windows VM Tools powershell script
Populate Windows VM Tools powershell script
Populate Windows VM Tools powershell script
def populate_vmtools_psh(options)
  vmtools_psh = []
  vmtools_psh.push("")
  if options['vmtools'] == true
    vmtools_psh.push("$isopath = \"C:\\Windows\\Temp\\windows.iso\"")
    vmtools_psh.push("Mount-DiskImage -ImagePath $isopath")
    vmtools_psh.push("function vmware {")
    vmtools_psh.push("$exe = ((Get-DiskImage -ImagePath $isopath | Get-Volume).Driveletter + ':\\setup.exe')")
    vmtools_psh.push("$parameters = '/S /v \"/qr REBOOT=R\"'")
    vmtools_psh.push("Start-Process $exe $parameters -Wait")
    vmtools_psh.push("}")
    vmtools_psh.push("function virtualbox {")
    vmtools_psh.push("$certpath = ((Get-DiskImage -ImagePath $isopath | Get-Volume).Driveletter + ':\\cert\\oracle-vbox.cer')")
    vmtools_psh.push("certutil -addstore -f \"TrustedPublisher\" $certpath")
    vmtools_psh.push("$exe = ((Get-DiskImage -ImagePath $isopath | Get-Volume).Driveletter + ':\\VBoxWindowsAdditions.exe')")
    vmtools_psh.push("$parameters = '/S'")
    vmtools_psh.push("Start-Process $exe $parameters -Wait")
    vmtools_psh.push("}")
    vmtools_psh.push("if ($ENV:PACKER_BUILDER_TYPE -eq \"vmware-iso\") {")
    vmtools_psh.push("    vmware")
    vmtools_psh.push("} else {")
    vmtools_psh.push("    virtualbox")
    vmtools_psh.push("}")
    vmtools_psh.push("Dismount-DiskImage -ImagePath $isopath")
    vmtools_psh.push("Remove-Item $isopath")
  end
  return vmtools_psh
end
def populate_vmtools_psh ( options ) vmtools_psh = [ ] vmtools_psh . push ( "" ) if options [ 'vmtools' ] == true vmtools_psh . push ( "$isopath = \"C:\\Windows\\Temp\\windows.iso\"" ) vmtools_psh . push ( "Mount-DiskImage -ImagePath $isopath" ) vmtools_psh . push ( "function vmware {" ) vmtools_psh . push ( "$exe = ((Get-DiskImage -ImagePath $isopath | Get-Volume).Driveletter + ':\\setup.exe')" ) vmtools_psh . push ( "$parameters = '/S /v \"/qr REBOOT=R\"'" ) vmtools_psh . push ( "Start-Process $exe $parameters -Wait" ) vmtools_psh . push ( "}" ) vmtools_psh . push ( "function virtualbox {" ) vmtools_psh . push ( "$certpath = ((Get-DiskImage -ImagePath $isopath | Get-Volume).Driveletter + ':\\cert\\oracle-vbox.cer')" ) vmtools_psh . push ( "certutil -addstore -f \"TrustedPublisher\" $certpath" ) vmtools_psh . push ( "$exe = ((Get-DiskImage -ImagePath $isopath | Get-Volume).Driveletter + ':\\VBoxWindowsAdditions.exe')" ) vmtools_psh . push ( "$parameters = '/S'" ) vmtools_psh . push ( "Start-Process $exe $parameters -Wait" ) vmtools_psh . push ( "}" ) vmtools_psh . push ( "if ($ENV:PACKER_BUILDER_TYPE -eq \"vmware-iso\") {" ) vmtools_psh . push ( "    vmware" ) vmtools_psh . push ( "} else {" ) vmtools_psh . push ( "    virtualbox" ) vmtools_psh . push ( "}" ) vmtools_psh . push ( "Dismount-DiskImage -ImagePath $isopath" ) vmtools_psh . push ( "Remove-Item $isopath" ) end return vmtools_psh end
Populate Windows VM Tools powershell script
Populate Windows VM Tools powershell script
options
<not_specific>