Thanks, I'll give it a try. It probably seems like a trivial exercise, but it's helping me learn the workings of Powershell, and helped me figure whan a problem started that looked like it was going to be a tedious process using the gui.
-----Original Message----- From: Michael B. Smith [mailto:[EMAIL PROTECTED] Sent: Thursday, January 17, 2008 4:38 PM To: MS-Exchange Admin Issues Subject: RE: Mailbox Count Slightly denser (untested but seems right): gci MSGTRK*.log -name |% { $src_evt_ht = @{} $_.Name gc $_ | foreach { if ($_[0] -neq "#"){ $rec = $_ -split "," $src_evt_ht.[($rec[7] + "." + $rec[8])] += 1 } } write-host $src_evt_ht } Regards, Michael B. Smith MCSE/Exchange MVP http://TheEssentialExchange.com -----Original Message----- From: Campbell, Rob [mailto:[EMAIL PROTECTED] Sent: Thursday, January 17, 2008 3:54 PM To: MS-Exchange Admin Issues Subject: RE: Mailbox Count Thanks! That makes it much easier! $logfiles = gci MSGTRK*.log foreach ($logfile in $logfiles){ $src_evt_ht = @{} gc $logfile |% { if ($_ -notmatch "^\#.+$"){ $rec = $_ -split "," $source = $rec[7] $event_id = $rec[8] $src_evt = $source + "." + $event_id $src_evt_ht.$src_evt += 1 } } $logfile.name write-host "`n" $src_evt_ht } -----Original Message----- From: Michael B. Smith [mailto:[EMAIL PROTECTED] Sent: Thursday, January 17, 2008 2:08 PM To: MS-Exchange Admin Issues Subject: RE: Mailbox Count Associative arrays (hash tables) support "Lazy Add". So this 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")} just needs to be $src_evt_ht[$src_evt] += 1 Regards, Michael B. Smith MCSE/Exchange MVP http://TheEssentialExchange.com -----Original Message----- From: Campbell, Rob [mailto:[EMAIL PROTECTED] Sent: Thursday, January 17, 2008 1:23 PM To: MS-Exchange Admin Issues Subject: RE: Mailbox Count Something I was messing with last night: $logfiles = gci MSGTRK*.log foreach ($logfile in $logfiles){ $src_evt_ht = @{} gc $logfile |% { if ($_ -notmatch "^\#.+$"){ $rec = $_ -split "," $source = $rec[7] $event_id = $rec[8] $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")} } } $logfile.name write-host "`n" $src_evt_ht } ************************************************************************ **** ********************** 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 ~ ~ Ninja Email Security with Cloudmark Spam Engine Gets Image Spam ~ ~ http://www.sunbeltsoftware.com/Ninja ~ ************************************************************************************************** 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 ~