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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Have WinNT object - need LDAP OU object

Status
Not open for further replies.

Jerz

MIS
Sep 10, 2004
102
US
My script is running a command that returns me a list of computer objects that I need to move to another OU. I can connect to the domain using:
<script>
Set DomainObj = GetObject("WinNT://" & DomainString)
</script>
and then delete the computers with:
<script>
DomainObj.Delete "computer", CompString
</script>
Unfortunately, I don't want to delete them, I just want to move them to a different OU.
If I could derive the OU from the WinNT, I think I could connect with LDAP & do the move.
Or is there a way to connect the LDAP without knowing the current OU?
 
Here is some stuff to get you started.

'Bind to Active Directory System Information
Set adsinfo = CreateObject("adsysteminfo")

'Bind to the Domain
Set DomainObj = GetObject("LDAP://" & adsinfo.DomainDNSname)

'Bind to the active directory computer object
Set ADCompObj = GetObject("LDAP://" & adsinfo.ComputerName)


'You can determine the OU of the computer you are currently running the script on by using the parent property.
Set ADCompOU = GetObject(AdcompObj.Parent)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top