Reply
Old January 5th, 2006 Top | #1
 
johnsonlim027's Avatar
OSNN Junior Addict
Joined: December 2005
Posts: 26
Reputation: 10
Power: 79

Default Script to install and uninstall program

I am going to write a script that run at the server to install and uninstall a particular program frrom the client once the user login to the domain.Does anyone have any idea or sample code to show?I have only the concept to write the script but have no idea to code it...first time doing this..
johnsonlim027 is offline   Reply With Quote
Old January 5th, 2006 Top | #2

OSNN Folding Team  
fitz's Avatar
XPista7eopard*ix
Joined: April 2004
Location: Chicagoland
Posts: 4,028
Reputation: 2947
Power: 168

Default Re: Script to install and uninstall program

well.. gee..

what kind of program? what OS? what script language? is this an MSI install? Why not use GPO's?
fitz is offline   Reply With Quote
Old January 5th, 2006 Top | #3
 
madmatt's Avatar
Bow Down to the King
Joined: April 2002
Location: New York
Posts: 13,312
Reputation: 4090
Power: 297

Default Re: Script to install and uninstall program

fitz is right. It depends on the OS and what kind of programs (i.e. executables, MSI, etc.)

Your best bet is to open command prompt, navigate to the directory where the file is, and typing "[program].[exe|msi] /?". Doing this will display the switches for such a program. A lot of executables and MSI have uninstall switches, some don't.

However, here is a script I wrote to update post-SP2 (XP) machines.

Code:
CLS
@echo off
TITLE Finalizing Windows XP Pro SP2

ECHO.
ECHO Installing HighMAT Extension for CD Writing Wizard...
ECHO Please Wait...
start /wait %systemdrive%\install\HMTCDWizard_enu.exe /qn

ECHO.
ECHO Installing Microsoft .NET Framework 2.0...
ECHO Please Wait...
start /wait %systemdrive%\install\dotnetfx\install.exe /qn

ECHO.
ECHO Installing PowerToy: Alt-Tab Replacement...
ECHO Please Wait...
start /wait %systemdrive%\install\pt-alttab.exe /s /v/qn

ECHO.
ECHO Installing PowerToy: ClearType Tuner...
ECHO Please Wait...
start /wait %systemdrive%\install\pt-ctype.exe /s /v/qn

ECHO.
ECHO Installing PowerToy: Image Resizer...
ECHO Please Wait...
start /wait %systemdrive%\install\pt-image.exe /s /v/qn

ECHO.
ECHO Installing PowerToy: Open Command Window Here...
ECHO Please Wait...
start /wait %systemdrive%\install\pt-cmdwin.exe /s /v/qn

ECHO.
ECHO Installing Tweak UI 2.10...
ECHO Please Wait...
start /wait %systemdrive%\install\tweakui.exe

ECHO.
ECHO Installing Windows Media Player 10...
ECHO Please Wait...
start /wait %systemdrive%\install\MP10Setup.exe /q

ECHO.
ECHO Installing Windows Media Connect 2.0...
ECHO Please Wait...
start /wait %systemdrive%\install\wmcsetup.exe /quiet

ECHO.
ECHO Installing Windows Messenger 5.1...
ECHO Please Wait...
start /wait %systemdrive%\install\messenger.msi /qn

ECHO.
ECHO Installing Windows Update Agent 2.0...
ECHO Please Wait...
start /wait %systemdrive%\install\updateagent\wusetup.exe /quiet

ECHO.
ECHO Beginning Windows Cleanup...

ECHO.
ECHO Applying Registry Tweaks...
REGEDIT /S "%systemdrive%\install\regtweaks.reg"

ECHO.
ECHO Copying System32 Files...
XCOPY "%systemdrive%\install\copy\oeminfo.ini" "%systemroot%\system32" /Q /Y
XCOPY "%systemdrive%\install\copy\oemlogo.bmp" "%systemroot%\system32" /Q /Y
XCOPY "%systemdrive%\install\copy\uptime.exe" "%systemroot%\system32" /Q /Y

ECHO.
ECHO Deleting Wallpapers...
DEL /Q "%systemroot%\*.bmp"
DEL /Q "%systemroot%\Web\Wallpaper\*.jpg"

