ビデオヘルプ

Install/Uninstall Scripts for Installing/Uninstalling Packages

作成: 19 Jul 2012 | コメント数: 9
各国語の翻訳
CableGuy41 の写真
+9 得票数: 9
ログインして投票

Though we package applications using the following methods,

1. Setup Capture method to produce MSI file
2. TRANSFORM method  creation to produce MST file
3. Silent response methods to produce ISS file etc...

We still need an install script that will install the package in the commandline. We often use BATCH files and VBScript files. For VBScript install scripts my friend ESHWAR has written an excellent article:

Installation Wrapper [vbscript] with Reboot Timeout for Software Delivery

I'm going to use command files [Install.cmd/Uninstall.cmd] for my day-to-day packaging and deployment in windows7x64 environment. Following is the default template that I use in my current project and I hope this can be useful for most of you who have not implemented or about to implement standards around install scripts.

Requirements:

1. The application should be installed in near silent or silent mode
2. standard LOG file should be generated under C:\SWDLogs folder
3. Exit codes 0, 1641 & 3010 means success and everything else is failure 

Install.cmd

=======================================================================================
Set MsiName=PKGID-VENDOR-APPLICATION_NAME-VERSION-1.0.msi
Set UPN=PKGID-VENDOR-APPLICATION_NAME-VERSION-1.0
Set LogFolder="C:\SWDLogs\%UPN%_Install.log"
if not exist "C:\SWDLogs" md "C:\SWDLogs"
 
msiexec.exe /i "%~dp0%MsiName%" /qb-! /l*v %LogFolder%
 
set insterror=%errorlevel%
if %insterror%==0 goto :Misc
if %insterror%==1641 goto :Misc
if %insterror%==3010 goto :Misc
 
goto :ERROR
 
:Misc
@echo Successfully Installed APPLICATION_NAME
goto :Einde
 
:ERROR
@echo Error Code is %insterror%if exist %LogFile% type %LogFile%
goto :Einde
 
:Einde
@echo Job ended at %date% %Time%

Exit %insterror% 

=======================================================================================

Uninstall.cmd

=======================================================================================

Set MsiName=PKGID-VENDOR-APPLICATION_NAME-VERSION-1.0.msi
Set UPN=PKGID-VENDOR-APPLICATION_NAME-VERSION-1.0
Set LogsFolder="C:\SWDLogs\%UPN%_Install.log"
if not exist "C:\SWDLogs" md "C:\SWDLogs"
 
msiexec.exe /x {A5D4DE6F-62F0-46B8-82AF-174FFC021157} /qb-! /l*v %LogFolder%
 
set uninsterror=%errorlevel%
if %uninsterror%==0 goto :Misc
if %uninsterror%==1641 goto :Misc
if %uninsterror%==3010 goto :Misc
 
 
goto :ERROR
 
:Misc
@echo Successfully Uninstalled APPLICATION_NAME
goto :Einde
 
:ERROR
@echo Error Code is %uninsterror%if exist %LogFile% type %LogFile%
goto :Einde
 
:Einde
@echo Job ended at %date% %Time%

Exit %uninsterror% 

=======================================================================================
 
Please make sure to place the Install.cmd & Uninstall.cmd files in the same folder as the package files [MSI & MST].
 

Some useful Naming Conventions:

Naming conventions plays a major role in standardizing the processes. We have the following naming conventions:

In case of Setup Capture MSI name should be as follows:

PKGID-Vendor-ApplicationName-Version-ReleaseVersion.MSI

In case of Transform creation method, MSI name should not be modified. However the TRANSFORM name should be as follows:

PKGID-Vendor-ApplicationName-Version-ReleaseVersion.MST

PKGID is a unique identifier for each package. Release Version starts from 1.0 and incremented when the package is reworked. This will ensure the tracking of how many times the package has been reworked.

I hope this information helps somebody. Thank you. 

コメント コメント数: 9最新のコメントを表示

Param_C の写真

do you have more scripts? 

Cheers,

Param

+2
ログインして投票
  • アクション
CableGuy41 の写真

i have a lot of packaging scripts. will try to upload whenever I can.

Thanks,

CableGuy
Do not forget to mark a SOLUTION

+1
ログインして投票
  • アクション
jpmaestro の写真
How can I create a script wrapper for uninstalling the bellow string asuming that I have the uninst_setup.iss file saved on desktop?

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

I can uninstall the string manually if I copy the uninst_setup.iss file to c:\temp then ran the above string in cmd.

I just need help on creating a wrapper to uninstall it on one shot through SCCM.

Thanks

0
ログインして投票
  • アクション
CableGuy41 の写真

You can create a simple VBscript that does this job. However location of the ISS file is very important. If it is under user's desktop folder then folder path in windows 7 will be C:\Users\<UserName>\Desktop. If the user file is under all user's desktop folder then the path will be C:\Users\Public\desktop.

Please note that SCCM will not have access to the user's profile as the software deployment will be carried out under SYSTEM account. So please let us know the Operating system and file path so that I can share you the script.

Thanks,

CableGuy
Do not forget to mark a SOLUTION

+1
ログインして投票
  • アクション
jpmaestro の写真

Thanks. the folder path will be C:\Users\<UserName>\Desktop\Install

If you can please share the script for both Windows 7 and windows XP

thanks

0
ログインして投票
  • アクション
HK101 の写真

useful script.

0
ログインして投票
  • アクション
Ambesh_444 の写真

Thanks a lot for sharing script...

Thank& Regards,

Ambesh

"Your satisfaction is very important to us. If you find above information helpful or it has resolved your issue. Please don't forget to mark the thread as solved."

0
ログインして投票
  • アクション
efyuze の写真

Hello,
firstly, I would like to thank you for sharing your script.

Would your script also work for .exe?

thanks

0
ログインして投票
  • アクション
CableGuy41 の写真

You can repleace the following line with your EXE install/uninstall command:

msiexec.exe /x {A5D4DE6F-62F0-46B8-82AF-174FFC021157} /qb-! /l*v %LogFolder%

Example:

"%~dp0Setup.exe" -silent

Thanks,

CableGuy
Do not forget to mark a SOLUTION

0
ログインして投票
  • アクション