Other Configuration Manager-related features and issues
Hi,
There are two different management boundary to handle the resources (users and computers): domain and local
=== domain part starts ====
1) psgetsid.exe get the computer sid. If we run psgetsid.exe \dc01 (assuming hostname is dc01), it will return
S-1-5-21-73586283-1284227242-1801674531
2) when it becomes a DC, it uses this SID for all the resources in the domain, for example, it recognizes itself as
S-1-5-21-73586283-1284227242-1801674531-1000
S-1-5-21-73586283-1284227242-1801674531-1140272 for host VIPEPSIRS1
For domain users/computers, the prefix is the same, just the last segment is different. No special for the computers.
For the sql query, it get the information from domain controller and the result is as the above.
=== domain part ends ====
=== local part starts ====
Now, let's go to the local computer VIPEPSIRS1, which manages one computer (itself) and serveral local user accounts
S-1-5-21-3195015131-3355721831-4064164013
So if we logon as a local user account and use whoami /user command to get the current logged on user account sid, it should have the prefix and the last segment indicates the user, for example, built-in administrator: 500, other users: starts from 1000
The below powershell script to retrieve all the local user account sid in computer cm16
$computer = "VIPEPSIRS1"
$query1 = "SELECT SID FROM Win32_UserAccount WHERE LocalAccount = 'True'"
$LocalAccountSID = Get-WmiObject -Query $query1 -computername $computer
$LocalAccountSID
=== local part ends ====
In a word, psgetsid get the local computer account id if we do not specify a user account; get-adcompouter get the computer account sid within the domain boundary (not local, if in DC, they are the same, just as shown in the article mentioned above); Get-WmiObject only get local user account sid for the a specified computer.
Hope the above clarifies.
Alex
If the response is helpful, please click "Accept Answer" and upvote it.