Jump to content

Recommended Posts

Posted

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

Posted

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

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
Posted

$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

Posted (edited)

his still not changing the OU ....

$move is giving this message = -2147024809

Edited by BoogY
Posted

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

Posted

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
Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...