SCCM용 스크립트 래퍼 생성

SCCM용 스크립트 래퍼 생성

uninst_setup.iss데스크탑에 파일이 저장 되어 있다고 가정하고 아래 문자열을 제거하기 위한 스크립트 래퍼를 어떻게 만들 수 있습니까 ?

C:\Program Files\InstallShield Installation Information\{4D9CA1B8-5FF5-47A7-8BDF-C37D1F9F55A5}\setup.exe" -l0x9 -removeonly -uninst /s /f1"c:\temp\uninst_setup.iss" /f2"c:\temp\setuppec.log

파일 을 복사한 uninst_setup.iss다음 c:\temp위의 문자열을 cmd.

SCCM을 통해 한 번에 제거하려면 래퍼를 만드는 데 도움이 필요합니다.

답변1

하드코딩된 임시 디렉터리를 사용해서는 안 됩니다. 아래 코드가 도움이 될 것입니다. SCCM(SYSTEM 계정)으로 이를 실행하면 임시 디렉터리는 %windir%\temp로 확인됩니다.

아래 코드가 포함된 스크립트(예: uninstaller.vbs)와 iss 파일을 SCCM 패키지에 추가합니다. 다음 명령을 사용하여 프로그램을 만듭니다. cscript.exe uninstaller.vbs

set wsh_shell = createobject("wscript.shell")
set fso = createobject("scripting.filesystemobject")

dq = chr(34)
source_path = fso.getparentfoldername(wscript.scriptfullname)
tmp_folder = fso.getSpecialFolder(2)
iss_file = "uninst_setup.iss"
log_file = "setuppec.log"

' Copy the iss file to the temp folder.
fso.copyFile fso.buildPath(source_path, iss_file), tmp_folder, true

' Build the command line
cmd = dq &"C:\Program Files\InstallShield Installation Information\{4D9CA1B8-5FF5-47A7-8BDF-C37D1F9F55A5}\setup.exe" &dq
cmd = cmd &" -l0x9 -removeonly -uninst /s /f1" &dq &fso.buildpath(tmp_folder, iss_file) &dq
cmd = cmd &" /f2" &dq &fso.buildpath(tmp_folder, log_file) &dq

' Run commandline and return exit code to sccm.
wscript.quit wsh_shell.run(cmd, 0, true)

관련 정보