ECHO.
ECHO Deleting Temp Files...
DEL /S /Q "%userprofile%\Local Settings\Temp\*.*"
DEL /S /Q "%systemroot%\Temp\*.*"

ECHO.
ECHO Deleting Shortcuts...
DEL /Q "%allusersprofile%\Start Menu\Activate Windows.lnk"
DEL /Q "%allusersprofile%\Start Menu\Windows Catalog.lnk"

ECHO.
ECHO Setting Up Start Menu...
MKDIR "%allusersprofile%\Start Menu\Programs\Tools"
MOVE /Y "%allusersprofile%\Start Menu\Programs\Accessories\Accessibility" "%allusersprofile%\Start Menu\Programs\Tools"

MKDIR "%userprofile%\Start Menu\Programs\Tools"
MOVE /Y "%allusersprofile%\Start Menu\Windows Update.lnk" "%userprofile%\Start Menu\Programs\Tools"
MOVE /Y "%allusersprofile%\Start Menu\Set Program Access and Defaults.lnk" "%userprofile%\Start Menu\Programs\Tools"
MOVE /Y "%allusersprofile%\Start Menu\Programs\Accessories\Communications" "%userprofile%\Start Menu\Programs\Tools"
MOVE /Y "%allusersprofile%\Start Menu\Programs\Accessories\System Tools" "%userprofile%\Start Menu\Programs\Tools"
MOVE /Y "%userprofile%\Start Menu\Programs\Remote Assistance.lnk" "%userprofile%\Start Menu\Programs\Tools"
MOVE /Y "%userprofile%\Start Menu\Programs\Accessories\Accessibility" "%userprofile%\Start Menu\Programs\Tools"
XCOPY "%userprofile%\Start Menu\Programs\Accessories\Command Prompt.lnk" "%userprofile%\Start Menu\Programs\Tools" /Q /Y
XCOPY "%userprofile%\Start Menu\Programs\Accessories\Notepad.lnk" "%userprofile%\Start Menu\Programs\Tools" /Q /Y
XCOPY "%userprofile%\Start Menu\Programs\Accessories\Windows Explorer.lnk" "%userprofile%\Start Menu\Programs\Tools" /Q /Y
XCOPY "%userprofile%\Start Menu\Programs\Tools\Communications\Remote Desktop Connection.lnk" "%userprofile%\Start Menu\Programs\Tools" /Q /Y

MOVE /Y "%allusersprofile%\Start Menu\Programs\Powertoys for Windows XP\Tweak UI.lnk" "%userprofile%\Start Menu\Programs\Tools"
RD /S /Q "%allusersprofile%\Start Menu\Programs\Powertoys for Windows XP"
RD /S /Q "%userprofile%\Start Menu\Programs\Powertoys for Windows XP"

MKDIR "%allusersprofile%\Start Menu\Programs\Microsoft"
MOVE /Y "%allusersprofile%\Start Menu\Programs\Accessories\Entertainment" "%allusersprofile%\Start Menu\Programs\Microsoft"
MOVE /Y "%allusersprofile%\Start Menu\Programs\Windows Media Connect.lnk" "%allusersprofile%\Start Menu\Programs\Microsoft\Entertainment"
MOVE /Y "%allusersprofile%\Start Menu\Programs\Windows Movie Maker.lnk" "%allusersprofile%\Start Menu\Programs\Microsoft"

MKDIR "%userprofile%\Start Menu\Programs\Microsoft"
MOVE /Y "%allusersprofile%\Start Menu\Programs\Windows Messenger.lnk" "%userprofile%\Start Menu\Programs\Microsoft"
MOVE /Y "%userprofile%\Start Menu\Programs\Accessories\Entertainment" "%userprofile%\Start Menu\Programs\Microsoft"
XCOPY "%userprofile%\Start Menu\Programs\Internet Explorer.lnk" "%userprofile%\Start Menu\Programs\Microsoft" /Q /Y
XCOPY "%userprofile%\Start Menu\Programs\Windows Media Player.lnk" "%userprofile%\Start Menu\Programs\Microsoft" /Q /Y

ECHO.
ECHO Windows Cleanup Complete

PAUSE

DEL /S /Q "%userprofile%\Desktop\Connect to the Internet.lnk"
DEL /S /Q "%userprofile%\Start Menu\Programs\Outlook Express.lnk"

