I am running ActivePerl 5.2 with Win32::AdminMisc installed. For some 
reason Win32::AdminMisc::UserGetMiscAttributes() just won't work for me 
under Windows 2000 Pro. I'm sure I'm doing something wrong, but I don't see 
what. My test script, which I gathered from Perl for System 
Administrators--a good book, iterates through the user list for the local 
machine and attempts to display the attributes for a user:

use Win32::AdminMisc;

Win32::AdminMisc::GetUsers('', '', \@users)
         or die "unable to get users: $!\n";

foreach $user (@users) {
         print "working on user $user...\n";

         Win32::AdminMisc::UserGetMiscAttributes('DUSTIN-BOX', $user, 
\%attribs)
                 or warn "unable to get attrib: $!\n";

         print join(":", $user,
                 '*',
                 $attribs{USER_USER_ID},
                 $attribs{USER_PRIMARY_GROUP_ID},
                 '',
                 $attribs{USER_COMMENT},
                 $attribs{USER_FULL_NAME},
                 $attribs{USER_HOME_DIR_DRIVE},
                 $attribs{USER_HOME_DIR},
                 ''),"\n";
}

Simple enough. Unfortunately, the UserGetMiscAttributes() method fails, as 
shown below. Please note that I added 'DUSTIN-BOX', the name of my machine, 
as the domain name. Before posting I scanned for a similar problem in the 
list archives and saw mention of this tactic. Unfortunately, it hasn't 
fixed the problem. My machine is not in a domain, so I would normally just 
use '' as the domain parameter for UserGetMiscAttributes().

C:\cygwin\home\dpuryear\wip\perl4sysadmin>perl user-win32.pl
working on user __vmware_user__...
unable to get attrib:
__vmware_user__:*::::::::
working on user Administrator...
unable to get attrib:
Administrator:*::::::::
working on user dpuryear...
unable to get attrib:
dpuryear:*::::::::
working on user Guest...
unable to get attrib:
Guest:*::::::::
working on user HelpAssistant...
unable to get attrib:
HelpAssistant:*::::::::
working on user SUPPORT_388945a0...
unable to get attrib:
SUPPORT_388945a0:*::::::::
working on user SUPPORT_b326ad0c...
unable to get attrib:
SUPPORT_b326ad0c:*::::::::

Regards, Dustin

_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to