WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Microsoft Client
plus
plus

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

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:   W14472
Filename:   Remove Workstation from a Domain.txt
File Created: 2001:03:01:13:55:14
Last Updated: 2001:03:01:13:55:14