8000 Load libwin32-0.15 into trunk. · perl-libwin32/win32-netadmin@20650f5 · GitHub
[go: up one dir, main page]

Skip to content

Commit 20650f5

Browse files
committed
Load libwin32-0.15 into trunk.
1 parent 6c6a9a6 commit 20650f5

File tree

4 files changed

+192
-104
lines changed

4 files changed

+192
-104
lines changed

Changes

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
Revision history for Perl extension Win32::NetAdmin.
22

3+
0.062 Wed Aug 4 7:51:33 1999
4+
- added docs to EXAMPLE
5+
6+
0.061 (unreleased)
7+
- added a NetAdmin example from Robert Spier <rspier@seas.upenn.edu>.
8+
- minor changes for Perl 5.005xx compatibility
9+
310
0.06 Mon Sep 7 19:47:20 1998
411
- fixed GPF in LocalGroupIsMember()
512

Makefile.PL

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
use ExtUtils::MakeMaker;
22
WriteMakefile(
3-
'NAME' => 'Win32::NetAdmin',
4-
'VERSION_FROM' => 'NetAdmin.pm',
5-
'dist' => {COMPRESS => 'gzip -9f', SUFFIX => 'gz'},
6-
# 'INC' => '-I.\\include',
3+
'NAME' => 'Win32::NetAdmin',
4+
'VERSION_FROM' => 'NetAdmin.pm',
5+
'dist' => {COMPRESS => 'gzip -9f', SUFFIX => 'gz'},
6+
($] < 5.005 ? () :
7+
(
8+
'AUTHOR' => 'Douglas Lankshear <dougl@ActiveState.com>',
9+
'ABSTRACT_FROM' => 'NetAdmin.pm',
10+
)),
711
);

NetAdmin.pm

Lines changed: 47 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ package Win32::NetAdmin;
55
#Written by Douglas_Lankshear@ActiveWare.com
66
#
77

8-
$VERSION = '0.06';
8+
$VERSION = '0.062';
99

1010
require Exporter;
1111
require DynaLoader;
@@ -323,14 +323,59 @@ contains two-character strings (drive letter followed by a colon).
323323
324324
=back
325325
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+
326371
=cut
327372

328373
sub AUTOLOAD {
329374
my($constname);
330375
($constname = $AUTOLOAD) =~ s/.*:://;
331376
#reset $! to zero to reset any current errors.
332377
$!=0;
333-
my $val = constant($constname, @_ ? $_[0] : 0);
378+
my $val = constant($constname);
334379
if ($! != 0) {
335380
if ($! =~ /Invalid/) {
336381
$AutoLoader::AUTOLOAD = $AUTOLOAD;

0 commit comments

Comments
 (0)
0