Brainware

Internet Solutions

Home  >  Knowledgebase

How to: create local groups and users

Article ID:
BW412866200
Last Review:
18. 06. 2007

Find on this page


Summary

It is common practice to use Columbus scripts to do administrative tasks, like create local groups and users, but Columbus has no built-in command to do this.

A very efficient way to accomplish complex tasks in packages is to use embedded VB-Script in a standard Columbus script.

More Information

The following script is an example of how to create a local group and add users and an existing global group to it.

 

BEGIN SCRIPT 'VBScript' 'Main' '%_machine%'

Function Main(strComputer)

ON ERROR RESUME NEXT

 

Const LOCAL_GROUP ="a_new_local_group"

Const GLOBAL_GROUP = "an_existing_global_group"

Const DOMAIN_NAME = "your_Domain"

Const USER1 = "an_existing_user"

Const USER2 = "an_existing_user"

 

'Create the Local Group

Set objComputer = GetObject("WinNT://" & strComputer & ",computer")

Set objGroupAdd = objComputer.Create("group", LOCAL_GROUP)

objGroupAdd.SetInfo

 

' Add Users to the Local Group

objGroupAdd.Add "WinNT://"& DOMAIN_NAME & "/" & USER1

objGroupAdd.Add "WinNT://"& DOMAIN_NAME & "/" & USER2

 

' Add a Global Group to the Local Group

objgroupAdd.add "WinNT://"& DOMAIN_NAME & "/" & GLOBAL_GROUP

 

 

End Function

END SCRIPT

 

Keywords:

Scripting, VB, Add Groups, Add Users