Assuming you've chosen to output OLDCMP's report
switch to CSV format, you could start with something like below.
In this example, "oldcmp.txt" is the name of the output file you've generated
with OLDCMP.
Hope it helps give you some ideas...probably not
really the polished version : - )
-DaveC
# perl
# Set up an output
file...
open ( OUT , "> oldcmp-sams.txt" ) ;
open ( OUT , "> oldcmp-sams.txt" ) ;
# Read in the existing CSV/TXT
file...
open ( LOG , "<oldcmp.txt" ) ;
@a = <LOG> ;
close LOG ;
open ( LOG , "<oldcmp.txt" ) ;
@a = <LOG> ;
close LOG ;
# Get rid of all lines that
don't begin with a DN...
for $i ( @a ) {
push ( @b , $i ) if ( $i =~ /^cn=/ ) ;
}
for $i ( @a ) {
push ( @b , $i ) if ( $i =~ /^cn=/ ) ;
}
# Keep just the
samaccountname, which is the 3rd field in joe's output in this case...
for $j ( @b ) {
push ( @c , ( split ( /;/ , $j ) ) [2] ) ;
}
for $j ( @b ) {
push ( @c , ( split ( /;/ , $j ) ) [2] ) ;
}
# Write out that last array to
a file...
print OUT join ( "\n" , @c ) ;
close OUT ;
print OUT join ( "\n" , @c ) ;
close OUT ;
# End!
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Tom Kern
Sent: Monday, October 10, 2005 4:21 AM
To: ActiveDir@mail.activedir.org
Subject: [spam] Re: [ActiveDir] oldcmpi'm trying to get rid of all those fields except sAMAccountName with perl.any ideas?can oldcmp take as input the same file it created to disable accounts?anyway, i'd like to know how to parse that file in perl and get rid of all the fields except that one and use that file as input to oldcmp or ds* commands with For, to disable just some accou
nts that oldcmp finds.thanks
On 10/9/05, joe <[EMAIL PROTECTED]> wrote:Noyup
From: [EMAIL PROTECTED] [mailto: [EMAIL PROTECTED]] On Behalf Of Tom Kern
Sent: Sunday, October 09, 2005 9:10 AM
To: activedirectory
Subject: [ActiveDir] oldcmp
is there anyway to just dump the sAMAccountName from oldcmp for inactive computers to csv?I want to filter all the default fields out(pwdLastSet,dn,cn,etc).thanks
-----------------------------------------------------------------
Visit our Internet site at http://www.reuters.com
To find out more about Reuters Products and Services visit http://www.reuters.com/productinfo
Any views expressed in this message are those of the individual
sender, except where the sender specifically states them to be
the views of Reuters Ltd.