Hi,
please use this script procedure to terminate the RMM session once it was connected by RMM console. On termination, the script will create another available instance for future connection.
def ecmd(CMD, OUT=False):
import ctypes
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)
from subprocess import PIPE, Popen
with disable_file_system_redirection():
OBJ = Popen(CMD, shell = True, stdout = PIPE, stderr = PIPE)
out, err = OBJ.communicate()
return out.strip()
print ecmd('net stop CLPSLauncherEx')
print ecmd('taskkill /im unit_manager.exe /f')
print ecmd('taskkill /im unit.exe /f')
import os
os.remove("C:\ProgramData\comodo\lps4\lps-ca\configuration.cfg")
print ecmd('net start CLPSLauncherEx')
20170328-disConnectRMMSession.json (1.5 KB)
hi
with respect, small idea just to avoid possible error, if programdata path is diferent , or if file doesnt exist for some reason.
remove {os.remove(“C:\ProgramData\comodo\lps4\lps-ca\configuration.cfg”)}
add
file_remove=os.path.join(os.environ[‘ProgramData’],‘comodo\lps4\lps-ca\configuration.cfg’)
if os.path.exists(file_remove):
os.remove(file_remove)
Meena
August 21, 2017, 9:19am
3
Hi @phcsolutions
We have updated the script as per your feedback. Please use script attached in this post.
def ecmd(CMD, OUT=False):
import ctypes
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)
from subprocess import PIPE, Popen
with disable_file_system_redirection():
OBJ = Popen(CMD, shell = True, stdout = PIPE, stderr = PIPE)
out, err = OBJ.communicate()
return out.strip()
print ecmd('net stop CLPSLauncherEx')
print ecmd('taskkill /im unit_manager.exe /f')
print ecmd('taskkill /im unit.exe /f')
import os
file_remove=os.path.join(os.environ['ProgramData'],'comodo\lps4\lps-ca\configuration.cfg')
if os.path.exists(file_remove):
os.remove(file_remove)
print ecmd('net start CLPSLauncherEx')
Thanks
20170821-Terminate-RMM-session.json (1.66 KB)