I'm sure that the problem is with the values of $account{priv} and $account{flags}.
You are quoting them, which turns the values into a
string but USER_PRIV_USER et al are really named numerical constants exported by the Win32::NetAdmin package.
You'll notice that they are not quoted in the example
on the page that you linked to.
Try removing the quotes around the values you are
putting in $account{priv} and $account{flags}
Try:
foreach my $server (@servers ){
my %account = (
server => "\\\\$server",
user => "Test",
password => "12345678",
homedir => "",
priv => USER_PRIV_USER,
flags => UF_SCRIPT |UF_TEMP_DUPLICATE_ACCOUNT,
comment => "Test",
logon => "",
);
unless (Win32::NetAdmin::UserCreate(@account{ qw/server user passw
+ord/}, 0, @account{ qw/priv homedir comment flags logon/}))
{
print LOG "$server,Problem,Unable To Create Account,".Win32::N
+etAdmin::GetError().",".localtime()."\n";
++$errorct;
} else {
print LOG "$server,Good,Added Account,".localtime()."\n";
++$goodct;
}
}
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.