$Here = @'
Msg1 : The string parameter is required.
Msg2 : Credentials are required for this command.
Msg3 : The specified variable does not exist.
'@
ConvertFrom-StringData -StringData $Here -Delimiter ':'
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 ConvertTo-ChocoObject { | |
[CmdletBinding()] | |
Param ( | |
[Parameter(ValueFromPipeline)] | |
[string]$InputObject | |
) | |
Process { | |
# format of the 'choco list -lo -r' output is: | |
# full info with 'choco list -lo -r --audit |
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-ChocoLogSize { | |
<# | |
.SYNOPSIS | |
Returns the size of the chocolatey.log file in MB | |
.PARAMETER Computername | |
The system to query. Defaults to the local COMPUTERNAME | |
.EXAMPLE | |
Get-ChocoLogSize |
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 Remove-ChocoLog { | |
<# | |
.SYNOPSIS | |
Remove a chocolatey log from a system | |
.DESCRIPTION | |
Based on size threshold, will remove a chocolatey.log file from the specified system(s). | |
.PARAMETER LogThresholdMB | |
Size in MB to determine whether or not to prune a log |
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-DadJoke { | |
[cmdletBinding()] | |
Param() | |
process { | |
$header = @{ | |
Accept = "application/json" | |
} | |
$joke = Invoke-RestMethod -Uri "https://icanhazdadjoke.com/" -Method Get -Headers $header | |
$joke.joke |
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-DadJoke { | |
[cmdletBinding()] | |
Param() | |
process { | |
$header = @{ | |
Accept = "application/json" | |
} | |
$joke = Invoke-RestMethod -Uri "https://icanhazdadjoke.com/" -Method Get -Headers $header | |
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
#ensure chocolatey is Installed | |
If(-not (Test-Path $env:ChocolateyInstall)){ | |
Set-ExecutionPolicy -ExecutionPolicy Bypass -Scope Process | |
iex (New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/Install.ps1') | |
} | |
refreshenv |
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 Resolve-Note { | |
[OutputType([void])] | |
[CmdletBinding(SupportsShouldProcess, ConfirmImpact = 'Low')] | |
param( | |
[Parameter(Position = 0, Mandatory, ValueFromPipeline,ValueFromPipelineByPropertyName)] | |
[Alias('♪', '♫')] | |
[ValidateSet('C', 'C#', 'Db', 'D', 'D#', 'Eb', 'E', 'F', 'F#', 'Gb', 'G', 'G#', 'Ab', 'A', 'A#', 'Bb', 'B', 'R')] | |
[string] | |
$Note, |
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
#Thomas Rayner is awesome. Everyone should be like Thomas. Mostly ganked from here: https://thomasrayner.ca/open-file-dialog-box-in-powershell/ | |
function Open-FileDialog { | |
[cmdletBinding()] | |
param( | |
[Parameter()] | |
[ValidateScript({Test-Path $_})] | |
[String] | |
$InitialDirectory | |
) | |
Add-Type -AssemblyName System.Windows.Forms |
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
choco install googlechrome -y --no-progress | |
choco install jenkins -y -s https://chocolatey.org/api/v2 | |
choco install selenium-chrome-driver -y -s https://chocolatey.org/api/v2 | |
$ModuleBase = (Get-Module -ListAvailable Selenium).ModuleBase | |
Unblock-File -Path 'C:\tools\selenium\*' | |
Get-Process -Name *chrome*, *firefox*, *gecko* | Stop-Process -Force | |
Get-ChildItem -Path 'C:\tools\selenium\*' | Copy-Item -Destination "$ModuleBase\assemblies\" -Force -ErrorAction SilentlyContinue | |
Import-Module Selenium |