How to get SID of Windows domain using WMIC?

I’m looking for a WMIC solution to obtain a Windows domain's SID. I can only find solutions for PowerShell, however I prefer the WMIC approach.

Lots of examples exist on Google for obtaining domain users’ SID, but none tell how to obtain a computer or domain's SID.

4

1 Answer

To my knowledge there isn't a "Domain SID" per se. I assume what you're referring to is the Domain Identifier which uniquely identifies a domain within the AD forest.

Each SID in an Active Directory domain includes the Domain Identifier. I'm not aware of a WMIC command that returns only this identifier; however, it's easy to extrapolate it by inspecting any principle's SID in the domain.

For example, the following WMIC command returns the SID of the Domain Admins group:

C:\>wmic group where name="Domain Admins" get name,sid,domain
Domain Name SID
CONTOSO Domain Admins S-1-5-21-1004336348-1177238915-682003330-512

As explained in the Microsoft Docs article How Security Identifiers Work, a SID is composed of the following components:

  • A revision level (1)
  • An identifier authority (5, NT Authority)
  • A domain identifier (21-1004336348-1177238915-682003330, Contoso)
  • A relative identifier (512, Domain Admins)

Therefore you simply need to strip off the revision level, identifier authority, and RID to derive the Domain Identifier portion.

4

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like