Technical

As you may know if you’re following me on twitter, I’ve tried to help when possible with the recording or streaming of PowerShell & DevOps events. From a couple of hours recording for a user group, to several days of PowerShell conference recording and streaming, I’ve went through a fair share of experiments (a.k.a. failures). I am by no mean an expert in the subject, and not a professional in this field either. I’m an amateur, who’s spent a bit of money and time trying to help, mainly because I’ve been on the event organiser side, and I know the effort required to deliver recordings, in terms of budget, time and effort.

If you’re attending events, or not, and wondering why it is so hard or expensive to get decent recordings published, I hope this detailed explanation will help you understand why. The investment needed, even for amateur recordings or streaming, is substantial and it may feel unfair for attendees to bear the cost and share the benefits. This, however would be worth another post, so it’s out of scope.

If you just want to know what I recommend, jump to the conclusion. Otherwise, I’ll take a tour of my experience and what I learnt.

Read Full Article

Another common challenge with DSC, is how to compose DSC configurations.

People have seen the trick of having a Configuration, and the following code within:


Configuration MyDSCConfig {
Node $ConfigurationData.AllNodes.nodename {
if($Node.roles -contains 'MyRole') {
# do stuff here, like calling DSC Resources
MyCompositeResource StuffForMyRole {
#
}
}
if($Node.roles -contains 'MyOtherRole') {
MyOtherResource OtherStuff {
#
}
}
}
}

view raw

MyDscConfig.ps1

hosted with ❤ by GitHub

This is a good way to get started and works well for small-ish configurations, but it gets out of hand pretty quickly, as it’s hard to read all the if statements and their content. Some variant of this are using Where clauses around the Node expression.

Read Full Article

I’m writing and using a PowerShell module called “Datum” to manage DSC Configuration Data, and raise cattle at work. This is a write up to explain the problem, and why I’m writing it.

I assume you already know a bit about Desired State Configuration, but if it’s new to you or vague, go grab yourself The DSC Book by Don Jones & Missy Januszko, which packs all you need to know about out-of-the-box DSC, and more.

This post tries to explain the DSC Configuration Data composition challenge that I attempt to solve with Datum. It does not include the solution and how to use Datum to solve those problems: you can look on the GitHub repository and see an example of a Control Repository, or come to the PowerShell Summit 2018, where I’ll be presenting Datum used in a DSC Infrastructure.

Read Full Article

Here’s a quick function to allow you something close to splatting with DSC resources:


function Get-DscSplattedResource {
[CmdletBinding()]
Param(
[String]
$ResourceName,
[String]
$ExecutionName,
[hashtable]
$Properties
)
$stringBuilder = [System.Text.StringBuilder]::new()
$null = $stringBuilder.AppendLine("Param([hashtable]`$Parameters)")
$null = $stringBuilder.AppendLine(" $ResourceName $ExecutionName { ")
foreach($PropertyName in $Properties.keys) {
$null = $stringBuilder.AppendLine("$PropertyName = `$(`$Parameters['$PropertyName'])")
}
$null = $stringBuilder.AppendLine("}")
Write-Debug ("Generated Resource Block = {0}" -f $stringBuilder.ToString())
[scriptblock]::Create($stringBuilder.ToString()).Invoke($Properties)
}
Set-Alias Name x Value Get-DscSplattedResource

Here’s why you may need it.

Read Full Article