I did make some changes to the above script to make it run 1) my $privilege = ""; 2) my $flags = ""
The appropriate action would be to remove these unused variables, not meaninglessly changing their value.
#!/usr/bin/perl
use strict;
use warnings;
use Win32::NetAdmin qw( UserGetAttributes );
my $username = Win32::LoginName();
UserGetAttributes(
"",
$username,
my $password,
my $password_age,
my $privilege,
my $home_dir,
my $comment,
my $flags,
my $script_path
)
or die("UserGetAttributes: $^E\n");
print "The home dir for user $username is $home_dir\n";
When I run the code, I get a zero-length string too. Going to Computer Management and peeking at my user, the home dir is indeed blank there. I set the home directory of a test user to c:\foo using Computer Management, and UserGetAttributes returned c:\foo. It's working fine.
the homedir is not seen in the result
Then it must not be set.
|