Announcement

Collapse
No announcement yet.

VBS OU Move computer

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • VBS OU Move computer

    okay,easy question.

    Set objNewOU = GetObject("LDAP://OU=Finance,DC=fabrikam,DC=com")

    Set objMoveComputer = objNewOU.MoveHere _
    ("LDAP://CN=atl-pro-03,CN=Computers,DC=fabrikam,DC=com", "CN=atl-pro-03")


    this is a script to move a computer to a ou from the computer ou.
    is it possible to place more pc's in this script instead of 1 only?And when my domain name is; lets say, mydomain.corp.local,what do i need to change in the script? thank you.

  • #2
    Re: VBS OU Move computer

    You can just repeat these lines in the script to move more, someone here may be able to provide a decent loop script for you though:

    Set objMoveComputer = objNewOU.MoveHere _
    ("LDAP://CN=atl-pro-03,CN=Computers,DC=fabrikam,DC=com", "CN=atl-pro-03")
    In answer to your second question:

    Set objNewOU = GetObject("LDAP://OU=Finance,DC=mydomain,DC=corp,DC=local")

    Comment


    • #3
      Re: VBS OU Move computer

      great.thanks.very helpfull.

      Comment


      • #4
        Re: VBS OU Move computer

        1 more q, isnt it possible to put all the pc's i need to move to 1 ou in a text file instead of repeating all the lines?

        Comment


        • #5
          Re: VBS OU Move computer

          Originally posted by deheugden View Post
          1 more q, isnt it possible to put all the pc's i need to move to 1 ou in a text file instead of repeating all the lines?
          Yes, but its (unless you have hundreds of PCs to move) easier to copy/paste/edit this line:
          Code:
          Set objMoveComputer = objNewOU.MoveHere _
          ("LDAP://CN=atl-pro-03,CN=Computers,DC=fabrikam,DC=com", "CN=atl-pro-03")
          Alternatively you have to find code to read from a text file, check there is still text to read, read it, validate it and execute it

          Tom
          Tom Jones
          MCT, MCSE (2000:Security & 2003), MCSA:Security & Messaging, MCDBA, MCDST, MCITP(EA, EMA, SA, EDA, ES, CS), MCTS, MCP, Sec+
          PhD, MSc, FIAP, MIITT
          IT Trainer / Consultant
          Ossian Ltd
          Scotland

          ** Remember to give credit where credit is due and leave reputation points where appropriate **

          Comment


          • #6
            Re: VBS OU Move computer

            okay,that sounds too difficult for now
            Thanks for the help.

            Set objMoveComputer = objNewOU.MoveHere _
            ("LDAP://CN=atl-pro-03,CN=Computers,DC=fabrikam,DC=com", "CN=atl-pro-03")

            how should i read this line? f.i. what should i place in the CNand the DC's??
            Should i replace the atl-pro-03 with the mydomain.corp.local and replace the cn=computers with the ou the computers come from??
            Last edited by deheugden; 19th January 2007, 11:22.

            Comment

            Working...
            X