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
| #An alternative to the built-in PromptForChoice providing a consistent UI across different hosts | |
| function Get-Choice { | |
| [CmdletBinding()] | |
| Param | |
| ( | |
| [Parameter(Mandatory=$true,Position=0)] | |
| $Title, | |
| [Parameter(Mandatory=$true,Position=1)] | |
| [String[]] |
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
| Sub ConvertToJiraTable() | |
| Dim workingRange As Range, currCol As Range, currRow As Range | |
| Dim rowIndex As Long, colIndex As Long | |
| Dim output As String, cellVal As String, status As String | |
| Dim statusHash As Dictionary | |
| Dim cb As DataObject | |
| Set cb = New DataObject | |
| Set statusHash = New Dictionary | |
| statusHash("Done") = "(/)" | |
| statusHash("Not Done") = "(x)" |
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
| ´#based on function from James Brundage | |
| function ConvertTo-ISEAddOn{ | |
| [CmdletBinding(DefaultParameterSetName="CreateOnly")] | |
| param( | |
| [Parameter(Mandatory=$true, | |
| ParameterSetName="DisplayNow")] | |
| [string]$DisplayName, | |
| [Parameter(Mandatory=$true, | |
| ParameterSetName="CreateOnly")] |
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 Expand-Alias{ | |
| [CmdletBinding(DefaultParameterSetName = 'Text')] | |
| param( | |
| [Parameter(Mandatory=$false, Position=0, ParameterSetName = 'Text')] | |
| $code = $psISE.CurrentFile.Editor.Text, | |
| [Parameter(Mandatory=$true, ParameterSetName = 'Path')] | |
| [ValidateScript({ | |
| if (-not (Test-Path -PathType Leaf -LiteralPath $_ )) { | |
| throw "Path '$_' does not exist. Please provide the path to an existing File." | |
| } |
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 Out-Stuff{ | |
| [CmdletBinding(DefaultParameterSetName='Basic')] | |
| param( | |
| [Parameter(Mandatory)] | |
| [ValidateSet('choice1','choice2','choice3')] | |
| $myChoice, | |
| [Parameter(ParameterSetName='Basic')] | |
| $text, | |
| [Parameter(ParameterSetName='Advanced')] | |
| [switch]$switch1, |
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
| filter Get-FileSize { | |
| "{0:N2} {1}" -f $( | |
| if ($_ -lt 1kb) { $_, 'Bytes' } | |
| elseif ($_ -lt 1mb) { ($_/1kb), 'KB' } | |
| elseif ($_ -lt 1gb) { ($_/1mb), 'MB' } | |
| elseif ($_ -lt 1tb) { ($_/1gb), 'GB' } | |
| elseif ($_ -lt 1pb) { ($_/1tb), 'TB' } | |
| else { ($_/1pb), 'PB' } | |
| ) | |
| } |
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 Get-FileInvokeWebRequest{ | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| $url, | |
| $destinationFolder="$env:USERPROFILE\Downloads", | |
| [switch]$includeStats | |
| ) | |
| $destination = Join-Path $destinationFolder ($url | Split-Path -Leaf) | |
| $start = Get-Date | |
| Invoke-WebRequest $url -OutFile $destination |
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 Get-FileVB{ | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| $url, | |
| $destinationFolder="$env:USERPROFILE\Downloads", | |
| [switch]$includeStats | |
| ) | |
| Add-Type -AssemblyName Microsoft.VisualBasic | |
| #resolve potential redirect |
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 Get-FileWCSynchronous{ | |
| param( | |
| [Parameter(Mandatory=$true)] | |
| $url, | |
| $destinationFolder="$env:USERPROFILE\Downloads", | |
| [switch]$includeStats | |
| ) | |
| $wc = New-Object Net.WebClient | |
| $wc.UseDefaultCredentials = $true | |
| $destination = Join-Path $destinationFolder ($url | Split-Path -Leaf) |