Parsing log files with Powershell

I found myself wanting to parsing a log file to find out which domain was getting the most newsletters. There are a variety of ways you can do this. Typically I would use Excel but there were more than 65K lines to import so I had to use something different. For kicks I did it in Powershell and here is how I did it in three lines. The log file is a tab delimited file without a header line. The field we are going to count is called, “RecipientDomain”.

 $header = "ServerFQDN","ServerDomain","IPAddress","MailTime","ClientDomain","RecipientDomain","Sender","Recipient","MessageID","Status","User","Size","ClientFQDN" 
$a = import-csv smtp-201007060000.csv -delimiter `t -header $header | where-object {($_.Status -eq "RECV=OK") } 
$a | group-object -property RecipientDomain -noelement | sort -property @{Expression="Count";Descending=$true}, @{Expression="Name";Descending=$false} | Select-object -First 20 

10 Laws of Productivity :: Tips :: The 99 Percent

Here are some great tips on improving your productivity. I included the highlights below. Read the full article to get the full explanation and some explanations.

10 Laws of Productivity :: Tips :: The 99 Percent

1. Break the seal of hesitation.
2. Start small.
3. Protoype, prototype, prototype.
4. Create simple objectives for projects, and revisit them regularly.
5. Work on your project a little bit each day.
6. Develop a routine.
7. Break big, long-term projects into smaller chunks or “phases.”
8. Prune away superfluous meetings (and their attendees).
9. Practice saying “No.”
10. Remember that rules – even productivity rules – are made to be broken.

How to remove the Windows.old folder that is generated when you install Windows 7

I am not sure how I got this 2.2 GB folder on my “C”  partition but it was not necessary. With free space on my “C” partition down to 5% it was time to clean house. The Vista instructions will work as written if you run the Disk Cleanup utility as the Administrator. If you happen to run the utility as a “mere mortal” there is a button in the Windows 7 version to restart the utility as an Administrator if you want to “Clean up system files”.

How to remove the Windows.old folder that is generated when you perform a custom installation of Windows Vista