Generic filters
Exact matches only
Filter by Custom Post Type

February 2015 NoVa PSUG Meeting Notes

Matt had to cancel so we had a mini-scripting games. Bellow are the challenges.


Challenge 1

Generate a list of US Presidents sorted by last name alphabetically.


Challenge 2

Create a DSC Configuration that verifies the w32time service is set to Automatic startup and is in a Running state.


Some links of note from our discussions:

The next meeting will be on March 25th at the Reston Microsoft Office.

Episode 273 - PowerScripting Podcast - The Scripting Games Team Winners

A Podcast about Windows PowerShell. Listen:

In This Episode

Tonight on the PowerScripting Podcast, we talk to Stephen Owen, Julie Andreacola and Jason Morgan about the Scripting Games




Guest - Stephen Owen & Julie Andreacola, Jason Morgan


  • Julie works as a consultant with SCCM
  • Jason works with Verizon in managed services - Jason's blog
  • Stephen been using powershell 4 yrs. Also System Center consultant in Atlanta. Stephen's website:


Chatroom Highlights:

[22:33:33] <halr9000> Beginning in Windows PowerShell 3.0, you can use the stop-parsing

[22:33:34] <halr9000>     symbol.

[22:33:34] <halr9000>         icacls X:\VMS --% /grant Dom\HVAdmin:(CI)(OI)F

<gpduck> Here's a link to a free Git book (pdf/epub/mobi) for the show notes:

<halr9000> GarySiepser that worked from search engine... 'powershell stop parsing' first link:







<randal_hicks> Anyone catch this today ?


<json_wud> ##Is github good for a close helpdesk team, or would another solution be good for a small non-dev group?

<randal_hicks> ## @StephenOwen You said 4 years of experience can you recall your bootstrap period , when you were first picking up Powershell and experiences involved with coming up to speed

The Question -

  • Stephen Owen - Wolverine--no Cable
  • Julie Andreacola - Flying
  • Jason Morgan - Professor X

Closing the Games

The judging is complete for the fourth and final event in the 2014 Winter Scripting Games.
This Games was something very different in that we presented 4 we complex scenarios that were designed to be as close as possible to the type of tasks you may have to perform at work. The solutions required multi-file answers - there's no way you could solve these with a one liner!

All of the teams that submitted entries rose to meet the hardest challenge I've seen in a Scripting Games - and I've taken part of judged all but the first Games.

All entries were scored by 2 judges with the judges being rotated to ensure that all judges scored each team in at least one event.

I'd like to thank the judges for their hard work and also thank the coaching team put together by Mike Robbins - most of all I'd like to thank all of the teams that entered for taking part.

In any Games we have winners and the winning teams from these Games are:
1.Kitton Mittons with 19.375 points (8 of 8 scores received)
2.TecHaH with 18.75 points (8 of 8 scores received)
3.Schnipersons with 18.5 points (8 of 8 scores received)

Congratulations to Kitton Mittons for winning the 2014 Winter Scripting Games - if a representative from the winning team could please contact Don Jones or myself we'll see about getting your prizes to you .

The Games are closed. .
Until the next time.

Using PowerShell Parameter Validation to Make Your Day Easier

Feb 4, 2014

A number of entries in the Winter Scripting Games use parameter validation, but some that I have seen may not be using it correctly or to its full potential.

Writing functions or scripts require a variety of parameters which have different requirements based on a number of items. It could require a collection, objects of a certain type or even a certain range of items that it should only accept.

The idea of parameter validation is that you can specify specific checks on a parameter that is being used on a function or script. If the value or collection that is passed to the parameter doesn’t meet the specified requirements, a terminating error is thrown and the execution of the code halts and gives you an error stating (usually readable) the reason for the halt. This is very powerful and allows you to have much tighter control over the input that is going into the function. You don’t want to have your script go crazy halfway into the code execution because the values sent to the parameter were completely off of the wall.

Click here to be redirected to the original post of this article on the author’s blog site where you can read the remainder of the article.

PowerShell Tip from the Head Coach of the 2014 Winter Scripting Games: Design for Performance and Efficiency!

