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)

関連情報