Sign in to follow this  
Followers 0
Leberschnitzel

Find Group-Name for SID

3 posts in this topic

Hi everyone,

I have an easy problem: I need to schedule a task for the group "Users". This works nicely on English PCs, but on German and French it doesn't since the users group isn't called users there. Using the SID also doesn't work since the scheduler doesn't allow SID use in the CMD...

Long story short: This doesn't seem to work:

$objWMIService = ObjGet ("winmgmts:\\" & @ComputerName & "\root\cimv2")
$UserGroup = $objWMIService.ExecQuery ("Select Name from Win32_Group Where SID = 'S-1-5-32-545'")
MsgBox(0,"",$UserGroup)

I just get an empty popup instead of, like I hoped, the name of the users group.

Any idea how I can make this work easy?

Thank you very much for your time :)

Kind Regards

Christian

Share this post


Link to post
Share on other sites



$objWMIService = ObjGet ("winmgmts:\\" & @ComputerName & "\root\cimv2")
   $colItems = $objWMIService.ExecQuery ("Select Name from Win32_Group Where SID = 'S-1-5-32-545'")
   For $GroupNames in $colItems
      MsgBox (0,"",$GroupNames.Name)
      ExitLoop
   Next

This works now quick and very dirty. I exit the loop there because otherwise it seems to run for a very long time.

Share this post


Link to post
Share on other sites

you might be interested in this function: _Security__LookupAccountSid()


small minds discuss people average minds discuss events great minds discuss ideas.... and use AutoIt....

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