BoogY Posted September 22, 2009 Share Posted September 22, 2009 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 Link to comment Share on other sites More sharing options...
99ojo Posted September 22, 2009 Share Posted September 22, 2009 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 lotHi,dsmove <computername> -newparent ou=newou,ou=somewhere,dc=mydomain,dc=domain,dc=localKeep 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 More sharing options...
BoogY Posted September 22, 2009 Author Share Posted September 22, 2009 Thanks a lot mate Link to comment Share on other sites More sharing options...
BoogY Posted September 22, 2009 Author Share Posted September 22, 2009 (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 September 22, 2009 by BoogY Link to comment Share on other sites More sharing options...
99ojo Posted September 22, 2009 Share Posted September 22, 2009 $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 More sharing options...
jvanegmond Posted September 22, 2009 Share Posted September 22, 2009 Having this on the end &"" is useless. github.com/jvanegmond Link to comment Share on other sites More sharing options...
BoogY Posted September 22, 2009 Author Share Posted September 22, 2009 (edited) his still not changing the OU .... $move is giving this message = -2147024809 Edited September 22, 2009 by BoogY Link to comment Share on other sites More sharing options...
99ojo Posted September 22, 2009 Share Posted September 22, 2009 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 computer2) You may have several DC, so the change isn't replicated over all DC'sIf 1 + 2 aren't a solution:3) Just run dsmove on command line with your parameters and look whats happen4) You don't get any error message?;-))Stefan Link to comment Share on other sites More sharing options...
BoogY Posted September 22, 2009 Author Share Posted September 22, 2009 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 Link to comment Share on other sites More sharing options...
jvanegmond Posted September 22, 2009 Share Posted September 22, 2009 (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 September 22, 2009 by Manadar github.com/jvanegmond Link to comment Share on other sites More sharing options...
BoogY Posted September 22, 2009 Author Share Posted September 22, 2009 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now