Levén Labs / Snippets

Get IUSR SID

Script to retrieve SID for the auto-generated ISUR account.

VBScript sample code
Set objWMI = GetObject("winmgmts:\\.\root\cimv2")

 'Get a collection of Users objects, using ExecQuery
Set colUsers = objWMI.ExecQuery("SELECT * FROM WIN32_Account WHERE LocalAccount = 'True' AND Name LIKE 'IUSR_%'")
  
'The collection should only have one user in it. Loop through the one user collection
'and create a user object
For Each userName in colUsers
	Wscript.Echo userName.SID
  Set objUserName = userName
Next

InputBox "Use Ctrl + C to copy SID to clipboard", "IUSR SID", objUserName.SID