- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Install VMware Tools with VMware Sphere SDK
Can we install VMware tools with VMware Sphere SDK?
In vSphere API/SDK Documentation writes follows:
■ | MountToolsInstaller – Mounts the VMware Tools CD installer as a CD-ROM for the guest operating system. To monitor the status of the tools installallation, check GuestInfo.toolsStatus. Check GuestInfo.toolsVersionStatus and GuestInfo.toolsRunningStatus for related information. |
■ | UnmountToolsInstaller – Unmounts the VMware Tools installer CD. |
■ | UpgradeToolsTask – Performs an upgrade of VMware Tools. This method assumes VMware Tools has been installed and is running. The method takes one argument, InstallerOptions, which allows you to specify command-line options passed to the installer to modify the installation procedure for tools. |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Someone can solve this problem?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
You can wrap the following instructions with a GuestOps RunProgramInGuest call.
Others have also created custom installation scripts for VMware Tools that you can invoke as well.
Without VMware Tools, you won't have access to the GuestOperations API and your VM may not have proper drivers for network connectivity. For this reason, VMware Tools are usually baked into Templates and deployed by cloning and customization. However, if you can run some remote scripting execution, you can execute the remote installation process and reboot your VM.
For example, you could create a custom ISO image with the automated installation command in a batch file. Then use WMI to remotely execute it (may be some permission issues, been a while). May also be possible to use the autoplay functionality, though I know that has some caveats that may prevent an automated install. I have some customers who run an SSHD instance on their Windows VMs for consistency between Linux VMs for remote automation.
Linux is a similar process, but you may want to rebuild your tools package and pack it into an RPM or DEB file for simplicity of install.
Most tend to incorporate the tools installation process into their OS build process or templates. However, with a little automation and the right permissions you can remotely install them as well.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you please clarify what you are referring to by 'GuestOps' and 'RunProgramInGuest'? I am looking how to automate VMware Tools installation on Windows virtual machines using vSphere API with Perl SDK.
Thanks,
YM.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yes, so GuestOps lets you run scripts or progams in the GuestOS through the VMware Tools channel. However, since you are trying to install VMware Tools, that's not an option ![]()
In terms of automating the VMware Tools install, you can get more information from the vSphere 5 documentation. There's an option for unattended installation of VMware tools in vCenter.
Sorry, missed the original question. For API invocation, I haven't tried it, but UpgradeTools_Task() may be the solution. You'll see the installerOptions property, which is just a string command line argument. So I would guess despite the name it will also invoke the base setup.exe (and do an install). Never tried it myself though. I found a reference to using it with PowerCLI (which is the same API call) for installation, so once you have your command line arguments correct, should do what you need.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you for your response. I tried the suggested in the documentation arguments before posting my question but it didn't work, perhaps I am not doing it the right way:
$target_vm->UpgradeTools_Task('/S /v "/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs"');
throws the following exception:
Error: Failed to handle message: Undefined subroutine &Unexpected arguments: /S /v "/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs" at (eval 82) line 143
VimService::build_arg_string('ARRAY(0xae34d08)', 'HASH(0xae34c88)') called at (eval 82) line 3033
VimService::UpgradeTools_Task('VimService=HASH(0xb187868)', '_this', 'ManagedObjectReference=HASH(0xa8cb7f8)', '/S /v "/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs"', undef) called at .../VICommon.pm line 1699
ViewBase::invoke('VirtualMachine=HASH(0xb4106c8)', 'UpgradeTools_Task', '/S /v "/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs"', undef) called at ...
VirtualMachineOperations::UpgradeTools_Task('VirtualMachine=HASH(0xb4106c8)', '/S /v "/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs"') called at ...
Anything obvious I miss?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I think you forgot the installerOptions named parameter:
$target_vm->UpgradeTools_Task(installerOptions => qq|/S /v "/qn REBOOT=R ADDLOCAL=ALL REMOVE=Hgfs"|);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks, it doesn't fail now, but cannot install due to the following error:
Initiated VMware Tools install or upgrade
...
Cannot complete
operation because
VMware Tools is not
running in this
virtual machine.
I would expect it to install the VMware Tools if not present...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Yeah, afraid of that. You'll have to use WinRM or WMI to remote execute the tools installer. Or bake it into the Windows templates.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Understood, thanks!