Re: Getting Windows "MACHINE SID" without fork() & exec()?
René Berber via Cygwin <[email protected]> Thu, 23 Apr 2026 13:27:48 -0600
| Newsgroups | gmane.os.cygwin |
|---|---|
| Message-ID | <[email protected]> |
On 4/23/2026 11:07 AM, Takeshi Nishimura via Cygwin wrote: > Does Cygwin have a secret shell variable or /proc file which contains > the current machine's MACHINE SID, without having to resort to calling > an external program (no fork(), no exec(), please)? Create your own environment variable. Store it once per bash session with .bashrc for example, or permanently with all the other Windows variables. Use PsGetSid to get the value into that variable (i.e. no super user access needed like with regtool.) Ref: https://learn.microsoft.com/en-us/sysinternals/downloads/psgetsid Caveat: The first time you run PsGetSid it shows a popup with the license agreement. Example: XPS-8930: ~ $ /home/reneb/bin/SysinternalsSuite/PsGetsid PsGetSid v1.44 - Translates SIDs to names and vice versa Copyright (C) 1999-2008 Mark Russinovich Sysinternals - www.sysinternals.com SID for \\XPS-8930: S-1-5-21-3651791898-1415975337-2452924111 XPS-8930: ~ $ /home/reneb/bin/SysinternalsSuite/PsGetsid |& tail -n 3 S-1-5-21-3651791898-1415975337-2452924111 Hope this helps. -- R.B. -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple