#include <lsasecur.au3>
Const $UF_PASSWD_CANT_CHANGE = 0x40 ; User cannot change the password.
Const $UF_DONT_EXPIRE_PASSWD = 0x10000 ; Password should never expire.
Const $USERNAME = "netuser"
Const $PASSWORD = "1234567"
If _SeCreateLocalUser($USERNAME, $PASSWORD, BitOR($UF_DONT_EXPIRE_PASSWD, $UF_PASSWD_CANT_CHANGE)) = 0 Then
If @error <> 2224 Then ; User Already exists
MsgBox(48, "Error", _SeFormatMsg(@error))
Exit
EndIf
EndIf
If _SeAddAccountRight($USERNAME, $SE_DENY_INTERACTIVE_LOGON_RIGHT) Then
MsgBox(48, "OK", "Done")
Else
MsgBox(48, "Error", _SeFormatMsg(@error))
EndIf
|