Uninstall and remove ITSM, ITSM updater, RMM, and Patch Management

Hi Everyone,

Please refer attached script to uninstall and remove ITSM, ITSM updater, RMM, and Patch Management.

Note:

Script should be run as a system user.

You would not able to get any output for this script,only device will be disconnected from ITSM.



import os
import ctypes


temp=os.environ['PROGRAMDATA']+r'	emp'
if not os.path.isdir(temp):
    os.mkdir(temp)


class disable_file_system_redirection:
    _disable = ctypes.windll.kernel32.Wow64DisableWow64FsRedirection
    _revert = ctypes.windll.kernel32.Wow64RevertWow64FsRedirection
    def __enter__(self):
        self.old_value = ctypes.c_long()
        self.success = self._disable(ctypes.byref(self.old_value))
    def __exit__(self, type, value, traceback):
        if self.success:
            self._revert(self.old_value)


vbs=r'''
Dim sCmd1
Dim sCmd2
Dim sCmd3
Dim sCmd4
Dim WshShell

sCmd1="wmic product where name=""Comodo One Patch Management Agent"" call uninstall"
sCmd2="wmic product where name=""RMM Agent Service"" call uninstall"
sCmd3="wmic product where name=""COMODO Client - Communication Updater"" call uninstall"
sCmd4="wmic product where name=""COMODO Client - Communication"" call uninstall"

Set WshShell = WScript.CreateObject("WScript.Shell")
WshShell.Run sCmd1,0, True
WScript.Sleep 10
WshShell.Run sCmd2,0, True
WScript.Sleep 10
WshShell.Run sCmd3,0, True
WScript.Sleep 10
WshShell.Run sCmd4,0, True

'''

with open(temp+r'\uninstall.vbs',"wb") as f :
    f.write(vbs)        

with disable_file_system_redirection():
    print os.popen('cscript.exe "'+temp+'\uninstall.vbs"').read()
print("Uninstalled successfully") 

if os.path.isfile(temp+r'\uninstall.vbs'):
    os.remove(temp+r'\uninstall.vbs')




20170601-Uninstall-and-remove-ITSM-ITSM-updater-RMM-and-Patch-Management.json (2.35 KB)