PowerCLI

 View Only
  • 1.  mount vmware tools iso to vms and update

    Posted May 11, 2019 02:42 AM

    I got vmware tools windows iso windows.iso in a datastore that I need to mount to multiple vms and update the tools on with switch

    setup.exe /S /v "/qn REBOOT=R ADDLOCAL=ALL

    any idea how to do this?



  • 2.  RE: mount vmware tools iso to vms and update

    Posted May 11, 2019 04:11 AM

    I cannot use mount-tool because looks like my esxi hosts got installed without the vmwaretools image



  • 3.  RE: mount vmware tools iso to vms and update

    Posted May 11, 2019 04:21 AM

    trying this command after I copied the tools to local folder but getting this error

    invoke-command -computername $computername -scriptblock {start-process -filepath "c:\temp\windows\setup64.exe" -argumentlist "/S /v "/qn REBOOT=R ADDLOCAL=ALL""}



  • 4.  RE: mount vmware tools iso to vms and update

    Posted May 11, 2019 09:41 AM

    It's a quote thing

    Try like this

    $code = {

       Start-Process -FilePath "c:\temp\windows\setup64.exe" -ArgumentList '/S /v "/qn REBOOT=R ADDLOCAL=ALL"'

    }

    Invoke-Command -ComputerName $computername -ScriptBlock $code



  • 5.  RE: mount vmware tools iso to vms and update

    Posted May 11, 2019 10:15 PM

    not sure why it is still not working

    $vms = get-vm -name (get-content vms.txt)

    $source = "\\server\share\vmtools\windows"

    $code {start-process -filepath "c:\temp\windows\setup64.exe" -argumentlist '/S /v "/qn REBOOT=R ADDLOCAL=ALL"'}

    foreach ($vm in $vms){

    $destination = "\\$vm\c$\temp"

    copy-item -recurse -filter *.* -path $source -destination $destination -force

    invoke-command -computername $vm -scriptblock $code

    }

    the folder from the network share has been copied over an I can see the contents



  • 6.  RE: mount vmware tools iso to vms and update

    Posted May 11, 2019 10:43 PM

    I am trying it with a bat file and still dont work. but if I run the bat file manually on the machine it works any idea?

    $vms = get-vm -name (get-content vms.txt)

    $source = "\\server\share\vmtools\windows"

    $bat = {start-process -filepath "c:\temp\windows\install.bat"}

    foreach ($vm in $vms){

    $destination = "\\$vm\c$\temp"

    copy-item -recurse -filter *.* -path $source -destination $destination -force

    invoke-command -computername $vm -scriptblock $bat

    }

    install.bat is just

    c:\temp\windows\setup64.exe /S /v "/qn REBOOT=R ADDLOCAL=ALL"



  • 7.  RE: mount vmware tools iso to vms and update

    Posted May 12, 2019 02:41 PM

    You probably have to escape the 2nd $ sign in $destination = "\\$vm\c$\temp" with a back-tick.



  • 8.  RE: mount vmware tools iso to vms and update

    Posted May 13, 2019 02:35 PM

    hi lucd

    do you mean this?

    $destination = "\\$vm\c$\temp" '  ?



  • 9.  RE: mount vmware tools iso to vms and update

    Posted May 13, 2019 03:50 PM

    Yes, I assume you want to reach the administrative share of the C-drive.
    But a $ character in PS is handled as a special character.
    Try escaping it with a back-tick