1 2 Previous Next 21 Replies Latest reply on Sep 28, 2016 9:37 PM by LucD

    powercli to install vmware tools on windows 7

    esxi1979 Hot Shot

      Hello,

       

      i need to install vmware tools on few windows 7 vms

       

      i came across

       

      https://communities.vmware.com/servlet/JiveServlet/previewBody/12413-102-3-13329/VMware%20Tools%20-%20Unattended_Install…

       

      ie

       

      msiexec /i "VMware Tools.msi" ADDLOCAL=ALL REMOVE="Hgfs,WYSE,GuestSDK,vmdesched" /qn /l* C:\temp\toolsinst.log /norestart

       

       

       

      Also something of sort below ..

       

       

      https://gist.github.com/sneal/eeb52e859186ba44163d

      (New-Object System.Net.WebClient).DownloadFile($download_url, "c:\windows\temp\$iso_name")
      &c:\7-zip\7z.exe x "c:\windows\temp\$iso_name" -oc:\windows\temp\vmware -aoa | Out-Host

      &c:\windows\temp\vmware\setup.exe /S /v`"/qn REBOOT=R`" |


      Out-Host

       

       

       

      i have used,

      Mount-Tools,

       

      And have mounted the ISO

       

      Can somehow we can do this automation with powercli or powershell ?

       

      I want to use domain id & if that does not work a local admin account to comeplete the install.

        • 1. Re: powercli to install vmware tools on windows 7
          LucD Guru
          Community WarriorsUser ModeratorsvExpert

          When the ISO is mounted in the VM, you could use the Invoke-Command cmdlet with the ComputerName parameter, to remotely start the setup.exe.

          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
          • 2. Re: powercli to install vmware tools on windows 7
            esxi1979 Hot Shot

            LucD

             

            I found below in our forum ..

             

             

             

             

            Import-Module VMware.VimAutomation.Cis.Core

            Import-Module VMware.VimAutomation.Core

            Import-Module VMware.VimAutomation.HA

            Import-Module VMware.VimAutomation.Sdk

            Import-Module VMware.VimAutomation.Storage

            Import-Module VMware.VimAutomation.Vds

             

             

             

             

             

            $username =  "xx"

             

             

            $password = "xx" | ConvertTo-SecureString -asPlainText -Force

            $Credentials = New-Object System.Management.Automation.PSCredential ($username,$password)

             

             

             

             

             

             

             

               $VM = "xx"

               Get-vm $VM | Dismount-Tools

               Get-vm $VM | Mount-Tools

               $RMsession = New-PSSession -ComputerName $VM -Credential $Credentials

               Invoke-Command -Session $RMSession -ScriptBlock {$CDRom = Get-WmiObject -class Win32_CDROMDrive | select Drive | ForEach {$_.Drive}}

               Invoke-Command -Session $RMSession -ScriptBlock {$Subpath = '\setup.exe -s -v-qn ADDLOCAL=ALL REBOOT=R'}

               Invoke-Command -Session $RMSession -ScriptBlock {$ExecuteEXE = Join-Path -Path $CDRom -ChildPath $Subpath}

               Invoke-Command -Session $RMSession -ScriptBlock {start-process $executeEXE}

             

            ==

             

            Err

             

             

            New-PSSession : One or more computer names are not valid. If you are trying to pass a URI, use the -ConnectionUri parameter, or pass URI objects instead of strings.

            At line:1 char:17

            +    $RMsession = New-PSSession -ComputerName $VM -Credential $Credentials

            +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                + CategoryInfo          : InvalidArgument: (System.String[]:String[]) [New-PSSession], ArgumentException

                + FullyQualifiedErrorId : PSSessionInvalidComputerName,Microsoft.PowerShell.Commands.NewPSSessionCommand

             

            ===

             

            Any suggestion Please 

            • 3. Re: powercli to install vmware tools on windows 7
              esxi1979 Hot Shot

               

              PowerCLI C:\>    $RMsession = New-PSSession -ComputerName $VM -Credential $Credentials

              New-PSSession : [xx-xx] Connecting to remote server xx-xx failed with the following error message : WinRM cannot complete the operati

              At line:1 char:17

              +    $RMsession = New-PSSession -ComputerName $VM -Credential $Credentials

              +                 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

                  + CategoryInfo          : OpenError: (System.Manageme....RemoteRunspace:RemoteRunspace) [New-PSSession], PSRemotingTransportException

                  + FullyQualifiedErrorId : WinRMOperationTimeout,PSSessionOpenFailed

               

               

               

              Above is new err

              • 4. Re: powercli to install vmware tools on windows 7
                esxi1979 Hot Shot

                fixed with

                 

                 

                 

                https://technet.microsoft.com/en-us/magazine/ff700227.aspx

                 

                 

                 

                now i get the err

                 

                This command cannot be executed due to the error: The system cannot find the file specified.

                    + CategoryInfo          : InvalidOperation: (:) [Start-Process], InvalidOperationException

                    + FullyQualifiedErrorId : InvalidOperationException,Microsoft.PowerShell.Commands.StartProcessCommand

                    + PSComputerName        : xx-xx

                • 5. Re: powercli to install vmware tools on windows 7
                  esxi1979 Hot Shot

                  WinRM is all set

                   

                  I tested that works fine with

                   

                  Invoke-Command -ComputerName  $VM -Credential $Credentials  -ScriptBlock { Get-ChildItem C:\ }

                  • 6. Re: powercli to install vmware tools on windows 7
                    LucD Guru
                    User ModeratorsvExpertCommunity Warriors

                    Is the CD available inside the guest OS after the Mount-Tools cmdlet?

                    From the error it looks it isn't.

                    Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                    • 7. Re: powercli to install vmware tools on windows 7
                      esxi1979 Hot Shot

                      It is available

                      • 8. Re: powercli to install vmware tools on windows 7
                        esxi1979 Hot Shot

                        i can see files

                         

                        PowerCLI C:\> Invoke-Command -ComputerName  $VM -Credential $Credentials  -ScriptBlock { Get-ChildItem D:\ }

                         

                         

                         

                         

                            Directory: D:\

                         

                         

                         

                         

                        Mode                LastWriteTime     Length Name

                        ----                -------------     ------ ----

                        d----         8/20/2015   4:08 AM            Program Files

                        --r--         8/20/2015   4:08 AM     599232 VMwareToolsUpgrader.exe

                        --r--         8/20/2015   4:08 AM      55802 autorun.ico

                        --r--         8/20/2015   4:08 AM        100 autorun.inf

                        --r--         8/20/2015   4:08 AM         23 certified.txt

                        --r--         8/20/2015   4:08 AM       2953 manifest.txt

                        --r--         8/20/2015   4:08 AM   38275672 setup.exe

                        --r--         8/20/2015   4:08 AM   49833632 setup64.exe

                        • 9. Re: powercli to install vmware tools on windows 7
                          LucD Guru
                          vExpertCommunity WarriorsUser Moderators

                          The error seems to be indicating that the setup.exe is not found.

                          Could you show the script/commands you are using?

                          Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                          • 10. Re: powercli to install vmware tools on windows 7
                            esxi1979 Hot Shot

                            not clear what you need

                             

                            but the script is below one

                             

                             

                               $VM = "xx"

                               Get-vm $VM | Dismount-Tools

                               Get-vm $VM | Mount-Tools

                               $RMsession = New-PSSession -ComputerName $VM -Credential $Credentials

                               Invoke-Command -Session $RMSession -ScriptBlock {$CDRom = Get-WmiObject -class Win32_CDROMDrive | select Drive | ForEach {$_.Drive}}

                               Invoke-Command -Session $RMSession -ScriptBlock {$Subpath = '\setup.exe -s -v-qn ADDLOCAL=ALL REBOOT=R'}

                               Invoke-Command -Session $RMSession -ScriptBlock {$ExecuteEXE = Join-Path -Path $CDRom -ChildPath $Subpath}

                               Invoke-Command -Session $RMSession -ScriptBlock {start-process $executeEXE}

                            • 11. Re: powercli to install vmware tools on windows 7
                              LucD Guru
                              Community WarriorsvExpertUser Moderators

                              Can you try like this?

                               

                              $VM = "xx"

                              Get-vm $VM | Dismount-Tools

                              Get-vm $VM | Mount-Tools

                              $RMsession = New-PSSession -ComputerName $VM -Credential $Credentials

                               

                              Invoke-Command -Session $RMSession -ScriptBlock {

                                  $CDRom = Get-WmiObject -class Win32_CDROMDrive | select Drive | ForEach {$_.Drive}

                                  $setExe = '\setup.exe'

                                  $arguments = '-s -v-qn ADDLOCAL=ALL REBOOT=R'

                                  $ExecuteEXE = Join-Path -Path $CDRom -ChildPath $setExe

                                  Start-Process -FilePath $executeEXE -ArgumentList $arguments

                              }

                               

                              Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                              • 12. Re: powercli to install vmware tools on windows 7
                                esxi1979 Hot Shot

                                LucD

                                 

                                This time the script ran with no err

                                 

                                But the tools are not installed

                                 

                                I waited for 15 min now.

                                 

                                i did not see in "active task" any message saying tools are being installed

                                • 13. Re: powercli to install vmware tools on windows 7
                                  LucD Guru
                                  Community WarriorsvExpertUser Moderators

                                  Can you try running the lines in the scriptblock directly inside the guest OS?

                                  I'm wondering if there might be a prompt or a message, that makes the remote job hang as well

                                  Blog: http://lucd.info | Twitter: @LucD22 | PowerCLI Reference co-author: http://tinyurl.com/hkn4glz
                                  • 14. Re: powercli to install vmware tools on windows 7
                                    esxi1979 Hot Shot

                                    LucD

                                     

                                    Sorry for delay,

                                     

                                    I kept a login on the box & ran the script

                                     

                                    It was stuck at attached

                                    1 2 Previous Next