How to Remove a Workstation from a Domain
Keywords: Remove a Workstation from a Domain
Question:
Is there any scripting command that will remove a workstation from a domain?I am creating a utility for our helpdesk to be able to remove workstations from the domain without having admin or account operator access.
Answer:
Hopefully this help you.AddExtender("wwwnt34I.dll") PC = "Server" Wks = "Wks" Wks = StrUpper(Wks) AccountDel = AskYesNo("Attention", StrCat("Are you sure to remove ", Wks, " from ", PC, "?")) If AccountDel == @Yes Then GoSub DelAccount Else Display(3, "Note", "User not sure, Program aborted") Exit :DelAccount WksAccount = wntUserExist(StrCat("\\", PC), StrCat(Wks, "$")) If WksAccount == @True Del = wntUserDel(StrCat("\\", PC), StrCat(Wks, "$")) Else Message("ERROR", StrCat(Wks, " doesn't exist on ", PC)) Endif Return
Article ID: W14472Filename: Remove Workstation from a Domain.txt