Re: Move Computer from default OU to another during build process

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Either or but I prefer during the the building process. This is what I have
so far
Currently sysprep is doing the adding the workstation to the domain part. I
want to be able to do a runonce and move the workstation from the "computers"
container to what ever site it is. I'm sure you already know, by default all
workstation that you add to the domain will first go to the
"Computers"Container.

our Ous are broken down by sites and I would like to move the workstations
base on their prefered site. Also naming convention is site specific...

Thanks,
Jeff

"RC" wrote:

Jeffrey B,

Are you looking to do this during your build process or are you looking to
accomplish this on workstations that are already in production?

RC

"Jeffrey B" wrote:

Hello guys I am also looking for script that moves Computer account to
another OU.
Ok,

Base on the script listed below. How would I start if Im moving a computer
account from the "computer container" to let say "SampleOU"

Thanks

"Richard Mueller" wrote:


Richard,

Thank you for the reply. Unfortunatly I'm fairly new to these scripting
methods and don't know how to incorporate the desired destination OU with
your example.

Hi,

I tested the script below (with a different target OU) and it moved the
computer the script was run on into the target OU. Watch for line wrapping:
====================
Option Explicit
Dim objNewOU, objSysInfo, strComputerDN, objMoveComputer

' Bind to target OU, where computer object will be moved.
Set objNewOU = GetObject("LDAP://OU=Sales,dc=MyDomain,dc=com";)

' Determine Distinguished Name of local computer.
Set objSysInfo = CreateObject("ADSystemInfo")
strComputerDN = objSysInfo.ComputerName

' Move this computer object to the target OU.
Set objMoveComputer = objNewOU.MoveHere("LDAP://"; & strComputerDN,
vbNullString)

--
Richard
Microsoft MVP Scripting and ADSI
Hilltop Lab - http://www.rlmueller.net



.



Relevant Pages

  • Re: Redirect computers to a specific OU by IP Address
    ... Getting the IP address of the workstation is easy if you are running the ... COMPLETELY lock them down until an admin put them into the right OU. ... I'm in the process of disabling computer accounts that have not been ... My biggest problem is that I just dont know where to start the script ...
    (microsoft.public.windows.server.active_directory)
  • Re: Redirect computers to a specific OU by IP Address
    ... Getting theIPaddress of the workstation is easy if you are running the ... script from the workstation. ... COMPLETELY lock them down until an admin put them into the rightOU. ... used for approx 180-240 days (as there is over 1000 computer accounts ...
    (microsoft.public.windows.server.active_directory)
  • Re: Me Too
    ... I did my testing of the script on my own XP ... Which could be tight on a server like SBS (though mine has never shown ... any service to take for a normal shutdown. ... this reg edit change made to a workstation would ...
    (microsoft.public.windows.server.sbs)
  • Re: Need to automate workstation tasks
    ... Microsoft Online Support ... |> workstation will be logged off unless the user performs some activity. ... | You would need to script that as you cannot trigger that by using Group ... | human solutions than taking several technical actions. ...
    (microsoft.public.windows.group_policy)
  • Re: Help with adding users to groups on an xp workstation
    ... I ended up posting a test version of my script and not the current ... group when running on a workstation would go away. ... intRow = intRow + 1 ... when you specify the DC and port, but that should raise an error. ...
    (microsoft.public.scripting.vbscript)