Installing VMware View Agent in a Task Sequence

Posted on

The VMware View agent is deployable as an MSI file and uses basic command line parameters.  However, I recently had significant difficulties with getting it to install within a ConfigMgr Task Sequence as part of an OS image deployment.  Despite that the agent could be installed manually using the parameters, in a TS the installer would fail (e.g. return a non-success exit code) and thus fail the TS.

Through investigation, the agent’s install log file (located in %windir%\temp\) stated error 1603 and a message that if failed due to a detected pending restart.  So in the TS, I added a pre-restart command prior to the install…..but that still did not solve the problem.  Several various other solutions were attempted, but all to no avail.

Eventually I found a VMware KB article which outlined the issue.  It was being caused by multiple registry keys – FileRenameOperations, Run, and RunOnce.  So I created  a quick batch script to

  1. Backup the reg keys to %windir%\temp
  2. Delete the reg keys
  3. Run the install
  4. Restore the reg keys
:: Backup problem registry keys for VMware Agent Install
reg.exe EXPORT "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager" c:\windows\temp\hklmsession.reg /y
reg.exe EXPORT "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" c:\windows\temp\hklmrun.reg /y
reg.exe EXPORT "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" c:\windows\temp\hklmrunonce.reg /y

:: Delete problematic registry keys
reg.exe DELETE "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager" /v PendingFileRenameOperations /f
reg.exe DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /va /f
reg.exe DELETE "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce" /va /f

:: Install VMware agent
xcopy "%~dp0VMware-viewagent-x86_64-5.0.1-640055.exe" c:\windows\temp /y
c:\windows\temp\VMware-viewagent-x86_64-5.0.1-640055.exe /s /v" /qn REBOOT=R"

:: Restore registry keys
reg.exe IMPORT c:\windows\temp\hklmsession.reg
reg.exe IMPORT c:\windows\temp\hklmrun.reg
reg.exe IMPORT c:\windows\temp\hklmrunonce.reg

del c:\windows\temp\hklm*.reg

However, this still wasn’t good enough to solve the problem! The .msi needed to be copied locally to execute AND this needed to be run with 64-bit redirection disabled.  It was a mess to figure out and test, but I was able to eventually discover the right combination to have the agent automatically in a Task Sequence!



3 thoughts on “Installing VMware View Agent in a Task Sequence

    Lazy Admin said:
    November 11, 2016 at 11:01 am

    I’ve been trying to solve this exact problem for a week now and just found this post. You’ve given me some hope that I’ve found a solution. I’m updating my task sequence now and will report back.

    Lazy Admin said:
    November 11, 2016 at 2:20 pm

    Thank you Nick Moseley! My updated task sequence worked like a charm. You might want to update the xcopy line in your script through, it seems that there are some special characters in the file name. Thanks again.

      N. Moseley responded:
      November 15, 2016 at 8:34 pm

      Excellent, I’m glad you found the fix you were searching for :-)

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s