Recently Marco Shaw posted a little nntp-stats script in the microsoft.public.windows.powershell newsgroup that I thought was pretty neato, and right up my alley since we were in the middle of adding get-nntp and send-nntp cmdlets to the /n software NetCmdlets product. So as a tip of the hat to Marco, here is my version.
Poster Stats:
Get-nntp returns a collection of objects containing the subject, articleid, sender, references, etc of articles posted in a particular newsgroup. I put together a few lines of code that uses get-nntp to create a hashtable of people who have posted in the PowerShell newsgroup and how many times.
I'll give this a run with a count parameter value of 2 so that I can easily show the actual article data returned by get-nntp itself. Below you can see the output of my call to the nntpstats script with count = 2, just two posters, each with 1 post.
Now here is the $articles object that was returned by get-nntp:
Incidentally, you could create a link to any of these articles in Google Groups by appending the url-encoded messageid (without the angle brackets) to http://groups.google.com/groups?threadm=.
Now here's the output of the nntpstats script after retrieving the last 100 articles from the PowerShell newsgroup:
Search:
I can tweak this script to give me a list of messages that match a particular search criteria. Unfortunately most NNTP servers don't implement the search capabilities that are specified in the NNTP RFC's, so implementing such a search requires retrieving and searching article bodies manually: