You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
667 B
Raku

#!/usr/bin/perl -w
use Win32::NetAdmin;
$host = '';
$username = "userName";
$password = "password";
$comment = "your comments";
# User's home directory.
$homedir = "C:\\users\\" . $username;
$logon_script = "";
$flags = UF_SCRIPT | UF_NORMAL_ACCOUNT;
$status = Win32::NetAdmin::UserCreate($host,$username,$password,
0, # Password age. Ignored.
USER_PRIV_USER, # Must use this value.
$homedir,$comment,$flags,$logon_script);
if ($status) {
print "Added $username account.\n";
} else {
print_error();
}
sub print_error {
print Win32::FormatMessage( Win32::GetLastError() );
}