Solved

VBScript- Move List of Computers to OU Within another OU

Posted on 2016-09-09
1
37 Views
Last Modified: 2016-09-10
I am working on a script to move computers found in Active Directory to a Disabled Computers OU. The issue I am encountering is that each location has its own OU and the computers must be moved to the Disabled Computers for each location not just a general Disabled Computers OU. For example If a Location is Here then Under Here is the Disabled Computers OU. I am not sure what the proper syntax would be when setting the destination in the script.

I have tried several variations of the following
strNewOU = "LDAP://OU=Here\Disabled Computers," & strDNSDomain
strNewOU = "LDAP://OU=Here\" & """" & "Disabled Computers" & """" & "," & strDNSDomain
strNewOU = "LDAP://OU=Here\Disabled Computers" & strDNSDomain

None of these have worked. Any assistance would be appreciated.
0
Comment
Question by:Frog_1337
1 Comment
 
LVL 65

Accepted Solution

by:
RobSampson earned 500 total points
Comment Utility
Hi, the correct syntax is reverse order, so your structure
Domain.com/Here/Computers/Disabled Computers
Is represented by
strNewOU = "LDAP://OU=Disabled Computers,OU=Computers,OU=Here," & strDNSDomain

Regards,

Rob.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

Suggested Solutions

Mapping Drives using Group policy preferences Are you still using old scripts to map your network drives if so this article will show you how to get away for old scripts and move toward Group Policy Preference for mapping them. First things f…
Over the years I have built up my own little library of code snippets that I refer to when programming or writing a script.  Many of these have come from the web or adaptations from snippets I find on the Web.  Periodically I add to them when I come…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles from a Windows Server 2008 domain controller to a Windows Server 2012 domain controlle…
This tutorial will walk an individual through the process of transferring the five major, necessary Active Directory Roles, commonly referred to as the FSMO roles to another domain controller. Log onto the new domain controller with a user account t…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

21 Experts available now in Live!

Get 1:1 Help Now