Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Adminmail.pl

by ergowolf (Monk)
on Apr 27, 2000 at 18:06 UTC ( #9401=sourcecode: print w/replies, xml ) Need Help??
Category: NT admin
Author/Contact Info ergowolf
Description: This program grabs a list of all users on the domain and emails them to whoever you specify
use strict;
use Win32::NetAdmin;
use Net::SMTP;

my $dc = "\\\\x";
my $from = 'x@x.com';
my @recip_list = ('x@x.com', 'y@y.com');
my $smtp_host = "x.x.x.x";
my @users = ();
my $VERSION = "1.2";

my $smtp = Net::SMTP->new($smtp_host, Timeout => 30) || die "Can't con
+nect to $smtp_host.\n";

$smtp->mail($from) || die "cannot mail from.\n\n";

$smtp->recipient(@recip_list);    
$smtp->data();

$smtp->datasend("To:\tPerl Recipients\n");
$smtp->datasend("Subject:\tPerl output of Users in the domain\n\n");

Win32::NetAdmin::GetUsers($dc, undef, \@users) || die "GetUsers failed
+.\n";

foreach (@users) {
$smtp->datasend( "$_\n\n");
}

$smtp->dataend;
$smtp->quit;

=head1 NAME

adminmail - This script grabs a list of all the users in a domain and 
+emails the results to an email address.

=head1 DESCRIPTION

This program is useful for quickly getting a list of all the users on 
+your domain.  I wrote this program when our Notes 
administrator "Maddog" needed a list of users on the domain.

=head1 README

This script grabs a list of all the users in a domain and emails the r
+esults to an email address.

=head1 PREREQUISITES

This script has a few requirements.  You will need the Win32::NetAdmin
+ and Net::SMTP modules.
You will also need to change the values for dc, from, recip_list, and 
+smtp_host.

=head1 COREQUISITES

None

=pod OSNAMES

MSWin32

=pod SCRIPT CATEGORIES

Win32/Utilities 

=cut
Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: sourcecode [id://9401]
help
Chatterbox?
[james28909]: i guess i should have done it in perl. i bet it woulnt have taken me 5 hours to figure out haha
[choroba]: In the end, I was able to upgrade Perl from 5.8.3 to 5.22 and install Net::SFTP::Foreign , at least for the task involved
[james28909]: what would be the best way to capture that stream with perl? ffmpeg args -rtp rtp://127.0.0.1?
[LanX]: if I was forced to talk about all security risks I encountered oO
[james28909]: if i did that with ffmpeg, i could then listen on the port with perl right?
[LanX]: one of my clients filtered a menu linking to Web pages according to user rights. .. but he didn't secure the access to those unlisted pages

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (11)
As of 2017-05-22 21:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?