Skip to content

Instantly share code, notes, and snippets.

View steviecoaster's full-sized avatar
🤠
It's a sweet day to write some Powershell

Stephen Valdinger steviecoaster

🤠
It's a sweet day to write some Powershell
View GitHub Profile
@steviecoaster
steviecoaster / Start-ChocoBuild.ps1
Created January 21, 2022 22:17
Quickly spin up Chocolatey's Docker image
function Start-ChocoBuild {
[cmdletBinding()]
Param(
[Parameter()]
[ValidateSet('Debug','Official')]
[String]
$Type = 'Debug'
)
process {
@steviecoaster
steviecoaster / OpenFileDialog.ps1
Last active November 4, 2021 04:44
Powershell Open File Dialog
#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
<?xml version="1.0" encoding="utf-8"?>
<Page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" Name="LetsEncrypt" Description="Front End for SSL Cert generation based on Let's Encrypt" Authenticated="false" ShowInNavigation="true" ShowNavigation="true">
<Components>
<Form Id="6594b4c1-92a7-4190-831c-88d36efd5530" Title="Certificate Details" Description="Enter Details for the certificate here" SuccessTitle="Certificate Generated!" SuccessDescription="You'll receive an email with your Certificate within 2 minutes." RefreshComponents="true">
<Target Name="New-LetsEncryptCertificate.ps1" Type="script">
<Fields>
<Field Name="CertificateDnsName" Tooltip="Enter the Subject of the certificate you wish to generate. Supports Wildcard" Value="example.foo.org" Type="textbox" Required="false" />
<Field Name="PFXPassphrase" Tooltip="This is the password on the certificate used to import it on other systems. DO NOT LOSE THIS ONCE YOU SE
$ErrorActionPreference = 'Stop';
$pp = Get-PackageParameters
$packageName= 'sql-server-express'
$url = ''
$url64 = 'https://download.microsoft.com/download/8/4/c/84c6c430-e0f5-476d-bf43-eaaa222a72e0/SQLEXPR_x64_ENU.exe'
$checksum = 'a0086387cd525be62f4d64af4654b2f4778bc98d'
if($pp['InstallPath']){
@steviecoaster
steviecoaster / ChocoJenkinsPlugins.ps1
Created August 10, 2021 13:38
Install base jenkins plugins for Chocolatey
$JenkinsHome = "C:\Program Files (x86)\Jenkins"
$JenkinsConfigPath = Join-Path $JenkinsHome "config.xml"
$JenkinsPlugins = @{
'cloudbees-folder' = '6.15'
'trilead-api' = '1.0.13'
'antisamy-markup-formatter' = '2.1'
'structs' = '1.23'
'workflow-step-api' = '2.23'
'token-macro' = '2.13'
'build-timeout' = '1.20'
function Remove-ChocoTemplateComment {
<#
.SYNOPSIS
Removes code comments from a templated choco package.
.DESCRIPTION
Removes code comments from a templated choco package.
.PARAMETER Script
The script to remove comments from.
@steviecoaster
steviecoaster / New-PackageConfig.ps1
Last active July 22, 2021 02:45
Backup Chocolatey Packages To File
<#
.SYNOPSIS
Creates a packages.config file from installed choco packages
.PARAMETER SourceFriendlyName
The friendly name of an available choco source on the system. This will explicity set the source in the config file
such that installation on the new system will come from this source.
.PARAMETER OutputFile
The config file to save output too. Must end in '.config'.
@steviecoaster
steviecoaster / Open-GitRepo.ps1
Last active July 8, 2021 01:26
Quickly open Git repos on your machine.
Function Open-GitRepo {
<#
.SYNOPSIS
Changes your $pwd to the directory of the requested repo name
.DESCRIPTION
Changes your $pwd to the directory of the requested repo name
.PARAMETER Repo
The repo to open
[CmdletBinding()]
Param(
[Parameter()]
[String]
$Path = 'C:\drop'
)
process {
$FileFilter = '*'
$IncludeSubfolders = $false
@steviecoaster
steviecoaster / Get-DadJokeSound.ps1
Created August 30, 2019 02:04
Get-DadJokes.....WITH SOUND!!!!
function Get-DadJoke {
[cmdletBinding()]
Param()
process {
$header = @{
Accept = "application/json"
}
$joke = Invoke-RestMethod -Uri "https://icanhazdadjoke.com/" -Method Get -Headers $header