Closing iexplore.exe

Hi. I am totally new to powershell, just starting to learn it. I’m trying to deploy Java through SCCM 2012. I want to create a script that will check if IE is running on a pc, & if so, display a message that IE will be shutdown in a given amount of time in order for the Java install to complete. After doing some searching I found a script that looks like it will do what I need it to however it gives errors when I run it saying there are syntax errors. If anyone could assist with getting this working below it would be greatly appreciated.

Dim oShell
Set oShell = WScript.CreateObject(“WScript.Shell”)
Set colProcessList = GetObject(“Winmgmts:”).ExecQuery (“Select * from Win32_Process”)

For Each objProcess in colProcessList ’ Loop checks all running processes and sets vFound to True if it finds iexplore.EXE running.
If = “iexplore.exe” then
vFound = True
End if
If vFound = True then
oShell.Popup “Closing IE” & vbCrLf & vbCrLf & “Click OK if you are ready to continue now.”,30,“Software Update”
oShell.Run “taskkill /F /IM iexplore.exe”, 1, True
End If

Sorry. That’s not Powershell - it is VBScript.

Anyway when you post code in a forum you should format it as code. And when you have errors you should post the errors as well.

Olaf is correct the script you’ve posted is VBScript not PowerShell. I can highly recommended to watch the Getting Started with PowerShell series on Channel 9:

However, checkout the examples of the PowerShell cmdlets Get-Process and Stop-Process on the following pages:

You can re-create the popup with below lines of PowerShell:

$shell = New-Object -ComObject WScript.Shell
$shell.Popup("Closing IE`r`rClick OK if you are ready to continue now.", 30, 'Software Update')

I hope that helps. Otherwise Bing and Google are your friend too.