Skip to content

Instantly share code, notes, and snippets.

Ben Gelens bgelens

Block or report user

Report or block bgelens

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
bgelens / Convert-PesterResultToJUnitXml.ps1
Created Aug 13, 2019
GitLab does not support NUnitXml as provided by Pester. Instead, it supports JUnitXml. This helper function takes the Pester output and generates a JUnitXml from it to be consumed by GitLab pipelines
View Convert-PesterResultToJUnitXml.ps1
function Convert-PesterResultToJUnitXml {
param (
$junit = '<?xml version="1.0" encoding="utf-8"?>'
$junit += "`n" + '<testsuites name="Pester" tests="{0}" failures="{1}" disabled="{2}" time="{3}">' -f @(
View Expand-PFX.ps1
param (
[string] $Path,
[string] $PFXPin
$resolvedPath = Resolve-Path -Path $Path
bgelens / nodeConfigurations.json
Last active Jan 10, 2019
arm template to deploy pre-compiled nodeConfigurations to Azure Automation DSC
View nodeConfigurations.json
"$schema": "",
"contentVersion": "",
"parameters": {
"automationAccountName": {
"type": "string",
"metadata": {
"description": "The name of the automation account."
bgelens / errorvariablemock.ps1
Created Jun 7, 2018
Have ErrorVariable populated through a Mock
View errorvariablemock.ps1
Mock -CommandName Get-SomeCommand -MockWith {
param (
$errorRecord = [System.Management.Automation.ErrorRecord]::new(
View module.psm1
$enums = Get-ChildItem -Path $PSScriptRoot\enums\*.ps1 -ErrorAction SilentlyContinue | ForEach-Object -Process {
Get-Content $_.FullName
if (Test-Path "$PSScriptRoot\Classes\classes.psd1") {
$ClassLoadOrder = Import-PowerShellDataFile -Path "$PSScriptRoot\classes\classes.psd1" -ErrorAction SilentlyContinue
$classes = foreach ($class in $ClassLoadOrder.order) {
$path = '{0}\classes\{1}.ps1' -f $PSScriptRoot, $class
View AzureUpdateManagement.ps1
function Get-SoftwareUpdateConfigurations {
[CmdletBinding(DefaultParameterSetName = 'list')]
param (
[string] $ResourceGroupName,
[string] $AutomationAccountName,
View deploy.json
"$schema": "",
"contentVersion": "",
"parameters": {
"osType": {
"type": "string",
"allowedValues": [
echo $1
cat /etc/os-release | grep -i pretty
View test.ps1
param (
[string] $Name = 'GitHub'
'Hello World from {0}!' -f $Name
View Expand-AzureRMTemplate.ps1
$armProfileModule = (Get-Module -Name AzureRM.profile -ListAvailable)[0]
Add-Type -Path "$($armProfileModule.ModuleBase)\Newtonsoft.Json.dll"
function Expand-AzureRMTemplate {
Validates ARM template in combination with parameter file and returns ARM expanded results.
Expand-AzureRMTemplate -TemplateFile c:\subnet.json -ParameterFile c:\param.json -ResourceGroupName 'myRG'
You can’t perform that action at this time.