Skip to content

Instantly share code, notes, and snippets.

@mdehaas
Created October 21, 2021 12:18
Show Gist options
  • Save mdehaas/0afa1ecfb8ff63df0ee20df0cf7a491d to your computer and use it in GitHub Desktop.
Save mdehaas/0afa1ecfb8ff63df0ee20df0cf7a491d to your computer and use it in GitHub Desktop.
My Powershell script starting point (template)
$WhatIf = $true
$Verbose = $true
$Debug = $false
### END CONFIGURATION #####
$basePath = $MyInvocation.MyCommand.Path.Replace($MyInvocation.MyCommand.Name,"").SubString(0,($MyInvocation.MyCommand.Path.Replace($MyInvocation.MyCommand.Name,"").length-1))
$baseName = $MyInvocation.MyCommand.Name.Remove(($MyInvocation.MyCommand.Name.Length-4),4)
$Transcript = !$Whatif
if ($Transcript) {Start-Transcript -Path "$($basePath)\$($baseName)-$($env:USERNAME).transcript.txt"}
if ($Transcript) {Stop-Transcript}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment