Search
Generic filters
Exact matches only
Filter by Custom Post Type

Up Next guest co-host Don Jones joins Jon Walz as they talk to Jason Helmick

This week on the PowerScripting Podcast, Don Jones (@concentrateddon) is the guest co-host with Jon Walz and the guest will be Jason Helmick (@theJasonHelmick) Items up for discussion will be the Winter Scripting Games 2014, the PowerShell Summit NA and lots more. Join us Thursday Feb 20 at 9:30 PM EST

Testing for the Presence of a Registry Key and Value

There are a number of different ways to test for the presence of a registry key and value in PowerShell. Here’s how I like to go about it. We’ll use an example key HKLM:\SOFTWARE\TestSoftware with a single value Version:

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.

Reporting On Installed Windows Programs Via The Registry

Quite a common request for working with Windows machines is to report the software installed on them. If you don’t have a centralised system for reporting on client software (many places don’t) then you may turn to some form of scripted method to obtain this information.

Most people tend to head to Add / Remove Programs when thinking about what software is installed in Windows. However, not all applications will always populate information in there, depending on how they have been installed. Additionally, to query that information you would typically query the WMI class Win32_Product, however this can lead to performance issues.

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.

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...

Winter Scripting Games 2014 Tip #1: Avoid the aliases

Jan 16, 2014
0

Having been a judge for the previous 2 Scripting Game competitions as well as competing in the 2 before that, I have seen my share of scripts submitted that didn't quite meet the cut of what I felt were the best scripts. It doesn't mean that they wouldn't work out in the real world in a production environment (Ok, some wouldn't :)), but some were just really hard to read or others were doing things that I wouldn't consider to be a good practice. The first of several articles that I will be doing will start out with the use of aliases in scripts and why this is not necessarily a good idea.

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 #3 from the Winner of the Advanced Category in the 2013 Scripting Games

In my previous blog article (PowerShell Tip #2), I left off with the subject of inline help and stated there was a better way. I’m fast-forwarding through lots of concepts and jumping right into “Advanced Functions and Scripts” with this tip because they are where you’ll find the answer to a “better way” to add inline help.

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 #2 from the Winner of the Advanced Category in the 2013 Scripting Games

Tip #2 - Comment (Document) your code!

This is another one of those tips that probably isn't very popular, but regardless of how good you are at writing PowerShell scripts and functions, they're useless if no one else can figure out how to use them. You might be thinking that you're the only one who uses the PowerShell code that you write, but I'm sure that you like to go on vacation just like the rest of us and none of us are going to live forever.

In my tip #1 blog you learned that you need to "Read the Help!". This tip builds on the first one because it allows others to "Read the Help!" for the PowerShell code that you write.

The type of help that you want to provide for your PowerShell functions and scripts is "Comment Based Help". 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.

µ

Skip to toolbar