Jaque Posted July 10, 2005 Share Posted July 10, 2005 Could someone tell me it is possible to use the LookupAccountSid and ConvertSidToStringSid function from advapi32.dll in AutoIt?More information can be found here:http://msdn.microsoft.com/library/en-us/se...paccountsid.aspandhttp://msdn.microsoft.com/library/en-us/se...tostringsid.aspFor an example binary Sid value look in the registry key HKLM\Software\Microsoft\Windows NT\CurrentVersion\ProfileList\<SID string>\SidI would like to convert this binary Sid to the Username, but I don't know how to do this in AutoIt.Could someone tell me how to do this in Autoit? Link to comment Share on other sites More sharing options...
/dev/null Posted July 11, 2005 Share Posted July 11, 2005 Could someone tell me it is possible to use the LookupAccountSid and ConvertSidToStringSid function from advapi32.dll in AutoIt?Ways too complex, as you will have to fill the SID structure. It's most probably possible with DllCreateStruct, but you can achieve your goal much easier with WMI. Here is a VB Script example. Just translate it to AutoIT and you'll get all the information you need. SID <--> Account Name.On Error Resume Next strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_Account",,48) For Each objItem in colItems Wscript.Echo "Caption: " & objItem.Caption Wscript.Echo "Description: " & objItem.Description Wscript.Echo "Domain: " & objItem.Domain Wscript.Echo "InstallDate: " & objItem.InstallDate Wscript.Echo "Name: " & objItem.Name Wscript.Echo "SID: " & objItem.SID Wscript.Echo "SIDType: " & objItem.SIDType Wscript.Echo "Status: " & objItem.Status Nextor check out scriptomatic. http://www.autoitscript.com/forum/index.ph...opic=10534&st=0CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
ozbob Posted July 26, 2005 Share Posted July 26, 2005 Ways too complex, as you will have to fill the SID structure. It's most probably possible with DllCreateStruct, but you can achieve your goal much easier with WMI. Here is a VB Script example. Just translate it to AutoIT and you'll get all the information you need. SID <--> Account Name.On Error Resume Next strComputer = "." Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2") Set colItems = objWMIService.ExecQuery("Select * from Win32_Account",,48) For Each objItem in colItems Wscript.Echo "Caption: " & objItem.Caption Wscript.Echo "Description: " & objItem.Description Wscript.Echo "Domain: " & objItem.Domain Wscript.Echo "InstallDate: " & objItem.InstallDate Wscript.Echo "Name: " & objItem.Name Wscript.Echo "SID: " & objItem.SID Wscript.Echo "SIDType: " & objItem.SIDType Wscript.Echo "Status: " & objItem.Status Nextor check out scriptomatic. http://www.autoitscript.com/forum/index.ph...opic=10534&st=0CheersKurt<{POST_SNAPBACK}>Kurt,You are right to say that WMI is easier, however it will get you only the sid for the user account and does not convert to string as does the DLL function. To get this value you will have to use the ConvertSidToStringSid output or convert the SID into a binary by using AutoIT. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now