Solved

Kill Process with powershell

Posted on 2012-03-21
5
1,314 Views
Last Modified: 2012-03-22
All,
I have a w3wp.exe process that occassionally rolls out of control. I first wanted to know if there was anyway to limit the amount of memory a process can take and kill itself if it hits that limit?
Second - Can a script be written that constantly runs that will check the w3wp process and if its over a certain amount of memory utilized- kill it.
There are multiple w3wp process running but whenever I kill the one that barells out of control everything is fine for a period of time. Then we eventually run into the same issue where we have to manually kill process.

Anyone have an idea why this is happening? Were assuming its something to do with Sharepoint and IIS7 which are both running on this server.

Thanks!!
0
Comment
Question by:k3vsmith
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 38

Expert Comment

by:Justin Smith
ID: 37749293
Each app pool in IIS has an associated w3wp worker process.

You can limit them memory on these things by going into IIS and editing the properties of the app pools.

Common cause of out of control memory is bad code or a bad web part.
0
 

Author Comment

by:k3vsmith
ID: 37749551
Thanks for your quick response!
Can you describe how to edit the properties of the app pools.
I see the application pools in IIS manager but I dont know what to edit to limit memory utilization.
0
 
LVL 10

Expert Comment

by:Michael Ian Claridge
ID: 37751640
Im no IIS Expert, but the below I think should work bearing in mind what you originally asked for :)

Get-Process w3wp.exe | Stop-Process
Wait-Process w3wp.exe -timeout 10
Start-Process w3wp.exe
0
 
LVL 38

Accepted Solution

by:
Justin Smith earned 500 total points
ID: 37751991
SOrry....it's the Recycle settings you should look for.  You can tell it to auto-restart when it hits a certain memory level....
0
 

Author Closing Comment

by:k3vsmith
ID: 37752505
That worked. Thanks!
0

Featured Post

Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

My attempt to use PowerShell and other great resources found online to simplify the deployment of Office 365 ProPlus client components to any workstation that needs it, regardless of existing Office components that may be needing attention.
Auditing domain password hashes is a commonly overlooked but critical requirement to ensuring secure passwords practices are followed. Methods exist to extract hashes directly for a live domain however this article describes a process to extract u…
To efficiently enable the rotation of USB drives for backups, storage pools need to be created. This way no matter which USB drive is installed, the backups will successfully write without any administrative intervention. Multiple USB devices need t…
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
Suggested Courses

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question