Sign in to follow this  
Followers 0
BoogY

Change the OU of a workstation

11 posts in this topic

Hello there everyone.

I'm making a program to be able to administrate workstations in an AD.

Can someone tel me how can you change the OU of a machine ????

Thanks a lot

Share this post


Link to post
Share on other sites



Hello there everyone.

I'm making a program to be able to administrate workstations in an AD.

Can someone tel me how can you change the OU of a machine ????

Thanks a lot

Hi,

dsmove <computername> -newparent ou=newou,ou=somewhere,dc=mydomain,dc=domain,dc=local

Keep in mind: If you have spaces in ou's you have to use:

dsmove <computername> -newparent "ou=newou,ou=some where,dc=mydomain,dc=domain,dc=local"

;-))

Stefan

Share this post


Link to post
Share on other sites

Thanks a lot mate :D

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

$move = RunWait(@ComSpec & " /c dsmove.exe computername -newparent " ""& $selectedOU & """-u "& $adUsername &" -p "& $adPassword &"")

it's giving me this error message =

dsmove failed:Value for `Target object for this command' has incorrect format.

Am I writing it wrong in the command ???

the format of $selectedOU is

ou=sales,dc=microsoft,dc=com
Edited by BoogY

Share this post


Link to post
Share on other sites

$move = RunWait(@ComSpec & " /c dsmove.exe T013702 -newparent " ""& $selectedOU & """-u "& $adUsername &" -p "& $adPassword &"")

it's giving me this error message =

dsmove failed:Value for `Target object for this command' has incorrect format.

Am I writing it wrong in the command ???

the format of $selectedOU is

ou=sales,dc=microsoft,dc=com

Hi,

there is

1) One blank to much in qoutation marks after -newparent

2) A missing blank before -u

Try:

$run = @ComSpec & " /c dsmove.exe T013702 -newparent """ & $selectedOU & """ -u "& $adUsername &" -p "& $adPassword &""

;MsgBox (0,"",$run)

$move = RunWait($run)

;-))

Stefan

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

his still not changing the OU ....

$move is giving this message = -2147024809

Edited by BoogY

Share this post


Link to post
Share on other sites

his still not changing the OU ....

Hi,

1) You may refresh the view of AD User Computer MMC of the OU you want to move computer

2) You may have several DC, so the change isn't replicated over all DC's

If 1 + 2 aren't a solution:

3) Just run dsmove on command line with your parameters and look whats happen

4) You don't get any error message?

;-))

Stefan

Share this post


Link to post
Share on other sites

I'm geting this message = -2147024809

I dit refresh the AD but nothing changes. the full new OU is :

OU=CRENOL_-_CUGY,OU=DOGE,OU=DJF,OU=Computers,OU=ACV,DC=adacv,DC=ad,DC=dv,DC=ch

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Did you try doing "Just run dsmove on command line with your parameters and look whats happen"?

Also, running @ComSpec & " \c notepad.exe" is the same thing as running "notepad.exe"

Edited by Manadar

Share this post


Link to post
Share on other sites

OK it works now..

i dis like :

EX:

$run = @ComSpec & " /c dsmove.exe CN="& $TFS &","& $computersOU &" -newparent """ & $selectedOU & """ -u "& $adUsername &" -p "& $adPassword

And it works ... thanks a lot for your help :D

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0