This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $JobName = "http://localhost:$(Get-Random -Min 4200 -Max 42000)/" | |
| $httpListener = [Net.HttpListener]::new() | |
| $httpListener.Prefixes.Add($JobName) | |
| $httpListener.Start() | |
| Start-ThreadJob -ScriptBlock { | |
| param($MainRunspace, $httpListener, $SourceIdentifier = 'http') | |
| while ($httpListener.IsListening) { | |
| $contextAsync = $httpListener.GetContextAsync() | |
| while (-not ($contextAsync.IsCompleted -or $contextAsync.IsFaulted -or $contextAsync.IsCanceled)) {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using namespace System.Management.Automation | |
| using namespace Microsoft.PowerShell.Commands | |
| function Write-FunctionError { | |
| <# | |
| .SYNOPSIS | |
| Writes an error within the context of the containing CmdletBinding() function. Makes errr displays prettier | |
| #> | |
| param( | |
| [Parameter(Mandatory)][String]$Message, | |
| [ValidateNotNullOrEmpty()][ErrorCategory]$Category = 'WriteError', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Function Copy-OctopusVariableSet | |
| { | |
| <# | |
| .SYNOPSIS | |
| Copies from one Octopus Deploy project variables to another | |
| .DESCRIPTION | |
| Uses the Octopus rest api to get all variables from one project to replace all variables in another. | |
| Super handy if you need to get a new project going with almost identical variables that don't yet exist in a project template or library set | |
| .EXAMPLE | |
| PS C:\> Copy-OctopusVariableSet ` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Update-Manifest { | |
| #.Synopsis | |
| # Update a PowerShell module manifest | |
| #.Description | |
| # By default Update-Manifest increments the ModuleVersion, but it can set any key in the Module Manifest, its PrivateData, or the PSData in PrivateData. | |
| # | |
| # NOTE: This cannot currently create new keys, or uncomment keys. | |
| #.Example | |
| # Update-Manifest .\Configuration.psd1 | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| function Start-Sleep($seconds) { | |
| $doneDT = (Get-Date).AddSeconds($seconds) | |
| while($doneDT -gt (Get-Date)) { | |
| $secondsLeft = $doneDT.Subtract((Get-Date)).TotalSeconds | |
| $percent = ($seconds - $secondsLeft) / $seconds * 100 | |
| Write-Progress -Activity "Sleeping" -Status "Sleeping..." -SecondsRemaining $secondsLeft -PercentComplete $percent | |
| [System.Threading.Thread]::Sleep(500) | |
| } | |
| Write-Progress -Activity "Sleeping" -Status "Sleeping..." -SecondsRemaining 0 -Completed | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # File: Get-HelpByMarkdown.ps1 | |
| # | |
| # Author: Akira Sugiura (urasandesu@gmail.com) | |
| # | |
| # | |
| # Copyright (c) 2014 Akira Sugiura | |
| # | |
| # This software is MIT License. | |
| # |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @{ | |
| # MODULE | |
| Description = "Common Dialogs Module" | |
| ModuleVersion = '1.0' | |
| GUID = '374EF8CD-AEC6-464C-92DA-290C662DA183' | |
| # AUTHOR | |
| Author = 'Josh Einstein' |