Jump to content

Change the OU of a workstation


BoogY
 Share

Recommended Posts

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

Link to comment
Share on other sites

$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
Link to comment
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

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

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