Jump to content
Sign in to follow this  
MiV

Get group object using the group's SID

Recommended Posts

MiV

Hello everyone,

I don't know if this is really a AutoIt topic or more a COM topic - anyway, I have to add a user to a group with AutoIt, so I try it here...

If I try to get a group by name, it will fail if I have a different language version of the system. E.g. the code snippet

$objGroup = ObjGet("WinNT://" & $strComputer & "/Administrators,group")

will not give me the group object if I run it on a german language system, as the group name is 'Administratoren' there.

So I tried replacing the group name by the well known SID

$objGroup = ObjGet("WinNT://" & $strComputer & "/S-1-5-32-544,group")

but this did not give me a valid object either. I tried with various versions of the string specification (without ',group', separate strings,...) but no way. Searching Microsoft was also not a big help or maybe the solution is buried there deep in layers and layers of interfaces...

Does anyone know the trick?

Thanks MiV

Share this post


Link to post
Share on other sites
water

I use the following code to translate well known SIDs to the respective account names.

; Get the language dependant well known accounts for SELF and EVERYONE
$aAD_Temp = _Security__LookupAccountSid("S-1-5-10")

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
MiV

Does this mean I will need all the mentioned UDF's (AD, Outlook, Excel) to accomplish the task?

Thanks

Share this post


Link to post
Share on other sites
water

No. To run the above mentioned function you only need "#include <Security.au3>" in your script.


My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
MiV

Thank you. That did the trick.

Share this post


Link to post
Share on other sites
water
;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2018-12-03 - Version 1.4.11.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×