static void Main(string[] args) { try { Console.Out.WriteLine("Preparing to clean VM"); Console.Out.WriteLine(" > Remove PV Drivers From Filters"); PVDriversPurge.RemovePVDriversFromFilters(); Console.Out.WriteLine(" > Don't Boot Start PV Drivers"); PVDriversPurge.DontBootStartPVDrivers(); Console.Out.WriteLine(" > Uninstall MSI Files"); PVDriversPurge.UninstallMSIs(); Console.Out.WriteLine(" > Uninstall Drivers and Devices"); PVDriversPurge.UninstallDriversAndDevices(); Console.Out.WriteLine(" > Clean up after ourselves"); Console.Out.WriteLine(" > Legacy"); PVDriversPurge.CleanUpXenLegacy(); Console.Out.WriteLine(" > Services"); PVDriversPurge.CleanUpServices(); Console.Out.WriteLine(" > Driver Files"); PVDriversPurge.CleanUpDriverFiles(); Console.Out.WriteLine("Done"); Console.Out.WriteLine(""); Console.Out.WriteLine(""); Console.Out.WriteLine("Please reboot the VM before continuing"); } catch (Exception e) { Console.Out.WriteLine("Failed. Please report the following message to your support engineer:"); Console.Out.WriteLine("VMCleaner Failure : " + e.ToString()); } }
private static bool PVDriversWipe() // Wipes the system clean of PV drivers. Has to be called // twice, with a VM reboot inbetween. Returns 'true' when // all actions are completed; 'false' otherwise { if (!Installer.GetFlag(Installer.States.RemovedFromFilters)) { PVDriversPurge.RemovePVDriversFromFilters(); Installer.SetFlag(Installer.States.RemovedFromFilters); } if (!Installer.GetFlag(Installer.States.BootStartDisabled)) { PVDriversPurge.DontBootStartPVDrivers(); Installer.SetFlag(Installer.States.BootStartDisabled); } if (!Installer.GetFlag(Installer.States.ProceedWithSystemClean)) // Makes Install Agent stop here the first time it runs { Installer.SetFlag(Installer.States.ProceedWithSystemClean); return(false); } if (!Installer.GetFlag(Installer.States.MSIsUninstalled)) { PVDriversPurge.UninstallMSIs(); Installer.SetFlag(Installer.States.MSIsUninstalled); } if (!Installer.GetFlag(Installer.States.DrvsAndDevsUninstalled)) { PVDriversPurge.UninstallDriversAndDevices(); Installer.SetFlag(Installer.States.DrvsAndDevsUninstalled); } if (!Installer.GetFlag(Installer.States.CleanedUp)) { PVDriversPurge.CleanUpXenLegacy(); PVDriversPurge.CleanUpServices(); PVDriversPurge.CleanUpDriverFiles(); Installer.SetFlag(Installer.States.CleanedUp); } return(true); }