Link to home
Start Free TrialLog in
Avatar of greghess
greghess

asked on

VBScript create OU, groups, set policy settings

Hi Experts,

I currently have a set of administrative tasks I need to automate and hope to be able to perform them in VBScript. The tasks are as follows:

1-Create an Organizational Unit
2-Apply a default Group policy
3-Set the policies folder redirect locations
4-Create a user group
5-Create users and add to group(Have this working)

I am relatively new to VBScript and ADSI and have been having trouble finding the right documentation.

First I would like to know if all these tasks(1-4) can be achieved via ADSI and VBScript?

Second, I need some example code performing these tasks?

Third, some references to documentation outlining the ADSI objects, methods and attributes for OU, Group, Policy. I found the msn doc's for ADSI User object http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ad/ad/organizational_unit_user_interface_mapping.asp but it doesnt reference the handy methods like setPassword, where are these methods documented?

Many thanks,

Greg
SOLUTION
Avatar of Shane Russell
Shane Russell
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Check out http://msdn.microsoft.com/library/default.asp?url=/library/en-us/adsi/adsi/persistent_object_interfaces.asp for a list of those methods and properties (like SetPassword) that you referred to.

The only thing in your question I'm not really sure about is applying Group Policies through a script (2 and 3).  I haven't had a reason to do that before, and haven't researched the options.  Everything else (creating OUs, users and groups, modifying group memberships) is fairly painless using ADSI.
Avatar of greghess
greghess

ASKER

Thanks, those are the doc's I have been looking for.

Can you provide sample code for creating a OU and sub Group? All the doc's/samples I have seen only show how to create a computer.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
BTW, in the "OUs" section of those AD samples, they have examples of how to add GPO Links to an OU as well.  Doesn't give you the ability to modify a GPO, but if you have one already created, you can at least link it to the new OUs as they are created.
Thanks, much appreciated.

I will post the GPO editing question separately.