CPU usage limit per user in Windows (RDSH)

In this post we will see how to limit the CPU usage that a user can consume.

Limit CPU usage per user in Windows. Why?

In RDS (Remote Desktop Services) environments where we will have several users running at the same time on the same Windows Server, we may find that there is a session that is consuming more CPU than expected.

In that case we should try to correct the problem by identifying the process that is causing the problem.

Sometimes it is not possible to correct the problem and we are forced to make use of this method which consists of limiting the CPU usage per user.

Windows: Limit CPU usage per user: Step-by-step configuration

To limit CPU usage per user, we must first find out what the user's SID (Security IDentifier) ​​is.

There are several ways to find out the SID of a user, one of them is with the command: wmic, which is used to make WMI queries.

Example:

wmic useraccount get name, sid


This method will serve us both with local accounts at the workgroup level and with domain accounts at the Active Directory level.

Once we have identified the user's SID, we must go to the following branch of the Windows registry:

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\ Control\Session Manager\Quota System

Once there, we must create a key with the SID of the user that we want to limit and indicate the DWORD value:

CpuRateLimit with the number that we want from 0 to 100.

Example:

Limit CPU usage to 40% for user: sysadmit


It is important to take into account:

  • We will not find the key with the name of the SID created and we will have to create it ourselves.
  • We must restart the computer for the change to take effect.
  • This key works in operating systems: Windows 7 and Windows Server 2008 R2 or higher versions. 

No comments

Powered by Blogger.