Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
;============================================================================== ; UDF_ADCOMPDELETE ;============================================================================== #DefineFunction UDF_ADCompDelete(sCompName, sDomain) ; Load the ADSI Extender AddExtender("wwads34i.dll") DomPath = StrCat("LDAP://DC=", sDomain, ",DC=com") sAdsiPath = DomPath sSearch = StrCat('(&(objectCategory=computer)(CN=', sCompName, '))') CompPath= dsFindPath(sAdsiPath, sSearch) nCount = ItemCount(CompPath, @TAB) If nCount != 1 BoxShut() Return 0 EndIf dsDeleteObj(CompPath) ; Delete the computer Account Return 1 #EndFunction sDomain="mydomain" sCompName=AskLine( "AD Server Delete","Please enter a name of a computer you wish to delete", "") q = AskYesNo('!! Computer Deletion Verification', StrCat("Are you sure you wish to delete all information regarding", @CRLF, sCompName)) If q != @YES Then Exit BoxOpen("AD Server Delete", "Initializing") CDel = UDF_ADCompDelete(sCompName, sDomain) If CDel == 1 Display(2, "AD Server Delete", StrCat(sCompName, " server deleted successfuly")) Else Errmsg = StrCat("Error Reclaiming Server", @CRLF, sCompName, @CRLF, "could not be found or", @CRLF, "More than one server matched criteria - Exiting") Message("AD Server Delete ERROR", Errmsg) Exit EndIf BoxShut()
Article ID: W15825
File Created: 2012:12:06:08:32:26
Last Updated: 2012:12:06:08:32:26