You should check the return value from the UserSetMiscAttributes, and if false you should print the error message using:
 
    print Win32::FormatMessage ( Win32::GetLastError() );
 
Gary
-----Original Message-----
From: Dan Navilliat [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 10, 2001 10:03 AM
Cc: [EMAIL PROTECTED]
Subject: disable user account

Hello,

I am trying to disable a local ( i.e. non domain) user account. Here is the script that I am using 

 use Win32::AdminMisc; 

 $User = 'test';

if( Win32::AdminMisc::UserGetMiscAttributes( '\\\\pc1', $User, \%Hash ) )

{

$Hash{USER_FLAGS} = $Hash{USER_FLAGS} | UF_ACCOUNTDISABLE;

Win32::AdminMisc::UserSetMiscAttributes( '\\\\pc1', $User, USER_FLAGS, $Hash{USER_FLAGS} );

print " foo";

}

For some reason the account is not being disabled. Any idea s ?

Thanks

Dan

Reply via email to