-----Original Message-----
From: Steven Peck [mailto:[EMAIL PROTECTED] 
Sent: Thursday, January 17, 2008 12:41 PM
To: MS-Exchange Admin Issues
Subject: Re: Mailbox Count

non-sequitor ....
Let's try and interpret this anyway.  It may help me understand
PowerShell better :)

On Jan 17, 2008 10:23 AM, Campbell, Rob
<[EMAIL PROTECTED]> wrote:
> Something I was messing with last night:

sets $logfile = to a series of text files..... event logs that have
been dumped to text files?  (gci is an alias for get-childitem)

*Gets the raw message tracking log files (E2k7)

> $logfiles = gci MSGTRK*.log
> foreach ($logfile in $logfiles){

@{} designates an array or a for-each?

*Designates and initializes a hash-table (dictionary array)
> $src_evt_ht = @{}

get the files (gc = get-content) assigned above

*Yes
> gc $logfile |% {

are you replacing stuff with a comma or breaking at comma's only?

*Splitting the line into a collection of strings separated at the
commas.


> if ($_ -notmatch "^\#.+$"){
> $rec = $_ -split ","

pull out source and event id's from the file ...
> $source = $rec[7]
> $event_id = $rec[8]
>

combine them and compare to each other and do something

*combines them, and adds each unique combination to the hash table if it
isn't already there, and sets an initial value of "1".  Increments the
existing entry value by 1 if it is already there.

> $src_evt = $source + "." + $event_id
> if ($src_evt_ht.$src_evt){$src_evt_ht.$src_evt =
> [int]$src_evt_ht.$src_evt + 1}
> else {$src_evt_ht.add("$src_evt","1")}
> }
> }

write results to log file...

*displays the name of the log file being processed, and writes the
resulting hash table to the console.

> $logfile.name
> write-host "`n"
> $src_evt_ht
>
> }

How did I do?

*Not bad.

Steven

**************************************************************************************************
 
Note: 
The information contained in this message may be privileged and confidential 
and 
protected from disclosure.  If the reader of this message is not the intended  
recipient, or an employee or agent responsible for delivering this message to  
the intended recipient, you are hereby notified that any dissemination,   
distribution or copying of this communication is strictly prohibited. If you  
have received this communication in error, please notify us immediately by  
replying to the message and deleting it from your computer. 
**************************************************************************************************

~ Ninja Email Security with Cloudmark Spam Engine Gets Image Spam ~
~             http://www.sunbeltsoftware.com/Ninja                ~

Reply via email to