arminweinmann
Goto Top

Wie kann ich einen Benutzer in die lokale Administratorengruppe einfügen ohne Kenntniss darüber wie die sprachspezifische Gruppe heisst?

Ich stehe vor dem Problem einen Benutzeraccount in die lokale Administratorgruppe einfügen zu müssen. Da diese Gruppe ja in den verschiedenen Sprachen unterschiedlich heißt müsste ich den sprachspezifischen Namen der Gruppe wissen.

Ich dachte daran, dass die Admingruppe wohl immer die SID S-1-5-32-544 hat, mit WMIC kann man zu dieser SID auch den Gruppennamen ermitteln, aber wie komme ich dann weiter?

Ich bräuchte ein Script um einen gegebenen Benutzer anhand seines Namens in die Gruppe einzufügen. Am liebsten per Powershell-Script, wenn das Ergebnis (erledigt, Fehler aufgetreten) auch noch zum aufrufenden Prozess (InstallShield) durchschleusbar ist, wäre das noch ein weiteres Zuckerle oben drauf.

Vielen Dank für Tipps

Armin

Content-Key: 309209

Url: https://administrator.de/contentid/309209

Printed on: April 18, 2024 at 12:04 o'clock

Mitglied: 129813
129813 Jul 07, 2016 updated at 16:05:28 (UTC)
Goto Top
Hi,
you don't need the localized name because the server knows the SID when you browse for the Administrators Group in the GPO and this results to the SID in the background.
Working with Group Policy Restricted Groups policies
It is important that you browse for the Group, do not enter it manually into the field
...
The problem with the Restricted Groups interface is that it allows you to either browse for a group name or enter one manually. It is very important to understand what happens in each case. If you browse; the SID of the group you selected will end up in the INF file in the policy. If you enter a name manually; the name ends up in the INF file.
...
Ich bräuchte ein Script um einen gegebenen Benutzer anhand seines Namens in die Gruppe einzufügen.
You don't need a script, you normaly do this with this GPO:
Computer Configuration > Policies > Windows Settings > Security Settings > Restricted Groups
Regards

p.s. by the way if you really want to use a script, small powershell script helps:
$user = "Demo-User"  
$administrators = (New-Object System.Security.Principal.SecurityIdentifier("S-1-5-32-544")).Translate([System.Security.Principal.NTAccount]).Value.split('\')[1]  
net localgroup $administrators $user /add
But i would definitely prefer the GPO.
Member: ArminWeinmann
ArminWeinmann Jul 08, 2016 at 14:17:54 (UTC)
Goto Top
Thanks a lot for your replay!

I can't use the GPO variant because this must be done during a installation procedure. The powershell script is the solution I need. I will test it as soon as possible and give a report of my experiences