This script will install CCS from a Network share. Please ensure that you have the specified setup file in the network share.
Steps to follow:
1.you have to pass the filepath, share_user, share_pass, Setup_Path_X64, Setup_Path_X86 in the parameter section.
Refer the wiki to run the procedure with parameters
https://wiki.comodo.com/frontend/web/topic/how-to-create-and-run-procedures-with-parameters
NOTE:
1.Enter_the_share_path:
TYPE: String
EM LABEL: Any name
Default value: "Enter your network share path location"
2..Enter_the_share_user :
TYPE: String
EM LABEL: Any name
Default value: "Enter the shared user name"
3.Enter_the_share_pass :
TYPE: String
EM LABEL: Any name
Default value: "Enter the password of the shared user"
4.Enter_the_share_setup_64:
TYPE: String
EM LABEL: Any name
Default value: "Enter the file name of the file in network share for 64 bit along with extension"
5.Enter_the_share_setup_32:
TYPE: String
EM LABEL: Any name
Default value: "Enter the file name of the file in network share for 32 bit along with extension"
For Example:
Run as SYSTEM USER
Filepath=itsm.getParameter('share_path') ##Provide the network share file path
share_user=itsm.getParameter('share_user') ## Provide the user name for the shared path
share_pass=itsm.getParameter('share_pass') ## Provide the password for the shared path
Setup_Path_X64=itsm.getParameter('share_setup_64') ## Enter the .msi file name for 64 bit
Setup_Path_X86=itsm.getParameter('share_setup_32') ## Enter the .msi file name for 32 bit
import os
import shutil
import ctypes
import subprocess
import socket
import time
from shutil import copyfile
path=r"C:\Program Files (x86)"
if os.path.exists(path):
NFN=Setup_Path_X64
else:
NFN=Setup_Path_X86
CP=os.path.join(Filepath,NFN)
workdir=os.environ["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)
def login(cmd,Filepath,CP):
with disable_file_system_redirection():
print 'Login to network share'
print os.popen(cmd).read()
print 'Copying file from Network share....'
print os.popen('copy "'+CP+'" '+workdir).read()
cmd= 'NET USE "'+Filepath+'" /USER:'+share_user+' "'+share_pass+'"'
login(cmd,Filepath,CP)
PTI=os.path.join(workdir,NFN)
CMD ='msiexec /i "'+PTI+'" /quiet REBOOT=ReallySuppress CESMCONTEXT=1 MAKE_CESM_DEFAULT_CONFIG=1 CES_SANDBOX=1 CES_FIREWALL=1 CES_ANTIVIRUS=1 '
os.popen(CMD)
if 'PROGRAMW6432' in os.environ.keys():
CMD_1='"C:\Program Files (x86)\ITarian\Endpoint Manager\ITSMService.exe" -c 4'
else:
CMD_1='"C:\Program Files\ITarian\Endpoint Manager\ITSMService.exe" -c 4'
with disable_file_system_redirection():
ping = subprocess.Popen(CMD_1,stdout=subprocess.PIPE,stderr = subprocess.PIPE,shell=True)
out=ping.communicate()[0]
output = str(out)
print output
os.remove(PTI)
Comments