Jump to content

Find Group-Name for SID


Recommended Posts

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'")

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


Link to comment
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)

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

Link to comment
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

  • Recently Browsing   0 members

    • No registered users viewing this page.
  • Create New...