From 7cbd7bf20918e3e2a238ac8341b35618e5103245 Mon Sep 17 00:00:00 2001 From: Pino Toscano Date: Wed, 7 Nov 2018 17:33:10 +0100 Subject: [PATCH] v2v: windows: uninstall VMware Tools It looks like VMware Tools support their unattended uninstallation even after the guest is not running anymore on VMware. --- v2v/convert_windows.ml | 27 ++++++++++++++++++++++++++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/v2v/convert_windows.ml b/v2v/convert_windows.ml index 8740afd1c..2d2b6adfe 100644 --- a/v2v/convert_windows.ml +++ b/v2v/convert_windows.ml @@ -192,6 +192,13 @@ let convert (g : G.guestfs) inspect source output rcaps = Some "PREVENT_REBOOT=Yes LAUNCHED_BY_SETUP_EXE=Yes" in unistallation_commands "Parallels Tools" matchfn extra_uninstall_string in + (* Locate and retrieve all uninstallation commands for VMware Tools. *) + let vmwaretools_uninst = + let matchfn s = + String.find s "VMware Tools" != -1 + in + unistallation_commands "VMware Tools" matchfn None in + (*----------------------------------------------------------------------*) (* Perform the conversion of the Windows guest. *) @@ -277,7 +284,8 @@ let convert (g : G.guestfs) inspect source output rcaps = configure_vmdp tool_path; unconfigure_xenpv (); - unconfigure_prltools () + unconfigure_prltools (); + unconfigure_vmwaretools () (* [set_reg_val_dword_1 path name] creates a registry key * called [name = dword:1] in the registry [path]. @@ -430,6 +438,23 @@ if errorlevel 3010 exit /b 0 "uninstall Parallels tools" fb_script ) prltools_uninsts + and unconfigure_vmwaretools () = + List.iter ( + fun uninst -> + let fb_script = "\ +@echo off + +echo uninstalling VMware Tools +" ^ uninst ^ +(* ERROR_SUCCESS_REBOOT_REQUIRED == 3010 is OK too *) +" +if errorlevel 3010 exit /b 0 +" in + + Firstboot.add_firstboot_script g inspect.i_root + "uninstall VMware Tools" fb_script + ) vmwaretools_uninst + and update_system_hive reg = (* Update the SYSTEM hive. When this function is called the hive has * already been opened as a hivex handle inside guestfs.