in reply to Re^2: Overlapped i/o operation
in thread Overlapped i/o operation

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.

Replies are listed 'Best First'.
Re^4: Overlapped i/o operation
by kingjamesid (Acolyte) on Sep 14, 2009 at 16:34 UTC
    This code doenst work !!! :-( Still the same error. From the khen's code, i took some snippets to make it work. Like - final version that worked
    use strict; use warnings; use Win32::NetAdmin qw(UserGetAttributes); my $server = ""; my $username = Win32::LoginName; my $password = 'password'; my $passwordage = 0; my $homeDir = 'c:\\'; my $comment = 'The home dir for user'; my $scriptpath = 'C:\\'; Win32::NetAdmin::UserGetAttributes( "", $username, my $Getpassword, my $Getpasswordage, my $Getprivilege, my $GethomeDir, my $Getcomment, my $Getflags, my $Getscriptpath ); print "The homedir for $username is $homeDir \n";
    Why your code didnt work, even though its looks same. But what I dont understand is UserGetAttributes function is not used at all. In the above code, we are using some variables thats filled in and not from variables that are filled by USerGetAttributes. Shouldnt I say
    print "The homedir for $username is $GethomeDir";
    Please suggest and very sorry guys, I am just learning Perl if you think my questions are silly.