How to get a server’s machine SID

What is the WMIC command to get the Server/machine SID, not the domain SID?

I keep reading how to get useracoount SID or using Powershell.

What I require is using WMIC command only.
Anonymous KHIT EngineerAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Sajid Shaik MSystem AdminCommented:
dsquery * -Filter "(name=MyComputer)" -attr objectSID


dsquery computer -name "MyComputer" | dsget computer -SID

all the best
You query for the local user account SID ending with -500 (default administrator), and get rid of the -500; that's the local computer SID.
Plain wmic query returning the local Administrator's SID:
wmic.exe useraccount WHERE "(Sid LIKE '%%-500') AND (Domain='%ComputerName%')" GET Sid /value

Open in new window

Batch script returning the computer's SID:
@echo off
for /f "delims=" %%a in ('wmic.exe useraccount WHERE "(Sid LIKE '%%-500') AND (Domain='%ComputerName%')" GET Sid /value') do (for /f "delims=" %%b in ("%%a") do set %%b)
set ComputerSid=%SID:~0,-4%
echo %ComputerSid%

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Neil PettyICT ContractorCommented:
You may find the freeware tool WMI Explorer useful :

It has examples of WMI lookups VBScript, Powershell
Qlemo"Batchelor", Developer and EE Topic AdvisorCommented:
Note: oBdA's comment is correct, as long as you are running it on the machine to check. For remote execution, we would need significantly more effort, but that is probably out of scope of this question.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.