Skip to content

Instantly share code, notes, and snippets.

Developing code for our customers and just for fun!

Stefan Stranger stefanstranger

Developing code for our customers and just for fun!
View GitHub Profile
stefanstranger / decompile-bicep-to-psarm.ps1
Last active Apr 21, 2021
Decompiling Bicep file to PSArm object
View decompile-bicep-to-psarm.ps1
Decompiling a bicep file to PSArm
Inspired on issue posted on PSArm Github repo.
# Decompile ARM template to Bicep file
bicep decompile C:\Users\stefstr\Documents\Github\PSArm\examples\simple-test\template.json
stefanstranger / parallel-pester-tests.ps1
Last active May 16, 2021
Run Pester Tests parallel
View parallel-pester-tests.ps1
# Example code of running multiple Pester test in parallel and merging the result into one NUnitReport Test Report file
#region Run Pester Test scripts in parallel
$job = Get-ChildItem -Path "./tests" -Filter "Demo*"
| ForEach-Object -Parallel {
Invoke-Pester -Path $_ -PassThru
} -ThrottleLimit 10 -AsJob
$Results = ($job | Wait-Job | Receive-Job -Keep)
stefanstranger / test.ps1
Last active Apr 7, 2021
Testing dynamic where in PowerShell
View test.ps1
$Test = [PSCustomObject] @{
FirstName = 'Stefan'
LastName = 'Stranger'
#"Difffrent parametr" = 'ok'
function Get-WhereObject {
[Parameter(Mandatory, Position = 0, ValueFromPipeline)][PSCustomObject] $Test
We couldn’t find that file to show.
stefanstranger / Get-YamlPipeline.ps1
Last active Jan 29, 2021
PowerShell script to retrieve Azure DevOps Yaml Pipelines
View Get-YamlPipeline.ps1
PowerShell script to retrieve Azure DevOps Yaml Pipelines
- PSDevOps PowerShell Module (Install-Module PSDevOps)
- powershell-yaml PowerShell Module (Install-Module powershell-yaml)
- Personal Access Token for Azure DevOps Organization and Project where you want to retrieve the Yaml Pipelines
Example: Return all Tasks within a job and steps.
$YamlPipelines | Select-Object -ExpandProperty Yaml |
Select-Object -ExpandProperty jobs |
stefanstranger / Validate-ACRName.ps1
Created Nov 21, 2020
Check Azure Container Registry Name
View Validate-ACRName.ps1
# Check if the name myRegistry can be used for a new Azure Registry Container.
# More info:
#region variables
$ACRName = 'myRegistry'
$ResourceType = 'Microsoft.ContainerRegistry/registries'
#region Get AccessToken
stefanstranger / choco.config
Last active Nov 11, 2020
Chocolatey configuration
View choco.config
<?xml version="1.0" encoding="utf-8"?>
<package id="7zip.install" version="19.0" />
<package id="ARMClient" version="1.8.0" />
<package id="autoruns" version="13.98.20200930" />
<package id="azure-cli" version="2.14.2" />
<package id="azure-functions-core-tools-3" version="3.0.2996" />
<package id="chezmoi" version="1.8.7" />
<package id="chocolatey" version="0.10.15" />
<package id="chocolatey-core.extension" version="" />
stefanstranger / HelloWorldUD-Example.ps1
Last active Oct 3, 2020
Universal Dashboard Hello World Example
View HelloWorldUD-Example.ps1
$MyDashboard = New-UDDashboard -Title "Hello World" -Content {
New-UDCard -Title "Hello World - Universal Dashboard"
Start-UDDashboard -Port 8585 -Dashboard $MyDashboard -Name 'HelloDashboard' -Wait
stefanstranger / Create-WIKIDocumentation.ps1
Created Apr 12, 2020
Create Azure DevOps WIKI Documentation
View Create-WIKIDocumentation.ps1
PowerShell script to create Azure DevOps WIKI Markdown Documentation
- PSDocs PowerShell Module (Install-Module -Name PSDocs)