Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery

Re: Win32::Lanman::NetUserEnum ... FLAGS

by rchiav (Deacon)
on Nov 06, 2003 at 19:09 UTC ( #305119=note: print w/replies, xml ) Need Help??

in reply to Win32::Lanman::NetUserEnum ... FLAGS

The flags field is a bitmask. In order to see if a setting is flagged, you need to "and" the appropriate value against the flags value.

For example, if

${$user}{'flags'} & UF_ACCOUNTDISABLE
is true, then the Account Dsabled flag is set. Look through the POD for the module for all the UF_ constants. Those will be the flags you're going to "and" against.

Replies are listed 'Best First'.
Still wont work :(
by Anonymous Monk on Nov 06, 2003 at 20:10 UTC
    Thanks for the reply

    Can you think of any reason why this woudlnt work on a Win2K box?? I tried:
     print "Disabled" if ($info{'flags'} & UF_ACCOUNTDISABLE);
    But get nothing. The rest of the values in %info are there tho and if I just print $info{'flags'}; I get 66049
    Thanks in advance,
      Are you sure that the account is disabled?

      From the sounds of it you might not know what I meant by "and"ing. In case you're a little confused about that, here's how it works.

      That number you see isn't used as a decimal number as you typed it. It's actually used as a binary number. Each binary digit is used as either ON(1) or OFF(0). Now each of those binary places can also be represented as a decimal number.


      So... all of these numbers are represented as the UF_ constants. When you AND, you're checking if the bit represented in the UF_ variable is on.

      If, for the account you're checking, the account is disabled, I'm guessing you have a problem someplace else.

      Your other option is to use WMI. You can invoke it using Win32::OLE . Google for Win32_UserAccount and you should find some good information.

        I should have elaborated a bit more. I did try running the code against both enabled and disabled with same result. Different flags value tho.

        I knew what you meant by 'Anding' the bits. Same as figuring out a subnet... I even thought about converting the number to binary and figuring out the switch values with a pencil. :)

        Now for the very embarrasing truth of the matter...

        use Win32::Lanman != use Win32::lanman

        Change that detail and it all works like a charm.

        Apreciate the help and thanks to BrowserUK as well!!


Log In?

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

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (4)
As of 2021-08-06 00:34 GMT
Find Nodes?
    Voting Booth?
    My primary motivation for participating at PerlMonks is: (Choices in context)

    Results (44 votes). Check out past polls.