Code Script .co.uk

Home | Scripts | Tutorials | Disclaimer | Sitemap | Contact

   Move User-computer-group Between Ous
 

Vbscript / Active Directory / Move User-computer-group Between Ous

Move an AD object (User, Computer, Group, Printer etc.) between OUs. Rename the object using the second parameter of the MoveHere method or use vbNullString to retain the existing name.


strComputer = "CN=comp,"
strSourceOU = "OU=source, DC=domain,DC=local"
strDestinationOU = "OU=dest,DC=domain,DC=local"

Set objNewOU = GetObject("LDAP://" & strDestinationOU)
Set objMoveComputer = objNewOU.MoveHere("LDAP://" & strComputer & strSourceOU, vbNullString)





Please note that a disclaimer applies to any code on this page.
 
   Actions
  Go Back
  Bookmark
  Print Page


   Menu
 
- Links
- Reference
- Script Editors
- Tutorials
- Vbscript
     - Active Directory
          - Ad User Information Query
          - Add Machine To Domain
          - Add User To Group
          - Create Group
          - Create Ou Structure
          - Enumerate Ad Users
          - Enumerate Group Members
          - Move User-computer-group Between Ous
          - Move Users And Groups Between Ous
          - Raise Domain Functional Level
     - Exchange
     - Files And Folders
     - General
     - Ms Office
     - Operating System
     - Processes And Services
     - Text Processing
     - User Interaction
     - Web Servers