There are several concepts that come to mind when discussing the topic of designing your PowerShell commands for performance and efficiency, but in my opinion one of the items at the top of the list is "Filtering Left" which is what I'll be covering in this blog article.

First, let's start out by taking a look at an example of a simple one-liner command that's poorly written from a performance and efficiency standpoint:

Click here to be redirected to the original post of this article on the author’s blog site where you can read the remainder of the article.


Adding and Removing Items from a PowerShell Array

Adding and removing Items from a PowerShell array is a topic which can lead to some confusion, so here are a few tips for you.

Create an array and we will note the type System.Array:

Click here to be redirected to the original post of this article on the author’s blog site where you can read the remainder of the article.

Testing for Admin Privileges in PowerShell

Sometimes when running a PowerShell script you may need to test at the beginning whether the process it was called from had Windows admin privileges in order to be able to achieve what it needs to do. Prior to PowerShell v4 I had used something along the lines of the following to test for this condition – not the most obvious piece of code ever to be fair:

Click here to be redirected to the original post of this article on the author’s blog site where you can read the remainder of the article.

Winter Scripting Games 2014 Tip #2: Use #Requires to let PowerShell do the work for you

Jan 20, 2014

In Version 2 of PowerShell, you had the ability to use #Requires –Version 2.0 to ensure that your scripts/functions would only run at a specified PowerShell version to prevent folks running an older version from wondering why things weren't working that well.

In this article, I will show you a couple of new additions to the #Requires statement that will make your life easier when writing functions that require specific pre-requisites rather than coding your own methods

Click here to be redirected to the original post of this article on the author’s blog site where you can read the remainder of the article..

How to make your submissions look good in the Scripting Games site's File window.

In the course of participating in the practice event, and working on event 1, I've noticed a couple of things about the way files are displayed in the File window on the Scripting Games site:

  • The site treats all files as ASCII; when you upload a Unicode file, syntax highlighting doesn't work and you wind up with what looks like an extra blank line between every line of the original file.
  • Transcripts taken with PowerShell's Start-Transcript command frequently contain lone Carriage Return or Line Feed characters, whereas the Scripting Games site appears to only like the CRLF pair. For example, lines that are separated by only LF (such as those in PowerShell's error or warning output), appear as a single line in the File window of the Games site.

I've written a function to clean up the encoding and content of files before uploading them to the Games site. It takes advantage of the fact that Get-Content has no problem reading files with any combination of EOL characters, and that Set-Content always injects CRLF pairs between its input strings. It also searches the file for any multi-byte Unicode characters; if none were found, it converts the file encoding to ASCII for a nicer display on the Games site.

#requires -Version 3.0

function Convert-GamesFile
    param (
        [ValidateScript({ Test-Path -Path $_ -PathType Leaf })]


    $contents = Get-Content -LiteralPath $Path -ErrorAction Stop

    # Check for Unicode characters

    $encoding = [Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding]::Ascii

    foreach ($line in $contents)
        if ([System.Text.Encoding]::UTF8.GetByteCount($line) -ne $line.Length)
            Write-Warning "File '$Path' contains multi-byte characters."
            Write-Warning "File encoding will be Unicode, though this doesn't display as well on the Scripting Games site."
            $encoding = [Microsoft.PowerShell.Commands.FileSystemCmdletProviderEncoding]::Unicode

    # Perform updates

    if ($BackupOriginal)
        Copy-Item -LiteralPath $Path -Destination ("$Path.bak") -ErrorAction Stop

    $contents | Set-Content -LiteralPath $Path -Encoding $encoding -ErrorAction Stop

Scripting Games 2014 - event submission tip

I've testing out the judging system using the practice event and one thing jumped out at me.

It was a lot easier to understand the entries for those teams that included a transcript of their entry.

I would very strongly recommend that you include a transcript of your entry running. As a minimum I would recommend that you include:
- the solution running - show each type of input required by the scenario (pipeline, single values, file etc)
- if parameter validation is asked for - show that in action
- show error handling in action if you can
- show the partial contents of any output file

Transcripts make for happy judges. You want your judges to be happy don't you...

Skip to toolbar