RE: Win32API::Net
Title: RE: Win32API::Net After you showed that it is just a bitwise '&' operation, I played around with it because it didn't make sense that the module would force you to make a table with the flag values. Then I realized that is what they mean by the 'symbols'. So if you import the symbols for the User* functions: use Win32API::Net qw(:User); You can then use the following, avoiding the creation of any table: print "Account disabled.\n" if ($hash{'flags'} & Win32API::Net::UF_ACCOUNTDISABLE()); Saves you some typing. Thanks for your help! Jim -Original Message- From: $Bill Luebkert [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 17, 2006 7:23 PM To: Jim Bartlett Cc: perl-win32-users@listserv.ActiveState.com Subject: Re: Win32API::Net Jim Bartlett wrote: > Woohoo. This works great! I appreciate the help (sorry for the newbie > questions). You can also table drive it (not sure of the complete set) : my %UF = ( SCRIPT => 0x0001, ACCOUNTDISABLE => 0x0002, HOMEDIR_REQUIRED => 0x0008, LOCKOUT => 0x0010, PASSWD_NOTREQD => 0x0020, PASSWD_CANT_CHANGE => 0x0040, ENCRYPTED_TEXT_PASSWD_ALLOW => 0x0080, TEMP_DUPLICATE_ACCOUNT => 0x0100, NORMAL_ACCOUNT => 0x0200, INTERDOMAIN_TRUST_ACCOUNT => 0x0800, WORKSTATION_TRUST_ACCOUNT => 0x1000, SERVER_TRUST_ACCOUNT => 0x2000, DONT_EXPIRE_PASSWD => 0x1, MNS_LOGON_ACCOUNT => 0x2, SMARTCARD_REQUIRED => 0x4, TRUSTED_FOR_DELEGATION => 0x8, NOT_DELEGATED => 0x10, PASSWORD_EXPIRED => 0x80, TRUSTED_TO_AUTH_FOR_DELEGAT => 0x100, ); my %rev_UF = reverse %UF; for my $flag (0x203, 0x201, 0x202) { foreach (sort keys %rev_UF) { print "$rev_UF{$_} " if $flag & $_; } print "\n"; } ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32API::Net
Title: RE: Win32API::Net Woohoo. This works great! I appreciate the help (sorry for the newbie questions). Jim -Original Message- From: Bullock, Howard A. [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 17, 2006 3:37 PM To: Jim Bartlett; perl-win32-users@listserv.ActiveState.com Subject: RE: Win32API::Net >>How do I use UF_ACCOUNTDISABLE() to extract just the "account disabled" flag? Thanks. [Bullock, Howard A.] my $UF_ACCOUNTDISABLE = $flags & 2 my $UF_HOMEDIR_REQUIRED = $flags & 8 my $UF_LOCKOUT = $flags & 16 my $UF_PASSWD_NOTREQD = $flags & 32 my $UF_PASSWD_CANT_CHANGE = $flags & 64 my $UF_ENCRYPTED_TEXT_PASSWD_ALLOW = $flags & 128 my $UF_DONT_EXPIRE_PASSWD = $flags & 65536 my $UF_MNS_LOGON_ACCOUNT = $flags & 131072 my $UF_SMARTCARD_REQUIRED = $flags & 262144 my $UF_TRUSTED_FOR_DELEGATION = $flags & 524288 my $UF_NOT_DELEGATED = $flags & 1048576 my $UF_PASSWORD_EXPIRED = $flags & 8388608 my $UF_TRUSTED_TO_AUTH_FOR_DELEGAT = $flags & 16777216 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Win32API::Net
Title: RE: Win32API::Net So the flags come back like this (when using printf command): Flags = 0203 Flags = 0201 Flags = 0203 Flags = 0201 Flags = 0201 How do I use UF_ACCOUNTDISABLE() to extract just the "account disabled" flag? Thanks. Jim -Original Message- From: $Bill Luebkert [mailto:[EMAIL PROTECTED]] Sent: Thursday, August 17, 2006 11:42 AM To: Jim Bartlett Cc: 'perl-win32-users@listserv.ActiveState.com' Subject: Re: Win32API::Net Jim Bartlett wrote: > I am trying to use Win32API::NET to retrieve all disabled user accts > on an NT domain. I can retrieve the 'flags' key from the hash after > executing an enum but I am not sure how to use the UF_ACCOUNTDISABLE() > function to determine acct status. The manpage indicates it is a > bitwise OR but that doesn't give me the desired result (it returned > all users as disabled which is not true). Any guidance? Thanks. Print the flags as a hex value and post your results. printf "Flags = %08X\n", $flags; UF_* values should be close to these: #define UF_SCRIPT 0x0001 #define UF_ACCOUNTDISABLE 0x0002 #define UF_HOMEDIR_REQUIRED 0x0008 #define UF_LOCKOUT 0x0010 #define UF_PASSWD_NOTREQD 0x0020 #define UF_PASSWD_CANT_CHANGE 0x0040 #define UF_TEMP_DUPLICATE_ACCOUNT 0x0100 #define UF_NORMAL_ACCOUNT 0x0200 #define UF_INTERDOMAIN_TRUST_ACCOUNT 0x0800 #define UF_WORKSTATION_TRUST_ACCOUNT 0x1000 #define UF_SERVER_TRUST_ACCOUNT 0x2000 #define UF_DONT_EXPIRE_PASSWD 0x1 ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Win32API::Net
Title: Win32API::Net I am trying to use Win32API::NET to retrieve all disabled user accts on an NT domain. I can retrieve the 'flags' key from the hash after executing an enum but I am not sure how to use the UF_ACCOUNTDISABLE() function to determine acct status. The manpage indicates it is a bitwise OR but that doesn't give me the desired result (it returned all users as disabled which is not true). Any guidance? Thanks. Jim Bartlett I replaced the headlights in my car with strobe lights, so it looks like I'm the only one moving. -- Steven Wright ___ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
RE: Running a script more than once a day
Use soon.exe, a utility from Microsoft to do just that. It is available off a Resource Kit or for free if you poke around MS's site. I use it to run a script every hour, by calling soon from within the script to reschedule itself. ie my $reschedule = `c:\\soon.exe 3600 c:\\scripts\\sieb_srv.bat`; # 3600 seconds = 1 hour Jim Jim Bartlett Systems Administrator Entrust [EMAIL PROTECTED] Phone:(613) 270-3254 Cell:(613) 296-4350 "If Barbie is so popular, why do you have to buy her friends?" -- Steven Wright ___ Perl-Win32-Users mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs