wntUserDel

Deletes a user account.

Syntax:

wntUserDel(server-name, user-name [, input-format-flag])

Parameters:

(s) server-name: the UNC name of the server on which the function will execute (eg, "\\MYSERVER"), or "" for the local computer.

(s) user-name:the name of the user to be deleted.

(i) input-format-flag: [optional] controls how the user-name parameter value is interpreted.
Value
 Meaning
0 (default) user-name of an actual user account name.
1 user-name contains a SID value instead of an actual user account name.

Returns:

(i) always 1.

 

wntUserDel can also remove a workstation from a domain. The server-name parameter requires a valid servername. The user-name parameter, should be a computer (workstation) name (in upper case) with a trailing '$'. Here is an example:

wntUserDel("\\server", "COMPUTERNAME$",0)

 

Example:
 
; Load Appropriate Extender AddExtender('wwwnt34i.dll',0,'wwwnt64i.dll')
wntUserDel("\\Server1", "jdoe",0) Exit

*OR*

; Load Appropriate Extender
AddExtender('wwwnt34i.dll',0,'wwwnt64i.dll')

;Remove a workstation from a domain PC = "Server" Wks = "Wks" Wks = StrUpper(Wks) AccountDel = AskYesNo("Attention", StrCat("Are you sure to remove ", Wks, " from", PC, "?")) If AccountDel == @YES    GoSub DelAccount Else    Display(3, "Note", "User not sure, Program aborted") EndIf Exit
:DelAccount WksAccount = wntUserExist(StrCat("\\", PC), StrCat(Wks, "$"),0) If WksAccount == @TRUE    Del = wntUserDel(StrCat("\\", PC), StrCat(Wks, "$"),0) Else    Message("ERROR", StrCat(Wks, " doesn't exist on ", PC)) EndIf Return
See Also:

wntUserAdd, wntUserAddDat