Memery limitation for process

This topic contains 1 reply, has 2 voices, and was last updated by Profile photo of Curtis Smith Curtis Smith 3 weeks ago.

  • Author
  • #54885
    Profile photo of

    Hi All,
    i want to ask how can i set the the process like Spoolsv.exe to have maximum of 1GB Memory usage and if it increases above 1GB, the Spool service get restarted.

    Any Idea.

  • #54887
    Profile photo of Curtis Smith
    Curtis Smith

    Since you posted this in a PowerShell forum, I will assume you are wanting to have a scripted solution to monitor the process.

    You can use get-process to monitor the process and it's current memory usage, then if member is above the declared value you can use restart-service to restart the service.

    You can set the process in an infinite loop so it will continuously run. Would recommend sleeping if doing this to keep from chewing up resources. Or you could make it a once through script that kicks off periodically using a scheduled task.

    Those are my thoughts.

You must be logged in to reply to this topic.