@@ -5,7 +5,7 @@ package Win32::NetAdmin;
5
5
# Written by Douglas_Lankshear@ActiveWare.com
6
6
#
7
7
8
- $VERSION = ' 0.06 ' ;
8
+ $VERSION = ' 0.062 ' ;
9
9
10
10
require Exporter;
11
11
require DynaLoader;
@@ -323,14 +323,59 @@ contains two-character strings (drive letter followed by a colon).
323
323
324
324
=back
325
325
326
+ =head1 EXAMPLE
327
+
328
+ # Simple script using Win32::NetAdmin to set the login script for
329
+ # all members of the NT group "Domain Users". Only works if you
330
+ # run it on the PDC. (From Robert Spier <rspier@seas.upenn.edu>)
331
+ #
332
+ # FILTER_TEMP_DUPLICATE_ACCOUNTS
333
+ # Enumerates local user account data on a domain controller.
334
+ #
335
+ # FILTER_NORMAL_ACCOUNT
336
+ # Enumerates global user account data on a computer.
337
+ #
338
+ # FILTER_INTERDOMAIN_TRUST_ACCOUNT
339
+ # Enumerates domain trust account data on a domain controller.
340
+ #
341
+ # FILTER_WORKSTATION_TRUST_ACCOUNT
342
+ # Enumerates workstation or member server account data on a domain
343
+ # controller.
344
+ #
345
+ # FILTER_SERVER_TRUST_ACCOUNT
346
+ # Enumerates domain controller account data on a domain controller.
347
+
348
+
349
+ use Win32::NetAdmin qw(GetUsers GroupIsMember
350
+ UserGetAttributes UserSetAttributes);
351
+
352
+ my %hash;
353
+ GetUsers("", FILTER_NORMAL_ACCOUNT , \%hash)
354
+ or die "GetUsers() failed: $^E";
355
+
356
+ foreach (keys %hash) {
357
+ my ($password, $passwordAge, $privilege,
358
+ $homeDir, $comment, $flags, $scriptPath);
359
+ if (GroupIsMember("", "Domain Users", $_)) {
360
+ print "Updating $_ ($hash{$_})\n";
361
+ UserGetAttributes("", $_, $password, $passwordAge, $privilege,
362
+ $homeDir, $comment, $flags, $scriptPath)
363
+ or die "UserGetAttributes() failed: $^E";
364
+ $scriptPath = "dnx_login.bat"; # this is the new login script
365
+ UserSetAttributes("", $_, $password, $passwordAge, $privilege,
366
+ $homeDir, $comment, $flags, $scriptPath)
367
+ or die "UserSetAttributes() failed: $^E";
368
+ }
369
+ }
370
+
326
371
=cut
327
372
328
373
sub AUTOLOAD {
329
374
my ($constname );
330
375
($constname = $AUTOLOAD ) =~ s / .*::// ;
331
376
# reset $! to zero to reset any current errors.
332
377
$! =0;
333
- my $val = constant($constname , @_ ? $_ [0] : 0 );
378
+ my $val = constant($constname );
334
379
if ($! != 0) {
335
380
if ($! =~ / Invalid/ ) {
336
381
$AutoLoader::AUTOLOAD = $AUTOLOAD ;
0 commit comments