Jump to content

Recommended Posts

Posted

HELLO THERE EVERYONE :D

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.

Posted

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

Posted

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 ??

Posted (edited)

actualy it disables the workstation its not deleting it from the domain or the OU

Hi,

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 by 99ojo
Posted

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 ?

Posted

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 ?

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 PASSWORD

You use -subtree for deleting Organizational Units and its structure beneath. You may use it to delete all computerobjects in an OU.

;-))

Stefan

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
×
×
  • Create New...