Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add Local System to security group

Status
Not open for further replies.

prinand

MIS
Jun 13, 2000
98
GB
I have a list of servers where I have to add the SYSTEM to a security group

Set objLocalSystem = GetObject("WinNT://" & strComputer & "/SYSTEM,group")
Set objLocalGroup = GetObject("WinNT://" & strComputer & "/Backup operators,group")
objLocalGroup.add(objLocalSystem)

however I cannot select SYSTEM this way.
I have tried several scripts, which show me all the users and groups, but system does not appear.

I also added system to a group, and then retrieved the group and listed the members, and then it just printed SYSTEM


So does anyone how I can get the object :
NT AUTHORITY/SYSTEM, so I can add it to the group ??
 
First, what is it that you are trying to accomplish by adding the SYSTEM to the BackupOperators group? Maybe there is a different solution for the result you are looking for. Sorry, just want to get the why out of the way before attempting the how.
 
while I was answering your question, I looked at it again and refrased my search and that solved it.
it's very simple :

Set objLocalGroup = GetObject("WinNT://" & strComputer & "/Backup operators,group")
objLocalGroup.add("WINNT://NT-AUTHORITY/SYSTEM")


that's all... (off course you get an error thrown if the system is already in a group, so you need to catch that error, but that is no issue...)

so, in a way, thannks for forcing me to look slightly different at my own question ;)


 
You could also add
ON ERROR RESUME NEXT to your code. This way when I finds the member already exits, your code will just move on, so you wont have to catch the error.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top