ECHO.
ECHO Restarting Windows...
shutdown.exe -r -f -t 60 -c "Windows will be restarted in 60 seconds..."

ECHO.
ECHO Deleting Installation Files...
RD /S /Q %systemdrive%\install

EXIT

madmatt is offline   Reply With Quote
Old January 6th, 2006 Top | #4
 
johnsonlim027's Avatar
OSNN Junior Addict
Joined: December 2005
Posts: 26
Reputation: 10
Power: 79

Default Re: Script to install and uninstall program

I am going to install Open Office 2.0 and uninstall Open Office 1.1.4 from the client computer.All the client computer are using Windows XP Professional.I am going to write the script using Visual Basic Script or batch file format.Is there any web site to recommend?
Thanks MADMATT AND FITZ !!
johnsonlim027 is offline   Reply With Quote
Old January 6th, 2006 Top | #5
 
madmatt's Avatar
Bow Down to the King
Joined: April 2002
Location: New York
Posts: 13,312
Reputation: 4090
Power: 297

Default Re: Script to install and uninstall program

If in fact you are going to use scripting to accomplish this task you will need the switches (and silent switches). You can refer to my post for more information or search the web for "BATCH SCRIPTING".

madmatt is offline   Reply With Quote
Old January 6th, 2006 Top | #6
 
johnsonlim027's Avatar
OSNN Junior Addict
Joined: December 2005
Posts: 26
Reputation: 10
Power: 79

Default Re: Script to install and uninstall program

What is the silent switches that you mean?I don't understand..MadMatt, how I put in the script and where to put in the script so that it will run at the OU level..
johnsonlim027 is offline   Reply With Quote
Old January 9th, 2006 Top | #7
 
johnsonlim027's Avatar
OSNN Junior Addict
Joined: December 2005
Posts: 26
Reputation: 10
Power: 79

Default Re: Script to install and uninstall program

my code is as follow:

CLS
@echo off
ECHO.
ECHO Installing OO 2.0
ECHO Please Wait...
start /wait %systemdrive%\OO2.0\setup.exe /qn


When I try to run it in the command prompt,nothing is coming out but suppose the Install menu should come out and allow user to install the program.Does anyone have idea on this on what is mising out?
johnsonlim027 is offline   Reply With Quote
Old January 9th, 2006 Top | #8

OSNN Folding Team  
fitz's Avatar
XPista7eopard*ix
Joined: April 2004
Location: Chicagoland
Posts: 4,028
Reputation: 2947
Power: 168

Default Re: Script to install and uninstall program

Originally Posted by johnsonlim027
my code is as follow:

CLS
@echo off
ECHO.
ECHO Installing OO 2.0
ECHO Please Wait...
start /wait %systemdrive%\OO2.0\setup.exe /qn


When I try to run it in the command prompt,nothing is coming out but suppose the Install menu should come out and allow user to install the program.Does anyone have idea on this on what is mising out?
1) I'm assuming that you have a c:\OO2.0\setup.exe copied out to each workstation that you are going to install this to - because if your batch file is referencing the %systemdrive% that will be the local HD on the machine.

2) Is the /qn switch for the setup.exe a valid switch?

3) Do you want the user to have to walk through the install? Or do you want it to be a completly scripted install without user input?

Check out some of the installation documentation already available for Open Office.. here, in particular, are some that might be helpful to you:

How do I perform a silent install?

How can I install OpenOffice.org so that it can be used by multiple users on the same machine?

Is it possible to install OpenOffice.org without the user having to input data?
fitz is offline   Reply With Quote

Reply

Bookmarks

Thread Tools

Posting Rules

Similar Threads
Thread Thread Starter Forum Replies Last Post
can't uninstall program perris Portable Devices & Gadgets 0 December 23rd, 2005 1:59am
Install / Uninstall Problems Ohzopants Windows Desktop Systems 1 April 16th, 2004 11:12pm
Problem to uninstall program!!!! cobraab Windows Desktop Systems 6 September 24th, 2002 12:57pm
error when trying to uninstall a program? gote Windows Desktop Systems 2 February 9th, 2002 7:14pm
IE 6 Uninstall/Re-Install procedure? xp dude Windows Desktop Systems 1 January 6th, 2002 9:08pm