VBcoders Browse New Submit Contact Sign In

No account? Register free

Forgot password?

Create/Destroy User on Domain Administrating NT)

Newsgroup Posting  (15 Submissions)   Windows System Services   Visual Basic 3.0   Unknown Difficulty   Wed 3rd February 2021

Create a new user and destroy an existing user on a Windows NT domain..
When a user is
created, I set him to be a member of Domain Users while you can specify that he goes
into Domain User, Domain Guests, Domain Admins
Hong YAN

API Declarations
'Jeff Hong YAN 11/20/96 modified on 4/18/97
'This module shows how to create / destroy a user account.
'Modified according to MS KB article Q159498
'You must have account operator's right to run
' for dwPriv
Const USER_PRIV_MASK = &H3
Const USER_PRIV_GUEST = &H0
Const USER_PRIV_USER = &H1
Const USER_PRIV_ADMIN = &H2
' for dwFlags
Const UF_SCRIPT = &H1
Const UF_ACCOUNTDISABLE = &H2
Const UF_HOMEDIR_REQUIRED = &H8
Const UF_LOCKOUT = &H10
Const UF_PASSWD_NOTREQD = &H20
Const UF_PASSWD_CANT_CHANGE = &H40
Const UF_NORMAL_ACCOUNT = &H200

Declare Function StrToPtr Lib "kernel32" Alias "lstrcpyW" ( _
ByVal Ptr As Long, Source As Byte) As Long
' Add using Level 1 user structure
Declare Function NetUserAdd1 Lib "NETAPI32.DLL" Alias "NetUserAdd" _
(ServerName As Byte, ByVal Level As Long, Buffer As TUser1, lParmError _
As Long) As Long
Declare Function NetUserDel Lib "NETAPI32.DLL" (ServerName As Byte, _
UserName As Byte) As Long
Type TUser1 ' Level 1
ptrName As Long
ptrPassword As Long
dwPasswordAge As Long
dwPriv As Long
ptrHomeDir As Long
ptrComment As Long
dwFlags As Long
ptrScriptHomeDir As Long
End Type
Declare Function NetAPIBufferFree Lib "NETAPI32.DLL" Alias _
"NetApiBufferFree" (ByVal Ptr As Long) As Long
Declare Function NetAPIBufferAllocate Lib "NETAPI32.DLL" Alias _
"NetApiBufferAllocate" (ByVal ByteCount As Long, Ptr As Long) As Long

Rate Create/Destroy User on Domain Administrating NT) (4(4 Vote))
Create/Destroy User on Domain Administrating NT).bas

Create/Destroy User on Domain Administrating NT) Comments

No comments yet — be the first to post one!

Post a Comment

0/1000 characters