Skip to content

Instantly share code, notes, and snippets.

@Seekatar
Seekatar / psakefile.ps1
Last active March 7, 2021 12:12
Psakefile for building, running dotnet app
<#
psakefile for building and running dotnet app in docker
Invoke like this:
Invoke-Psake -buildFile '.\psakefile.ps1' -taskList @($Task) -parameters @{
dockerEnvFile = $DockerEnvFile
dockerTag = $DockerTag
containerName = $ContainerName
nugetUrl = $NugetUrl
@Seekatar
Seekatar / Get-StoredProcParameters.ps1
Last active September 5, 2019 13:28
Get stored proc names and parameters from the database with PowerShell
<#
.SYNOPSIS
Get JSON out put of SQL Stored Proc names and their parameters
#>
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[string] $serverInstance = '.',
[Parameter(Mandatory)]
[string] $database = 'test',
@Seekatar
Seekatar / Edit-Object.ps1
Last active July 24, 2019 19:39
Traverse all the properties of a PowerShell object with a visitor scriptblock. The process.json is used as input to the Pester tests.
<#
Class for passing into Edit-Object
#>
class EditObjectVisitor
{
<#
Called by Edit-Object on each member.
$Obj the current object visited
$Member the current member visited
$Path the path to the current member, e.g. obj.array[2].propA
@Seekatar
Seekatar / makeDynamicParam.ps1
Created November 20, 2018 15:43
Helper script for making dynamic parameters in PowerShell
<#
.SYNOPSIS
Helper for making dynamic parameters with ValidateSets in PowerShell
.PARAMETER ParameterName
Name of dynamic parameter
.PARAMETER MakeList
A scriptblock to create the ValidateSet list
@Seekatar
Seekatar / Test-psakeparameters.ps1
Last active April 13, 2020 11:34
Demonstrates the differences in Psake parameters and properties
<#
Order of processing
1. Parameters from commandline are set
2. Properties block is run
3. Properties from command line then set
Use -parameters to add new values to the script you want to use in the properties block
Use -properties to override a value in properties block or add new value
$params = @{
a = 'a from -parameters'
b = 'b from -parameters'