BoogY Posted September 23, 2009 Share Posted September 23, 2009 HELLO THERE EVERYONE I have another AD question : How can i delete (remove) a PC from AD, OU ??? I dit try with netdom remove but not working. Thanks a lot. Link to comment Share on other sites More sharing options...
jvanegmond Posted September 23, 2009 Share Posted September 23, 2009 Post your script that uses netdom remove. github.com/jvanegmond Link to comment Share on other sites More sharing options...
BoogY Posted September 23, 2009 Author Share Posted September 23, 2009 Func deleteFromDomain($adUsername,$adPassword) ;------------------------------------------------------------------------------ ; les variables pour la commande netdom.Execute ;------------------------------------------------------------------------------ $DomUser = $adUsername $DomPwd = $adPassword $CompName = GUICtrlRead($txtTFS) ;------------------------------------------------------------------------------ ; Delete the computer from the $oucomp ;------------------------------------------------------------------------------ $delete = RunWait(@ComSpec & " /c netdom.exe remove /domain:ADACV "& $CompName & _ " /userd:ADACV\"& $DomUser & " /passwordd:"& $DomPwd,"",@SW_HIDE) ;------------------------------------------------------------------------------ ; Afficher le resultat de la commande ;------------------------------------------------------------------------------ If $delete = 0 Then ;~ MsgBox(0,"ERREUR","Le pc n'as pas été supprimé de domain ADACV" & @CRLF & "Erreur : " & @error) UpdateProgressText("ERREUR de suppression du domain ADACV [PC] : " & $CompName) Else ;~ MsgBox(0,"Succès","Le pc " & $CompName & " a été supprimé du domain ADACV") UpdateProgressText("L'ordinateur " & $CompName & _ " a été supprimé avec succès du domain ADACV") EndIf EndFunc Link to comment Share on other sites More sharing options...
jvanegmond Posted September 23, 2009 Share Posted September 23, 2009 This doesn't look right to me: /domain:ADACV "& $CompName Did you try it in the run box? Also, read your last topic about using @ComSpec /c github.com/jvanegmond Link to comment Share on other sites More sharing options...
BoogY Posted September 23, 2009 Author Share Posted September 23, 2009 this is the help from microsoft : Example 8: Remove a Workstation or Member Server from a Domain To remove mywksta from the mydomain domain and make the workstation a part of a workgroup, type the following at the command prompt: netdom remove /d:mydomain mywksta /ud:mydomain\admin /pd:password what about @ComSpec /c ?? Link to comment Share on other sites More sharing options...
BoogY Posted September 23, 2009 Author Share Posted September 23, 2009 actualy it disables the workstation its not deleting it from the domain or the OU Link to comment Share on other sites More sharing options...
jvanegmond Posted September 23, 2009 Share Posted September 23, 2009 You're making the exact same mistakes as in your previous topic. First try the command in the run box, if it works, translate into AutoIt. Also, using running @ComSpec & "/c notepad.exe" is the same as running "notepad.exe". See the similarities here? github.com/jvanegmond Link to comment Share on other sites More sharing options...
99ojo Posted September 23, 2009 Share Posted September 23, 2009 (edited) actualy it disables the workstation its not deleting it from the domain or the OUHi,the disabling is by design. If you want to join the computer again, his SID in domain wouldn't change.DSRM is your friend, if you really want to delete the computeraccount. Open cmd and type dsrm /? for syntax.Or you may look here as well:http://technet.microsoft.com/en-us/library/cc776784(WS.10).aspx;-))Stefan Edited September 23, 2009 by 99ojo Link to comment Share on other sites More sharing options...
BoogY Posted September 23, 2009 Author Share Posted September 23, 2009 its what i'm trying to do now bur i dont want to delete everithing cause am at work ... i have this syntax : dsrm.exe -subtree -exclude -noprompt -d DOMAIN -u USER -p PASSSWORD CN=COMPUTER,OU=CRENOL,OU=DG,OU=DF,OU=Computers,OU=ACV,DC=ADACV,DC=AD,DC=ETAT,DC=CH will it delete juste the computer or everithing in the OU CRENOL ? Link to comment Share on other sites More sharing options...
99ojo Posted September 23, 2009 Share Posted September 23, 2009 its what i'm trying to do now bur i dont want to delete everithing cause am at work ...i have this syntax : dsrm.exe -subtree -exclude -noprompt -d DOMAIN -u USER -p PASSSWORD CN=COMPUTER,OU=CRENOL,OU=DG,OU=DF,OU=Computers,OU=ACV,DC=ADACV,DC=AD,DC=ETAT,DC=CHwill it delete juste the computer or everithing in the OU CRENOL ?Hi,For deleting one computer:dsrm "CN=COMPUTER,OU=CRENOL,OU=DG,OU=DF,OU=Computers,OU=ACV,DC=ADACV,DC=AD,DC=ETAT,DC=CH" -noprompt -d DOMAIN -u USER -p PASSWORDYou use -subtree for deleting Organizational Units and its structure beneath. You may use it to delete all computerobjects in an OU.;-))Stefan Link to comment Share on other sites More sharing options...
BoogY Posted September 23, 2009 Author Share Posted September 23, 2009 thanks man your realy a saver thanks a lot for your help Link to comment Share on other sites More sharing options...
BoogY Posted September 23, 2009 Author Share Posted September 23, 2009 it work thanks agen And for Manadar : i get the picture for @ComSpec THANKS A LOT 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