PowerShell Show-Map

This PowerShell function launches a map in the browser using an address from the command line or the clipboard.

Plus, it checks which version of PowerShell is running and if it is v5 or later, will use the new Get-Clipboard cmdlet. If it is an older version of PowerShell, it will use .NET to get the text from the clipboard.

The default map url is Google, specify the -UseBing switch parameter to launch the map using Bing.

Visualize PowerShell Verbs

Visualizing data is fun. I came across the Brunel Visualization project and figured I’d kick the tires.

I created a dataset (csv file) containing the count verbs in my PowerShell session. Then I pointed Brunel Visualization tool at that csv and created a bubble chart.

Click the image below to render the interactive chart.
Note: It takes a bit of time for the Brunel website to import and render.


PowerShell to Generate the Dataset

New PowerShell DSC Resource Provider

I created a new PowerShell DSC (Desired State Configuration) Provider that compiles Elm Language files.

Elm is a functional programming language in your browser.

If you’re running PowerShell v5.0? It’s on the PowerShellGallery.
From the prompt PS C:\>Install-Module -Name ElmDSCResource

The source is up on GitHub HERE.

I built an interactive Buzzword Bingo page.


Using PowerShell to create Excel Spreadsheets without having Excel installed

This module makes working with Excel from PowerShell a breeze (plus, you don’t need Excel installed, great for server side spreadsheet creation).

Super simple, creates an Excel spreadsheet with all the process running on your box and the related data details.
Get-Process | Export-Excel -Path test.xlsx -Show

I added Conditional Formatting, check out the How To video:


Get the PowerShell Module

On GitHub and the PowerShell Gallery

PowerShell Enum and the Three Stooges

The Enum

PowerShell v5.0 comes with a new keyword, enum. An enum is a distinct type that consists of a set of named constants called the enumerator list.

Here, there are two constants, None and Sort. There can be many more.

The Update Function

When specifying parameters in a function, it is easier to constrain the parameter to a valid list so that the user cannot accidentally pass an invalid information. Casting the $action parameter to the [Action] enum lets PowerShell handle invalid input, saving you time from writing error handling code.

Plus, now that $action is of type [Action], you and your users can benefit from intellisense. You don’t need to look up the values, and tab completion works.

In Action

Setup up a list of names:

Now lets call update with an an invalid action.

PowerShell throws a nicely detailed error, even telling you what are valid values for the action parameter. This approach makes your scripting more bullet proof and cuts down emails with questions. All you need to do is create an enum and cast your parameters.

update : Cannot process argument transformation on parameter 'action'. Cannot convert value "BadAction" to type "Action". Error: "Unable to match the identifier name BadAction to a valid enumerator name. Specify one of the following enumerator names and try again: None, Sort"
At line:1 char:8
+ update BadAction $names
+ ~~~~~~~~~
+ CategoryInfo : InvalidData: (:) [update], ParameterBindingArgumentTransformationException
+ FullyQualifiedErrorId : ParameterArgumentTransformationError,update

Calling the update function with the valid Sort option, returns the sorted list of names.

The Full PowerShell Script

PowerShell v5.0 – ConvertFrom-String Buddy

There’s a couple new cmdlets in town, Convert-String and ConvertFrom-String that quickly turn semi-structured and hierarchical text, into PowerShell objects.

Here’s ConvertFrom-String Buddy

In action:


Here’s the PowerShell

It’s a WPF GUI written in PowerShell. You can paste in your data, experiment with typing in different templates and when you’re happy with the result, copy the PowerShell solution to the clipboard and you’re good to go.

Free giveaways at the Next PowerShell Meetup

June Blender, former Microsoft PowerShell team member. She wrote Get-Help for Windows PowerShell.

She’ll be at the NYC PowerShell Meetup doing talk “Thinking in Events” and providing a 30-day full license for PowerShell Studio.

RSVP Here for the MeetUp

Announcing PowerShell Cruise 2016!

I’ve been asked about organizing a PowerShell conference here in the North East and hit on the idea of doing it on a cruise, to the Bahamas. I talked with Jeff Langdon, “The Cruisnator” and we are good to go!

Food and lodging are covered and you see three ports Port Canaveral, Nassau Bahamas and Great Stirrup Cay (check out the itinerary). Bring your friends, significant others and children. It’s a PowerShellcation.

The inaugural Posh Cruise will be setting sail from the Manhattan Cruise Terminal in NYC June 18-25, 2016 for a 7 day Bahamian cruise on Norwegian Cruise Line.
More details on our Posh Cruise Page

Want to submit a talk? Do it here Call For Speakers.

Follow us on Twitter and Facebook for the latest details.