Windows Services & Process Priority

  • Thread starter Thread starter Auto
  • Start date Start date
A

Auto

Hello,

Is there a possibility to set the process priority of a Windows Service?
I know that I can do it with the Task Manager or Process Explorer
(Sysinternals), but i would have a way to do it automatically.
Is there a little utility or some other way to do it?

One reason because i ask this is also because the following Microsoft
Articles don't fix the problem:

"You receive an access violation when you try to install an update from
Windows Update after you apply hotfix package 916089"
http://support.microsoft.com/kb/927891


"FIX: When you run Windows Update to scan for updates that use Windows
Installer, including Office updates, CPU utilization may reach 100 percent
for prolonged periods"
http://support.microsoft.com/kb/916089/


The CPU is still 100% for 5-6 minutes.


Thanks.

Massimo.
 
Auto said:
Hello,

Is there a possibility to set the process priority of a Windows Service?
I know that I can do it with the Task Manager or Process Explorer
(Sysinternals), but i would have a way to do it automatically.
Is there a little utility or some other way to do it?


Const ABOVE_NORMAL = 32768
strComputer = "."
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process
Where Name = 'Notepad.exe'")
For Each objProcess in colProcesses
objProcess.SetPriority(ABOVE_NORMAL)
Next
 
Auto wrote ::
Const ABOVE_NORMAL = 32768
strComputer = "."
Set objWMIService = GetObject("winmgmts:" &
"{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")
Set colProcesses = objWMIService.ExecQuery("Select * from Win32_Process
Where Name = 'Notepad.exe'")
For Each objProcess in colProcesses
objProcess.SetPriority(ABOVE_NORMAL)
Next

or-
Const ABOVE_NORMAL = 32768
strComputer = "."
Set wmi = GetObject("winmgmts:\\.\root\cimv2")
Set procs = wmi.ExecQuery("Select * from Win32_Process Where Name = 'Notepad.exe'")
For Each proc in procs
proc.SetPriority(ABOVE_NORMAL)
Next
 
Ayush said:
Auto wrote ::

or-
Const ABOVE_NORMAL = 32768
strComputer = "."
Set wmi = GetObject("winmgmts:\\.\root\cimv2")
Set procs = wmi.ExecQuery("Select * from Win32_Process Where Name = 'Notepad.exe'")
For Each proc in procs
proc.SetPriority(ABOVE_NORMAL)
Next

It's too late. :-)
 
Back
Top