Calendar

November 2007
S M T W T F S
« Oct   Jan »
 123
45678910
11121314151617
18192021222324
252627282930  

Categories

Programmatically Create User Groups

I have recently come across the need to create user groups on my local machine for a current project. I have researched and come up with a straightforward VBScript file that I can use as my basis for creating many user groups on each fresh testing installation.

The code is as follows:

‘ Create Network Object
Set objNetwork = WScript.CreateObject(“WScript.Network”)

‘Set the desired group name
strGroup = “Test”

‘ Retreive the local machine name.
strComputer = objNetwork.ComputerName

Set colAccounts = GetObject(“WinNT://” & strComputer & “”)
Set objGroup = colAccounts.Create(“group”, strGroup)
objGroup.SetInfo

The above code will create a user group named “Test” when executed from a VBScript file. This code was created through the use of Microsoft TechNet – User Accounts scripting.

This code is provided to you as-is for your knowledge. I accept no liability in your use of this code.

1 comment to Programmatically Create User Groups

  • [...] from a given folder and all subfolders.http://www.databasejournal.com/scripts/article.php/3517231VBScript – Programmatically create user groups.This sample code shows how to programmatically create user account groups within a Windows [...]

Leave a Reply

 

 

 

You can use these HTML tags

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>