Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: NetAdmin::UserCreate

by clscott (Friar)
on Nov 04, 2004 at 18:13 UTC ( [id://405249]=note: print w/replies, xml ) Need Help??


in reply to NetAdmin::UserCreate

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; } }
--
Clayton

Replies are listed 'Best First'.
Re^2: NetAdmin::UserCreate
by Anonymous Monk on Nov 04, 2004 at 18:31 UTC
    Thanks for getting back to me. My orginal testing had them without the quotes. I just tried it again by removing the quotes, but the output is the same failure, 87.

      That was the only error I could see wit hte perl, the rest is likely in the actual permissions you are trying to set?

      Is there a way to get more information out of the error messages?

      --
      Clayton
        I decided to use Win32::OLE instead. Win32::OLE worked perfectly, Ex:
        $target = Win32::OLE-> GetObject("WinNT://$server"); print "OLE Error: ".Win32::OLE->LastError)."\n"; $user = $target-> Create("user", wacka); print "OLE Error: ".Win32::OLE->LastError)."\n"; $set=$user->SetInfo;

        Thanks for your feedback.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://405249]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-03-28 21:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found