2012年9月13日 星期四

windows command get current user SID

for /F "delims=" %I in ('wmic useraccount where name^="%username%" get sid ^| findstr ^2') Do Set SID=%I
echo %SID%

S-1-2-0 Local
S-1-5-14 Remote Interactive Logon
S-1-5-19 LocalService
S-1-5-29 NetworkService
S-1-5-32-554 Pre-Windows 2000 Compatible Access
S-1-5-32-555 Remote Desktop Users
S-1-5-32-556 Network Configuration Operators
S-1-6 Site Server Authority
S-1-7 Internet Site Authority
S-1-8 Exchange Authority
S-1-9 Resource Manager Authority




Reference :
Windows + wmic + memory - Stack Overflow 
Get SID of user
How To Find a User's Security Identifier (SID) in Windows
Get current logged in user name command line (CMD)
How to get a user's SID? - MSFN Forum

沒有留言:

張貼留言