User Tools

Site Tools


userspace:vmwaretoolswin

VMWare Tools 8.6.5 For Windows

Scripts and guide by Soren Birk

This package will check if the client is virtual, and if not then result in an isFatalError.

I have only created a setup-script for this package, since i dont see a reason for uninstalling VMware-Tools.

If you want an uninstall-package it should be fairly easy to create since the uninstall-file is located in the InstallDir.

Tested With:

  • OPSI 4.0.2.4
  • Winst 4.11.3.3
  • Windows 7, 32 and 64-Bit

Instructions:

  • (On a virtual host) mount VMware-disk by selecting: Guest → Install/Upgrade VMware Tools
  • Go to my computer and right-click on the virtual DVD-drive → select “Open…”
  • Copy all the files to vmwaretoolswin\CLIENT_DATA

Tree:

  ├ setup3264.ins
  ├ setup.exe
  ├ setup64.exe
  ├ vmwaretoolslogo.png
  ├ manifest.txt
  └ Program Files
    └ <subfolders/files>

setup3264.ins

; Author Soren Birk
 
[Actions]
requiredWinstVersion >= "4.11.2.6"
 
DefVar $LogDir$
DefVar $ProductId$  
DefVar $MinimumSpace$
DefVar $ExitCode$
DefVar $LicenseRequired$
DefVar $LicenseKey$
DefVar $LicensePool$
DefVar $INST_SystemType$
DefVar $INST_architecture$
DefVar $PCModel$
DefStringList $list$
 
Set $INST_SystemType$ = GetSystemType
set $INST_architecture$ = GetProductProperty("install_architecture","system specific")
Set $list$ = getOutStreamFromSection("DosInAnIcon_getmodel")
Set $PCModel$ = takeFirstStringContaining($list$,"VMware")
 
Set $LogDir$ = "%SystemDrive%\tmp"
 
; ----------------------------------------------------------------
; - Please edit the following values                             -
; ----------------------------------------------------------------
Set $ProductId$       = "vmwaretoolswin"
Set $MinimumSpace$    = "50 MB"
Set $LicenseRequired$ = "false"
Set $LicensePool$     = "p_" + $ProductId$
; ----------------------------------------------------------------
 
if not(HasMinimumSpace ("%SystemDrive%", $MinimumSpace$))
	LogError "Not enough space on %SystemDrive%, " + $MinimumSpace$ + " on drive %SystemDrive% needed for " + $ProductId$
	isFatalError "Ikke nok plads"
else
	comment "Display product logo"
	ShowBitmap "%ScriptPath%\vmwaretoolslogo.png" $ProductId$
 
	if contains($PCModel$, "VMware")
 
		if $LicenseRequired$ = "true"
			comment "Licensing required, reserve license and get license key"
			Sub_get_licensekey
		endif
 
		if (($INST_SystemType$ = "x86 System") and ($INST_architecture$ = "system specific")) or ($INST_architecture$ = "both") or ($INST_architecture$ = "32 only")
			Message "Installing " + $ProductId$ + " 32 Bit..."
			comment "Start setup-program"
			ChangeDirectory "%SCRIPTPATH%"
			Winbatch_install_32
			Sub_check_exitcode
 
			ExitWindows /Reboot
		endif
 
		if ($INST_SystemType$ = "64 Bit System") and (($INST_architecture$ = "system specific") or ($INST_architecture$ = "both") or ($INST_architecture$ = "64 only"))
			Message "Installing " + $ProductId$ + " 64 Bit..."
			comment "Start setup-program"
			ChangeDirectory "%SCRIPTPATH%"
			Winbatch_install_64
			Sub_check_exitcode
 
			ExitWindows /Reboot
		endif
	else
		isFatalError "The Computer doesnt seem to be virtual, installation will be skipped."
	endif
endif
 
[Winbatch_install_32]
"%ScriptPath%\Setup.exe" /S /v"/qn REBOOT=R"
 
[Winbatch_install_64]
"%ScriptPath%\Setup64.exe" /S /v"/qn REBOOT=R"
 
[DosInAnIcon_getmodel]
wmic computersystem get model
 
[Sub_get_licensekey]
if opsiLicenseManagementEnabled
	comment "License management is enabled and will be used"
 
	comment "Trying to get a license key"
	Set $LicenseKey$ = demandLicenseKey ($LicensePool$)
	; If there is an assignment of exactly one licensepool to the product the following call is possible:
	; Set $LicenseKey$ = demandLicenseKey ("", $ProductId$)
	;
	; If there is an assignment of a license pool to a windows software id, it is possible to use:
	; DefVar $WindowsSoftwareId$
	; $WindowsSoftwareId$ = "..."
	; Set $LicenseKey$ = demandLicenseKey ("", "", $WindowsSoftwareId$)
 
	DefVar $ServiceErrorClass$
	set $ServiceErrorClass$ = getLastServiceErrorClass
	comment "Error class: " + $ServiceErrorClass$
 
	if $ServiceErrorClass$ = "None"
		comment "Everything fine, we got the license key '" + $LicenseKey$ + "'"
	else
		if $ServiceErrorClass$ = "LicenseConfigurationError"
			LogError "Fatal: license configuration must be corrected"
			LogError getLastServiceErrorMessage
			isFatalError
		else 
			if $ServiceErrorClass$ = "LicenseMissingError"
				LogError "Fatal: required license is not supplied"
				isFatalError
			endif
		endif
	endif
else
	LogError "Fatal: license required, but license management not enabled"
	isFatalError
endif
 
[Sub_check_exitcode]
comment "Test for installation success via exit code"
set $ExitCode$ = getLastExitCode
; informations to exit codes see
; http://msdn.microsoft.com/en-us/library/aa372835(VS.85).aspx
; http://msdn.microsoft.com/en-us/library/aa368542.aspx
if ($ExitCode$ = "0")
	comment "Looks good: setup program gives exitcode zero"
else
	comment "Setup program gives a exitcode unequal zero: " + $ExitCode$
	if ($ExitCode$ = "1605")
		comment "ERROR_UNKNOWN_PRODUCT	1605	This action is only valid for products that are currently installed."
		comment "Uninstall of a not installed product failed - no problem"
	else
		if ($ExitCode$ = "1641")
			comment "looks good: setup program gives exitcode 1641"
			comment "ERROR_SUCCESS_REBOOT_INITIATED	1641	The installer has initiated a restart. This message is indicative of a success."
		else
			if ($ExitCode$ = "3010")
				comment "looks good: setup program gives exitcode 3010"
				comment "ERROR_SUCCESS_REBOOT_REQUIRED	3010	A restart is required to complete the install. This message is indicative of a success."
			else
				logError "Fatal: Setup program gives an unknown exitcode unequal zero: " + $ExitCode$
				isFatalError
			endif
		endif
	endif
endif
userspace/vmwaretoolswin.txt · Last modified: 2021/08/23 08:37 (external edit)