Home > Archive > microsoft.public.cert.mct > March 2003 > How To Remove Top Level OU with VBScript





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author How To Remove Top Level OU with VBScript
TJ

2003-03-23, 5:23 pm

OS = W2K Advanced Server
Purpose = Instructor's Active Directory Setup
Subject = Checking for and Removing Like Name OU

Scenario: I am using the following VBScript to create a
top level Organizational Unit. At this time the VBScript
works really well to create an OU as long as there is no
existing OU by the same name.

Question: How do I add (and where within the script) to
this existing script the ability to check for an existing
OU and remove it if it exist so I can continue with the
script without error?

Set Root = GetObject("LDAP://rootDSE")
Set Domain = GetObject("LDAP://" & Root.Get
("defaultNamingContext"))

Set OU=Domain.Create("organizationalUnit","OU=Demo")
OU.Put "Description", "Demonstration OU"
OU.SetInfo

An up front Thank You for your time and reply...TJ
Sponsored Links





Free Braindumps | MCSE braindumps software forum

Copyright 2003 - 2008 examnotes.net