Alright, to keep it short, I’m deploying an Adobe Flash package through SCCM. It works well as is, unless IE is running. I can do a taskkill no problem, but I’d like to prompt the user before hand. This allruns in a .cmd file as of right now. Here is the “script”. I should mention I’m a n00b at this stuff, so before you ask “Why the hell are you doing it that way”, understand that this was the best method I could come up with.
@echo off
Color 04
Title Installing Adobe Flash Player
echo Installing Flash Player - Please Wait...
echo Window will close after install is complete
IF EXIST "C:\Program Files( x86)\" "%~dp0uninstall_flash_player_11.0.1.152_64bit.exe" -uninstall activex
IF NOT EXIST "C:\Program Files( x86)\" "%~dp0uninstall_flash_player_11.0.1.152_32bit.exe" -uninstall activex echo 32-bit OS detected
IF EXIST "C:\Program Files( x86)\" "%~dp0install_flash_player_11_active_x_64bit" -install
IF NOT EXIST "C:\Program Files( x86)\" "%~dp0install_flash_player_11_active_x_32bit" -install
if exist "%WINDIR%\system32\Macromed\Flash\" copy /Y "%~dp0mms.cfg" "%WINDIR%\system32\Macromed\Flash\"
if exist "%WINDIR%\SysWOW64\" copy /Y "%~dp0mms.cfg" "%WINDIR%\SysWOW64\"
REM Return exit code to SCCM
exit /B %EXIT_CODE%
echo Press any key to close active windows and begin installation
pause
stuff here that will run after user hits enter (or any other key)
If you have the windows message service installed you can open a message box to get their attention. This will print message in teh CMD window, open a message box, and then wait for the user to press enter on the CMD window
echo Press enter to continue
msg “%username%” Please press enter on the main window
pause
I came up with a finished product and couldn’t use a notification to close IE since the package in SCCM was set to run hidden. It’s an optional package so users must select that they want to run this program manually. The script checks what bitness your OS is, then runs the appropriate Flash removal tool. Next the script force closes IE. Then it checks again to run the appropriate version of flash. After it copies a mms.cfg file to the appropriate location based on the OS version. This disables the “check for updates” feature bugging users to install the latest version, and have it fail because they aren’t admin.
@echo off
Color 04
Title Installing Adobe Flash Player
echo Installing Flash Player - Please Wait...
echo Window will close after install is complete
IF EXIST "C:\Program Files( x86)\" "%~dp0uninstall_flash_player_11.0.1.152_64bit.exe" -uninstall activex
IF NOT EXIST "C:\Program Files( x86)\" "%~dp0uninstall_flash_player_11.0.1.152_32bit.exe" -uninstall activex
TASKKILL /F /IM iexplore.exe /T
IF EXIST "C:\Program Files( x86)\" "%~dp0install_flash_player_ax_64bit" -install
IF NOT EXIST "C:\Program Files( x86)\" "%~dp0install_flash_player_ax_32bit" -install
if exist "%WINDIR%\system32\Macromed\Flash\" copy /Y "%~dp0mms.cfg" "%WINDIR%\system32\Macromed\Flash\"
if exist "%WINDIR%\SysWOW64\" copy /Y "%~dp0mms.cfg" "%WINDIR%\SysWOW64\"
REM Return exit code to SCCM
exit /B %EXIT_CODE%
We use SCCM for almost all our software distribution. Pushing it down through SCCM gives better reporting and more options. I can make it manditory, or not. I can have it run while the user is logged in, when they aren’t logged in, or either or. I can have it pushed to only Windows XP, only Vista, only Vista x64, etc. It’s A LOT nicer.
Alright, fuck everything above. I’m working on a simple Toolbar batch file. Basically I deal with enough desktops and laptops where I’d like to make a nice automated process. I’ll always continue to add to it with different variants of these piles of this.
Anyway, The google toolbar uses an msiexec string to uninstall with a specific (two different ones)…that part works fine. But then there is a manager piece that is random per install.
This is an example of what it looks like in the batch file:
The part in red is what changes per install. Since I’m using quotes for the filepath any sort of wildcard won’t work. I need to know how I can uninstall this using some sort of variable.
@echo Off
CD "%PROGRAMFILES%\Google\Google Toolbar\Component\"
Dir /B>Dir.temp
FindStr /R "GoogleToolbarManager_[A-Za-z0-9]" "Dir.temp">FindStr.temp
Del Dir.temp
For /F "tokens=*" %%a In (FindStr.temp) Do Call :DoWork"%%a"
Del FindStr.temp
Exit /B
:DoWork
"%PROGRAMFILES%\Google\Google Toolbar\Component\%1.exe" /uninstall
Exit /B
You already have exits in there and echo off on the main script. Try this. I am doing this on the fly so haven’t tested anything. Basically it walks through the folder and looks for any regex match for GoogleToolbarManager_ and then should execute the uninstall using that path and the /uninstall flag.
Alright…have to run it from an elevated command prompt in Windows 7…That was my stupid fault. BUT, for some reason it doesn’t pick up the string name when you go to uninstall it. It tries to do a <FILEPATH>.exe /uninstall …Obviously that file doesn’t exist. Everything above that looks fine I think.
Hmmm. Debugging on the fly so need you to test for me. Take out the two del lines and post the text in the files in the google toolbar\components folder