Sign in to follow this  
Followers 0
MiV

Get group object using the group's SID

6 posts in this topic

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



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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

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

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 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

Tutorials:
ADO - Wiki

 

Share this post


Link to post
Share on other sites

Thank you. That did the trick.

Share this post


Link to post
Share on other sites
;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2017-04-18 - Version 1.4.8.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (NEW 2017-02-27 - Version 1.3.1.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2015-04-01 - Version 0.4.0.0) - Download - General Help & Support - Example Scripts
Excel - Example Scripts - Wiki
Word - Wiki
PowerPoint (2015-06-06 - Version 0.0.5.0) - Download - General Help & Support

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  
Followers 0