Thanks, Steven.
That helped me pull the data out to be a reasonable value (i.e. 21-bytes instead of 1-byte). I had glanced at the pack/unpack functions but didn't actually try to use them.
However, I am trying to use the UserGetMiscAttributes module instead of the UserSetMiscAttributes module.
From your example, I think I'll still have to create a huge switch statement to get the 1's and 0's into text strings.
-----Original Message-----
From: Steven Manross [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 24, 2002 3:04 PM
To: 'DePriest, Jason R.'; Perl-Win32-Admin ([EMAIL PROTECTED])
Subject: RE: Win32::AdminMisc - user flag USER_LOGON_HOURS
I don't know why but contrary to Dave's belief, I had to set this up
this way to make it work, where the first line is the last few hours on
Sunday and then the next lines are Monday, Tuesday, etc...
%Logon_Hours = ('special' =>
[(1,0,0,0,0,0,0,
0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,0,0,0,0,0,0,
0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,
0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,
0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,
0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,
0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,0,0,
0,0,0,0,0,0,1,1,1,1,1,1,1,1,1,1,1,1,
)],
'normal' =>
[(1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,
)],
);
my $packed_hours = pack ( 'b*' ,
join('',@{$Logon_Hours{$hours_identifier}}) ) ;
if (Win32::AdminMisc::UserSetMiscAttributes ($pdc, $username,
USER_LOGON_HOURS =>
$packed_hours )) {
print " Succeeded setting Logon Hours for $username!\n";
} else {
print " Failed setting Logon Hours for $username!\nERROR:
",Win32::GetLastError(),"\n";
}
Steven
-----Original Message-----
From: DePriest, Jason R. [ mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 24, 2002 1:55 PM
To: Perl-Win32-Admin ([EMAIL PROTECTED])
Subject: Win32::AdminMisc - user flag USER_LOGON_HOURS
Dave Roth's documentation and website say this value points to a 21-byte
(168-bit) binary string in which each bit represents one hour of the
week.
Has anyone bothered to parse this flag out into english? The only way I
can think of is to write a pseudo-switch statement with a 168 'if'
statements that push the results into an array.
Plus, if I 'ord' the value from the flag (and no restrictions are set),
I get 255 and not 2E+167.
Thank you!
Jason R DePriest
