#!/usr/bin/perl -w
############################################
############################################
# disabled.pl
# list disabled accounts in current NT 4.0 domain
############################################
# written by Dave Cottle
#       30/10/00        Dave Cottle             initial script
############################################
use strict;
use Win32::AdminMisc;

my ($user, @users, %attribs, $pdc);

$pdc = Win32::AdminMisc::GetPDC()
        or die ("can't get PDC $?$^E\n");

Win32::AdminMisc::GetUsers( $pdc, '' , \@users)
        or die ("failed to get user list $!\n$^E\n");

foreach $user (sort @users)
{
        {
                Win32::AdminMisc::UserGetMiscAttributes($pdc, $user,
\%attribs)
                        or die ("failed to get attribs for $user
$!\n$^E\n");
                if ($attribs{'USER_FLAGS'} & UF_ACCOUNTDISABLE)
                {
                        print $user."\n";
                }
        }
}

exit 0;

__END__

if you're having trouble, isolate it down to a test case and then post the
code. frequently you won't even need to get as far as posting..

use strict; and my(); all the time. run your code with -w all the time.

duplicate (get it to happen again)
simplify (remove code that doesnt relate to the error)
isolate (track down the error to a single function or sequence)
re-test (does it still give the same error)
think hard
post to group with comments
--
regards, dave
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin

Reply via email to