a_user Posted March 13, 2009 Share Posted March 13, 2009 I know Im probably missing something very simple but Im amature when it comes to batch scripting. What I am trying to do is this. Remove symantec, Then check if sophos is installed (doing this by looking for a particular file in the sophos installation directory) if exists do nothing, if not exist then install.%windir%\system32\msiexec.exe /q /x {76B2BC31-2D96-4170-9C44-09E13B5555F3} /norestartIF EXIST ""C:\Program files\Sophos\savmain.exe" goto end\\ln-co-avs01\InterChk\ESXP\setup.exe -mng yes -user domain\username -pwd Pass#123 -sexiti can get it to uninstall symantec and then install sophos but it keeps reinstalling sophos to a client that already has it installed.your help would be greatly appreciated. Link to comment Share on other sites More sharing options...
gunsmokingman Posted March 14, 2009 Share Posted March 14, 2009 Cmd promt not my best but give this a try@Echo OffCLSColor f5Mode 62,7Title Anti Virus Change BrandSet Sophos="C:\Program files\Sophos\savmain.exe"If Exist %Sophos% Goto Work1If Not Exist %Sophos% Goto Work2:Work1CLSEcho.Echo Confirm %Sophos%ping -n 3 127.0.0.1>nulGoto TheEnd:Work2ClsEcho.Echo Preparing To Unistall SymantecStart /W %windir%\system32\msiexec.exe /q /x {76B2BC31-2D96-4170-9C44-09E13B5555F3} /norestartCLSEcho.Echo Preparing To Install SophosStart /W \\ln-co-avs01\InterChk\ESXP\setup.exe -mng yes -user domain\username -pwd Pass#123 -sCLSEcho.Echo Completed Sophos Installping -n 3 127.0.0.1>nulGoto TheEnd:TheEndExit Link to comment Share on other sites More sharing options...
MHz Posted March 14, 2009 Share Posted March 14, 2009 Another option. Using CMD in WinNT based systems is safe to use multiline statements so this avoids the goto feature.%systemroot%\system32\msiexec.exe /q /x {76B2BC31-2D96-4170-9C44-09E13B5555F3} /norestartIf Not Exist "%Programfiles%\Sophos\savmain.exe" ( \\ln-co-avs01\InterChk\ESXP\setup.exe -mng yes -user domain\username -pwd Pass#123 -s)Using Start /Wait is another option that gunsmokingman mentions that could be needed though I test without first up to see if successful.You can use the command 'If /?' at a command prompt to learn the usage of 'If'. 'Goto' is rather redundant in many of the latest programming languages so is perhaps good to avoid using if possible IMO unless you service 9x or earlier systems with scripts. Link to comment Share on other sites More sharing options...
Yzöwl Posted March 14, 2009 Share Posted March 14, 2009 What about gettting rid of live update too!MsiExec /norestart /q/x"{76B2BC31-2D96-4170-9C44-09E13B5555F3} REMOVE=ALL""%ProgramFiles%\Symantec\LiveUpdate\LSETUP.EXE" /U Link to comment Share on other sites More sharing options...
a_user Posted March 14, 2009 Author Share Posted March 14, 2009 (edited) Hey Guys,Thanks a ton for your replies and help. Especially to gunsmokingman. That worked perfectly! Yzowl, I added your line to remove liveupdate as well.Thanks again guys for the quick and thorough explanations. Edited March 14, 2009 by a_user Link to comment Share on other sites More sharing options...
Yzöwl Posted March 14, 2009 Share Posted March 14, 2009 You may wish to add the /q switch too:MsiExec /norestart /q/x"{76B2BC31-2D96-4170-9C44-09E13B5555F3} REMOVE=ALL""%ProgramFiles%\Symantec\LiveUpdate\LSETUP.EXE" /U /qBTW did you notice the REMOVE=ALL I added to your uninstallation command line! Link to comment Share on other sites More sharing options...
a_user Posted March 16, 2009 Author Share Posted March 16, 2009 Yes thank you. Makes for a very clean removal. Again, appreciate all the help! Link to comment Share on other sites More sharing options...
tech_moron Posted October 3, 2009 Share Posted October 3, 2009 You may wish to add the /q switch too:MsiExec /norestart /q/x"{76B2BC31-2D96-4170-9C44-09E13B5555F3} REMOVE=ALL""%ProgramFiles%\Symantec\LiveUpdate\LSETUP.EXE" /U /qBTW did you notice the REMOVE=ALL I added to your uninstallation command line!Pardon my ignorance. In the above example for removing live update, where should that be placed in the script? Is it after %systemroot%\system32\msiexec.exe /q /x {123456} /norestart ?Thank you in advance Link to comment Share on other sites More sharing options...
Yzöwl Posted October 4, 2009 Share Posted October 4, 2009 I'd suggest you remove LU after having removed the Symantec product(s), however it shouldn't be necessary. Link to comment Share on other sites More sharing options...
tech_moron Posted October 5, 2009 Share Posted October 5, 2009 Thank you, Yzowl.One more question: do I need the quoation marks in the below statement - e.g. " " ?MsiExec /norestart /q/x"{76B2BC31-2D96-4170-9C44-09E13B5555F3} REMOVE=ALL""%ProgramFiles%\Symantec\LiveUpdate\LSETUP.EXE" /U /q Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now