<?xml version="1.0" encoding="windows-1252"?>
<node id="9401" title="Adminmail.pl" created="2000-04-27 14:06:28" updated="2005-08-11 05:21:28">
<type id="1748">
sourcecode</type>
<author id="8943">
ergowolf</author>
<data>
<field name="doctext">
&lt;CODE&gt;
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-&gt;new($smtp_host, Timeout =&gt; 30) || die "Can't connect to $smtp_host.\n";

$smtp-&gt;mail($from) || die "cannot mail from.\n\n";

$smtp-&gt;recipient(@recip_list);	
$smtp-&gt;data();

$smtp-&gt;datasend("To:\tPerl Recipients\n");
$smtp-&gt;datasend("Subject:\tPerl output of Users in the domain\n\n");

Win32::NetAdmin::GetUsers($dc, undef, \@users) || die "GetUsers failed.\n";

foreach (@users) {
$smtp-&gt;datasend( "$_\n\n");
}

$smtp-&gt;dataend;
$smtp-&gt;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 results 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
&lt;/CODE&gt;



</field>
<field name="codedescription">
This program grabs a list of all users on the domain and
emails them to whoever you specify</field>
<field name="codecategory">
NT admin</field>
<field name="codeauthor">
ergowolf</field>
</data>
</node>
