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 / Set-ProGetSslConfig.ps1
Last active August 10, 2024 18:58
Configure Inedo ProGet for HTTPS
function Set-ProGetSslConfig {
<#
.SYNOPSIS
Updates the ProGet configuration file and restarts the ProGet services.
.DESCRIPTION
This script updates the ProGet configuration file with specified parameters, handles SSL certificate settings, and restarts the ProGet services. It processes parameters, updates the XML configuration file, and ensures the correct attributes are set.
.PARAMETER ConfigFile
Specifies the path to the ProGet configuration file. Default is 'C:\ProgramData\Inedo\SharedConfig\ProGet.config'.
@steviecoaster
steviecoaster / ConvertFrom-WinGetManifest.ps1
Last active February 26, 2024 02:17
ConvertFrom-WinGetManifest - A function to create a chocolateyInstall.ps1 file from a WinGet manifest
function ConvertFrom-WinGetManifest {
<#
.SYNOPSIS
Generates a Chocolatey install script for a WinGet manifest
.DESCRIPTION
Generate a Chocolatey package from a WinGet manifest, even though it'll probably already be on the CCR.
.PARAMETER WinGetManifestRawUrl
The Github raw url of the WinGet YAML manifest
@steviecoaster
steviecoaster / starship.toml
Created February 22, 2024 15:59
My StarShip config
format = """
$directory$git_branch$git_commit$git_state$git_status$cmd_duration
$character"""
# Get editor completions based on the config schema
"$schema" = 'https://starship.rs/config-schema.json'
# Inserts a blank line between shell prompts
add_newline = false
# Disable the package module, hiding it from the prompt completely
@steviecoaster
steviecoaster / chocolateyInstallOfficeExample.ps1
Created April 20, 2023 23:49
Chocolatey Package - Office Install from ISO Example
#Setup variables
$ErrorActionPreference = 'Stop';
$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
$url = 'https://server:8443/repository/choco-install/Fabrikam_Office_Setup.iso'
$isoChecksum = 'c3a5c0d10747f80d0e60767b92a8ee4e8f0bdc5067b8747368fcf322926f887c'
$destination = Join-Path $toolsDir -ChildPath 'Fabrikam_Office_Setup.iso'
$officetempfolder = Join-Path $env:Temp 'chocolatey\Office365ProPlus'
#Download iso from URL
@steviecoaster
steviecoaster / New-EncodedCredential.ps1
Last active January 27, 2023 23:11
Encodes a PSCredential for use against an API using Basic authentication
function New-EncodedCredential {
<#
.SYNOPSIS
Return an base64 encoded credential for use against API authentication
.PARAMETER Credential
The PSCredential object to encode
.PARAMETER AsHeader
Returns a header containing the required authorization information for use with the -Header parameter of Invoke-RestMethod
@steviecoaster
steviecoaster / Sync-Chocolatey.ps1
Created January 6, 2023 18:40
Chocolatey Sync Kickstart
function Sync-Chocolatey {
[CmdletBinding(SupportsShouldProcess)]
Param(
[Parameter()]
[String]
$OutputDirectory
)
begin {
function GetInstalledApps {
process {
@steviecoaster
steviecoaster / PackageParametersExample.ps1
Created November 23, 2022 20:33
Package parameters example
$ErrorActionPreference = 'Stop'
$toolsDir = Split-Path -Parent $MyInvocation.MyCommand.Definition
#Receive the package parameters from a package as a hashtable
#Example: choco install bob -y --package-parameters="'/Server=someserver /User=Bob /Enable'"
$pp = Get-PackageParameters
#You can then access the hashtable using any method you would normally use, both of the following will retrieve the value for the specified key.
@steviecoaster
steviecoaster / commands.json
Created July 28, 2022 19:31
SysInternals Enhanced Crescendo Schema
{
"Commands": [
{
"Verb": "Show",
"Noun": "ClockResolution",
"OriginalName": "clockres.exe",
"OriginalCommandElements": [
"-nobanner",
"-accepteula"
],
@steviecoaster
steviecoaster / Vagrant.psd1
Created March 25, 2022 15:25
Crescendo module for parsing Vagrant native commands
#
# Module manifest for module 'Vagrant'
#
# Generated by: svalding
#
# Generated on: 3/25/2022
#
@{
@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 {