Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Seeking PowerShell Help: Process variable

Status
Not open for further replies.

WinBatched

Technical User
May 16, 2010
1
US
I'm not seeing this but I know it's right in front of me (frustrating!!!)

I have a quick PS script that terminates an app begining with "wf" as follows ... Stop-Process -processname wf*

What I need to do is add some type of funtion (if statement,loop, ...) that looks for 'iexplore' before killing these processes. IF iexplore is present in the task list then the script would BREAK. I'm just getting error messages when i try to do what I think "should" work. Any help would be much appreciated. I'm very new to the PowerShell syntax.

 
Don't have time to thoroughly test this through, but

Code:
if ((get-process iexplore -erroraction silentlycontinue) -eq $null){
     write-host "IE is not running"
}else{
     write-host "IS is running"
     break
}

Pat Richard MVP
Plan for performance, and capacity takes care of itself. Plan for capacity, and suffer poor performance.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top