Posts by Year

2020

Using Azure Monitor Workbooks to document your Azure resources

01/03/2020  |    13 minute read

In this post, we demonstrate how to build a self-updating inventory of Azure resources in any Resource Group, across multiple subscriptions. Then, we share the workbook to make it available to colleagues and other stakeholders.

2019

2018

2017

Writing and Using Custom Assertions for Pester Tests

10/31/2017  |    15 minute read

Pester, the awesome PowerShell testing framework has recently introduced a capability which allows us to extend our test assertions. This allows to simplify our tests by abstracting custom or complex assertion logic away from the tests and into separate scripts or modules.

Reducing whitespace in the HTML generated by Jekyll

09/08/2017  |    2 minute read

The output HTML of Jekyll-based sites may contain quite a lot a whitespace. This is especially noticeable with pages relying heavily on Liquid tags with conditional logic or looping.

Measuring PowerShell code complexity : Why and How

04/18/2017  |    16 minute read

Why does code complexity matter ? As Administrators or engineers, we deal with complexity all the time. We build, document, support and deploy complex systems on a pretty-much-daily basis. The expertise required to work with these systems is part of what makes us valuable. So why should we st...

Unit Testing with Pester : Storing complex Mock objects in a JSON file

02/14/2017  |    6 minute read

When unit testing with Pester, mocking is pretty much unavoidable, especially for code related to infrastructure, configuration, or deployment. We don’t want our unit tests to touch files, databases, the registry, and not to mention the internet, do we ?

Merging data from 2 PowerShell DSC configuration data files

01/06/2017  |    7 minute read

As you probably already know, when writing a DSC configuration, separating the environmental data from the configuration logic is a best practice. So all the environment-specific data gets stored in separate (typically .psd1) files. If you work with PowerShell DSC at medium-to-large scale, you (ho...

2016

How to create a custom rule for PSScriptAnalyzer

06/27/2016  |    8 minute read

As you probably know, PSScriptAnalyzer is a static code analysis tool, which checks PowerShell code against rules representing best practices and style guidelines. This is a fantastic tool to set coding style and quality standards, and if we want to, we can easily enforce these standards within a ...

Adding ConfigurationData dynamically from a DSC configuration

06/06/2016  |    6 minute read

When writing a DSC configuration, separating the environmental data from the configuration logic is a best practice : it allows to reuse the same logic for different environments, for example the Dev, QA and Prod environments.

My favorite PowerShell interview questions

05/02/2016  |    8 minute read

As you may already know, the only PowerShell certification program is being abandoned. Some people in the PowerShell community are trying to justify this by saying “There is no need for PowerShell cert” or “it’s too difficult to test PowerShell knowledge”.

Orchestrating the update of an IIS server farm with PowerShell DSC

02/29/2016  |    8 minute read

PowerShell Desired State Configuration (DSC) makes it easy to apply a configuration to a bunch of servers. But what if the servers are already in production, if the update requires a service restart and we need to make this happen with no service disruption ? That’s a different story.

Exploring the types exposed by PowerCLI

01/19/2016  |    5 minute read

One of the things I love about PowerShell, is that once we know the fundamentals, we can learn the rest on our own, by just exploring and experimenting. As I like to tell people, discoverability is the number 1 feature of PowerShell.

2015

Updating apps with PowerShell 5.0 and Chocolatey

11/23/2015  |    6 minute read

An introduction to the PackageManagement module If you are using Windows 10 or if you have installed the Windows Management Framework 5.x available here, you may have noticed a PowerShell module named PackageManagement. This is the new name for what was called OneGet in previous versions of the ...

Download Podcasts with PowerShell

11/06/2015  |    6 minute read

A while back, I saw this article from the Scripting Guy on parsing RSS feeds. Being an avid RSS feeds consumer and podcast watcher/listener, this was a “aha” moment.

Configure ESXi host RAMdisks with PowerCLI

10/20/2015  |    3 minute read

The symptoms of a full RAMdisk on a ESXi host can be pretty nasty and diverse. The possible causes are also very diverse (search for ramdisk full in the VMware Knowledge Base, you will see what I mean).

Automate the discovery of mandatory parameters

10/07/2015  |    5 minute read

Sometimes, when trying out a cmdlet I rarely use, I get that : This means I forgot to enter a parameter which is mandatory for this cmdlet. PowerShell is very forgiving and asks me nicely to enter a value for this parameter. You see, learning PowerShell is not about rote knowledge of every sing...

Configure Windows crash behaviour with PowerShell

10/04/2015  |    3 minute read

When there is a OS-handled crash (a blue screen), there are some settings in the Startup and Recovery Control Panel, which tells Windows how it should behave. For example, whether it restarts automatically or not, whether it writes a small, a kernel dump or a full memory dump, and where :

PowerShell equivalents for common Linux/bash commands

09/30/2015  |    10 minute read

The majority of my colleagues have more of a Linux background than Windows. So their cat and their grep are near and dear to their heart and their first reflex when they get into PowerShell is to replicate these commands.

Rebooting a server remotely

09/27/2015  |    3 minute read

“Have you tried turning it off and on again?” This quote from IT Crowd reflects probably the most universal stereotype about IT support. By the way, using this shortcut instead of actually diagnosing the problem shouldn’t be the usual course of action. But still, a reboot can really save you ...