When upgrading certain applications for instance plug-ins to Internet Explorer, Internet explorer must not be running if the upgrade is to be successful. I answered this question on the Technet forum during the week and I thought I would share the simple script here.
I have a more advanced script which prompts the user to close open applications with the possibility to postpone the upgrade, I will post that later it just needs a bit more cleaning up 😉
The script can be used as a step in a Task Sequence or “run this program before” and if you want to check more processes just add a new line as the script uses a command-line argument to pass the process-name to check status.
Example:
Example syntax: cscript.exe checkprocess.vbs iexplore.exe
Script:
'The script will return error code 1 if process is running
'Processname can be passed on the command line as a variable
'Example cscript.exe checkprocess.vbs Iexplore.exe
Option explicit
DIM strComputer,strProcess
DIM Args
Set args = WScript.Arguments
strProcess = args.Item(0)
If args.count <> "1" then
wscript.echo "incorrect syntax"
wscript.echo "Syntax example = checkprocess.vbs notepad.exe"
end if
IF isProcessRunning(strProcess) THEN
wscript.quit(1)
END IF
FUNCTION isProcessRunning(BYVAL strProcessName)
DIM objWMIService, strWMIQuery
strWMIQuery = "Select * from Win32_Process where name like '" & strProcessName & "'"
SET objWMIService = GETOBJECT("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
IF objWMIService.ExecQuery(strWMIQuery).Count > 0 THEN
isProcessRunning = TRUE
ELSE
isProcessRunning = FALSE
END IF
END FUNCTION
Thanks for this post. I’m waiting for more advanced scripts 🙂
Hi Jörgen…
Is a great blog you have, I would like to consult you about sccm deployment FEP 2010,
when make the process for deployment of FEP Clients the deployment does not run on computers.
which Log files can use to identify the problem?
Thanks for Help…
hi, when will we see the more advanced script ? Today I´m killing Iexplorer before upgrading Activex, but it´s not very nice for users.
Hi, thanks for the reminder, it is now out there 🙂
I have a task sequence setup for uninstalling old versions of Java, and then installing the latest. It works great when IE is closed on the client machines. The information in this article is exactly what I want to do. I want the task sequence to fail if iexplore.exe is running. I tried the above script on a machine. When I open IE on the client receiving the task, it fails and gives me the error code, which is what I expect. However, when I run the task sequence on the same machine with IE closed, I get the same error message. I want the task sequence to continue if IE is closed. Any ideas as to what I might be doing wrong?