Friday, December 29, 2006

Unofficial PowerShell newsgroup FAQ is born!

I've just posted a unofficial FAQ to  I'm hoping this will serve a useful purpose to any and all, especially newcomers to PowerShell.

I still have lots of blogs to add, 3rd party cmdlets like nsoftware and Powergadgets, and an attempt to do a detailed listing of the features available.

I'm expecting to use a versioning of the form 1.00.00, where "1" is for PowerShell version 1, the second set of numbers will indicate additions or deletions of any Q&As, and the third/final set of numbers will be represent simply modifications to existing Q&As.

Thursday, December 21, 2006 FAQ

I've just posted an article to where I'm volunteering to put up an FAQ posting regularly.

If anyone has any ideas, either post them in the newsgroup, as a comment to my blog entry or email them to me (marcoDOTshaw_AT_gmailDOTcom).

Wednesday, December 20, 2006

Calculating the median of a set of values

Doing an average on data isn't always the best way to deal with a set of data that you want to query.

The median, the value sitting in the middle where 50% of the values are lower and 50% of the values are higher, is a good measure.

For example, the median of 10,20,30 is the middle value of 20. In this case, 20 would also be the average (10+20+30=60,60/3=20). The median of 10,20,300 is still 20, but the average in this case would be 110 (10+20+300=330,330/3=110).

Script #1:
Calculate median of a file provided as an argument. Input file must be formatted as one numerical entry per line, formatted as something like:

Output is simply the median of the entire set of values.

get-median.ps1: get-median.ps1

Script #2:
Calculate median of a input file provided as an argument. Input file must be formatted as one entry per line, formatted as something like:

Output is the median of each set of users. For example:

get-median2.ps1: get-median2.ps1

Tuesday, December 19, 2006

Powershell NNTP group stats (using Powershell and .NET)

Using the .NET communications library from, I created a Powershell script to get stats from the newsgroup.

Currently, I list the total number of articles/posts, the total number of threads, the average of posts/thread, and list out in descending order the posters to the group.

I've just posted the stats for the week of December 6th to 10th.

Work in progress... My script may still have a few 'unwanted features', aka bugz.

I might add a section welcoming new posters, and might limit the post to just the top 20 posters.

I'm planning on running the script weekly.

Thanks to Jacques Barathon for helping me through a few issues, especially one of my first encounters with .NET.

nntp.ps1: [EDIT (Dec 23, 2006): script removed because others were using my script exactly as is, and posting to the group. I'll add another posting soon, explaining how the script mostly works.]

Powershell cmdlets for beginners

Don Jones will be publishing a series of blog articles on creating Powershell cmdlets. I am definitely looking forward to learning from one of the best!


Monday, December 18, 2006

Book download: scripts from Microsoft Windows Powershell Programming for the Absolute Beginner

One can download the scripts from an upcoming book on Windows Powershell from Thomson publishing authored by Jerry Lee Ford Jr.

They are mostly command-line games, following the steps I've seen with other books from this publisher in the "Absolute Beginner" series where they attempt to teach you programming/scripting languages by having you create games that you can play.


Friday, December 15, 2006

PowerGadgets out-map examples

Just some PowerGadgets examples using out-map below. What I've done was take the results from the Microsoft 2006 Scripting Games, and created 3 world maps with the data.

Running out-map locally on a machine will provide extra features like certain "mouse-over" events. For example, there's some shading features, and also doing a mouse-over on a specific country will show the country name along with the specific value.

Entrants per Country:
Entries per country

Perfect scores!:
Perfect scores!

Median per country (must be bug with USA, I will fix this soon):

I'll post a link to my script next week.

Data from: 2006 Scripting Games individual results

Wednesday, December 13, 2006

PowerGadgets out-map: pseudo parameter aliases

OK, these are not really parameter aliases, but just "shortcuts"... Parameter aliases need to be coded directly in the cmdlet, but there's another way.

(Formatting is off...)

Would you rather type this:

PS C:\> import-csv country.csv [pipe] out-map -mapsource World\WorldCountries -title test -label Country -values Points -conditionalattributes_0_condition_from 0 -conditionalattributes_0_condition_to 10 -conditionalattributes_0_color Red -conditionalattributes_0_text "0 to 10" -conditionalattributes_1_condition_from 11 -conditionalattributes_1_condition_to 20 -conditionalattributes_1_color Blue -conditionalattributes_1_text "11 to 20" -palette "highcontrast"

Or this:
PS C:\> .\out-map2.ps1 -csv country.csv -map_world -la Country -va Points -from_0 0 -to_0 10 -co_0 Red -te "0 to 10" -from_1 11 -to_1 20 -co_1 Blue -te_1 "11 to 20" -pa "highcontrast"

Running any combination of out-map2.ps1 with the flag "-test" as the first argument will just output the command that would have been run so you can check for the proper formatting.

out-map2.ps1: out-map2.ps1

Tuesday, December 12, 2006

PowerGadgets graphical cmdlets

A great 3rd party set of cmdlets is available from Out-chart, out-gauge, and out-map (and some others like invoke-sql, invoke-webservice, and send-mail) are very useful graphical cmdlets.

They have a great support forum (where I use the name "fedrac"). I've always been provided with great support from them.

I've mostly played around with out-map and like it a lot for mapping data to a map.

I might share some of my code after the Microsoft Windows Powershell contest is over this week.

Support forum:

Monday, December 11, 2006

Windows PowerShell Scripting Sweepstakes - Ends December 15th

The Microsoft Scripting Guys have had a Windows Powershell contest up since November 1st.  Anyone can submit a Windows Powershell script and be entered into a random draw for some awesome prizes.  I've entered a few times in a couple of categories.

Friday, December 8, 2006

My first blog entry

The main purpose for the creation of this blog is to have a site about myself for the 2007 Microsoft Scripting Games.

I was given an opportunity to be part of the activities leading up to the 2007 Games by Microsoft. I scored a perfect score in the 2006 Games. Along with 54 other people who had perfect scores, Microsoft will be doing a daily highlight of past contestants.

I am excited about the 2007 Games. From what I understand, they are planning to have 4 different categories: VBscript beginner, VBscript expert, Powershell beginner, and Powershell expert. I'm excited about the Powershell expert category!

I love Powershell, and have been starting to script with it since November 2006.