How to find the RID that will be used for the next new local account on Windows

Mensur Torlak 0 Reputation points
2023-08-09T08:57:27.1266667+00:00

In the case of AD accounts, each domain controller has the rIDNextRID attribute, so it is known which RID value is assigned to the next new AD security principle (user, computer, and group) that is created on that domain controller. How to know the same on Windows that is not a domain controller? How to know which RID value the next local account (user and group) will get? If we create a new local account, we can check what RID value it has, so we can know what is the next RID value that the next new account would get. How can we know the next RID for a new local account before we create that account?

Windows 10 Security
Windows 10 Security
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
3,038 questions
Windows Server Security
Windows Server Security
Windows Server: A family of Microsoft server operating systems that support enterprise-level management, data storage, applications, and communications.Security: The precautions taken to guard against crime, attack, sabotage, espionage, or another threat.
1,902 questions
PowerShell
PowerShell
A family of Microsoft task automation and configuration management frameworks consisting of a command-line shell and associated scripting language.
2,906 questions
{count} votes

2 answers

Sort by: Most helpful
  1. Rich Matheisen 47,856 Reputation points
    2023-08-09T15:32:47.6633333+00:00

    I'm not sure why a PowerShell tag is present in your question. The issuance of RIDs is a function of the Active Directory.

    I don't think there's a way to do what you ask. RIDs aren't issued to new AD objects by the RID FSMO holder. Each domain controller asks the RID FSMO holder for a block of RIDs (default is to get 500 at a time), and then uses the RIDs as necessary. To predict what the "next" RID value to be used might be depends on which DC creates the next AD object.

    Maybe one of the AD folks can provide a better answer.

    The DCDiag tool might be of some help, but I don't think it gets a fine-grained as "what RID will be used next".

    https://social.technet.microsoft.com/wiki/contents/articles/21326.how-to-protect-your-active-directory-from-rid-pool-depletion.aspx#:~:text=Dcdiag.exe%20allows%20querying%20Domain%20Controllers%20to%20get%20the,find%20%2Fi%20%22Available%20RID%20Pool%20for%20the%20Domain%22


  2. Rich Matheisen 47,856 Reputation points
    2023-08-10T18:36:51.6466667+00:00

    Sorry. I guess I didn't read the question very carefully.

    I don't know precisely where that information is kept, but I'd guess it's in the registry, probably in the HKEY_LOCAL_MACHINE\SECURITY or HKEY_LOCAL_MACHINE\SAM key.

    To open those keys you'd have to run using the LOCALSYSTEM account. If you'd like to poke around in those keys this is one way to have a look: https://techgenix.com/HowtobreakintoregistrytoexploreHKLMSAMandHKLMSECURITYkeys/


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.