Category Archives: PowerShell

My take on the Verified Effective self-assessment.

In the latest PowerShell.org TechLetter, Don released a slimmed-down version of a retired scenario for the Verified Effective exam, which is offered at the PowerShell Summits. I decided to type up a solution for it and share my thought process. … Continue reading

Posted in PowerShell, Professional | 2 Comments

Script Block properties in DSC resources

Here’s a little-known feature of Desired State Configuration. First, notice that the Script resource’s properties are all strings, not ScriptBlocks, in its schema: However, even though they’re strings in the MOF file, PowerShell will allow you to assign ScriptBlock objects … Continue reading

Posted in PowerShell | Tagged | Leave a comment

Manage Local Group Policy Objects from PowerShell and Desired State Configuration

Ever since DSC was first released, people have been asking how they can use it to manage user-specific settings. For the most part, the answer has been: don’t do that. DSC resources execute as LocalSystem, and are intended to manage … Continue reading

Posted in PowerShell | Tagged , | 14 Comments

Odd behavior with regex-based operators and case sensitivity

I happened to be browsing the PowerShell reddit page this evening, and came across a very interesting post: RegEx -NotMatch Isn’t Ignoring Case. I spent some time playing around with these operators for a bit, and came up with several … Continue reading

Posted in PowerShell | Tagged , , | Leave a comment

Long PowerShell Commands (Backticks, gasp!)

Hrm… I know that the prevailing opinion in the community is that when you have a long command, avoid using the backtick character for line continuations in PowerShell. I know why authors avoid it, and I know the “gotcha” around … Continue reading

Posted in PowerShell | Tagged , | 2 Comments

Automatic variables in Desired State Configuration

When you read through the DSC documentation at http://go.microsoft.com/fwlink/?LinkId=311940 , you learn that there are three automatic variables available to your DSC configuration code: $ConfigurationData , $AllNodes, and $Node. There are actually six automatic DSC variables. Not documented (and arguably … Continue reading

Posted in PowerShell | Tagged | 2 Comments

Learning to Apply Cryptography

Working on the ProtectedData module has been quite a learning experience for me. The purpose of that module is to provide an API for PowerShell scripters which can be just as simple to use as the Data Protection API – … Continue reading

Posted in PowerShell, Professional | 9 Comments

Proxy Functions for Cmdlets with Dynamic Parameters

While working on an update for Pester today, I had to tackle an interesting problem. Pester’s mocking framework was not working well for commands that use dynamic parameters. What Pester essentially does, when you mock a function or Cmdlet, is … Continue reading

Posted in PowerShell | Tagged , , | 4 Comments

Example of dealing with (crappy) legacy code

This morning, I happened to be looking over some of my early PowerShell code, written about a year ago if I remember correctly. My first impulse was to eliminate all evidence that it ever existed. The problem is, I published … Continue reading

Posted in PowerShell | Tagged , , , | 2 Comments

2014 European PowerShell Summit

The European PowerShell Summit, organized by PowerShell.org, will be in Amsterdam September 29 – October 1 2014 Continue reading

Posted in PowerShell, Professional | Tagged , | Leave a comment