Skip to content

Instantly share code, notes, and snippets.

@HighLibrarian
Last active April 17, 2025 13:26
Show Gist options
  • Save HighLibrarian/73e7e57d89e9186006fb17568bf3aebe to your computer and use it in GitHub Desktop.
Save HighLibrarian/73e7e57d89e9186006fb17568bf3aebe to your computer and use it in GitHub Desktop.
DailyPowerShellProfile
<#
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@@@@@@@@@@@@@@@@@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@#-:**************=*@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%-%+=%%%%%%%%%%%%%%-#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%##%%%%%%%%%%%%%%%%%%%%%%%:*%%=+%%%%%%%%%%%%%%.#@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%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%%%%%%%%%%%%%%%%%%%%%%%%%%@%%%%%@%%%%%%%%=+@%%-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@%%=%%=#%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%.#@-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%#.#-*%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%@%:*@%@%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
#>
<#
.SYNOPSIS
Installs Oh My Posh, a terminal theme engine, and configures it for use with Windows Terminal.
.DESCRIPTION
This function downloads and installs Oh My Posh, installs the required Nerd Font,
adds the Oh My Posh binary to the system's PATH, and configures Windows Terminal settings
with a pre-defined theme and wallpaper.
.USAGE
install-OhMyPosh
.PARAMETER None
This function does not require any input parameters.
#>
function install-OhMyPosh
{
# Set Execution Policy to Bypass for the current session
Set-ExecutionPolicy Bypass -Scope Process -Force
# Download and install Oh My Posh
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://ohmyposh.dev/install.ps1'))
# Install the Nerd Font for Oh My Posh
oh-my-posh font install meslo
# Add Oh My Posh to the system PATH for this session
$env:Path += ";$env:LOCALAPPDATA\Programs\oh-my-posh\bin"
# Configuration URLs and Paths
$TerminalGist = "https://gist.githubusercontent.com/HighLibrarian/1d2feb5392c7be3f1631c7b48c9d939e/raw/00101bab07861365b5f39ab8d473ef65a7725de7/WindowsTerminalConfig.json"
$TerminalConfigPath = "$env:LOCALAPPDATA\Packages\Microsoft.WindowsTerminal_8wekyb3d8bbwe\LocalState\settings.json"
$TerminalWallpaperPath = "C:\ProgramData\$env:username\config\WindowsTerminal\Backgrounds\"
# Backup the original terminal configuration just in case
Copy-Item $TerminalConfigPath -Destination "$TerminalConfigPath.bak" -Force
# Create a folder for terminal background if it doesn't exist
if (-not (Test-Path $TerminalWallpaperPath))
{
New-Item -Path $TerminalWallpaperPath -ItemType Directory -Force
}
Invoke-Item $TerminalWallpaperPath
# Download the terminal configuration JSON from the provided Gist
Invoke-WebRequest -Uri $TerminalGist -Method Get -OutFile $TerminalConfigPath
Write-Host "Oh My Posh and Windows Terminal configured successfully." -ForegroundColor Green
}
<#
.SYNOPSIS
Updates the PowerShell profile with a remote configuration file.
.DESCRIPTION
This function downloads a predefined PowerShell profile from a provided Gist URL and sets it as the user's PowerShell profile. It checks if the necessary directories exist and creates them if needed. If the profile file does not already exist, it is created and populated with the content from the specified Gist.
.USAGE
Update-PsProfile
.PARAMETER None
This function does not require any parameters. It automatically uses a predefined Gist URL for the PowerShell profile.
.NOTES
#>
function Update-PsProfile
{
[cmdletbinding()]
param ()
$PsProfileGist = "https://gist.githubusercontent.com/HighLibrarian/73e7e57d89e9186006fb17568bf3aebe/raw/MyPowerShellProfile.ps1"
try
{
Write-Verbose "fetching profile from github gist"
$ProfileContent = (Invoke-WebRequest -Uri $PsProfileGist -Method Get).Content
}
catch
{
throw "could not fetch the profile from github"
}
if (-not(Test-Path $profile))
{
Write-Verbose "Creating a powershell profile at $profile"
New-Item $PROFILE -ItemType File
}
try
{
Write-Verbose "settting the contents of your profile"
Set-Content -Value $ProfileContent -Path $PROFILE
Write-Verbose "Profile Updated at $(Get-Date -Format 'HH:mm')"
}
catch
{
Write-Error $error[0].Exception
}
}
<#
.SYNOPSIS
Clears recent items from Windows Quick Access and Start menu history.
USAGE:
Clear-RecentItems
#>
Function Clear-RecentItems
{
$Namespace = "shell:::{679f85cb-0220-4080-b29b-5540cc05aab6}"
$QuickAccess = New-Object -ComObject shell.application
$RecentFiles = $QuickAccess.Namespace($Namespace).Items()
$RecentFiles | ForEach-Object { $_.InvokeVerbEx("remove") }
Remove-Item -Force "${env:USERPROFILE}\AppData\Roaming\Microsoft\Windows\Recent\*.lnk"
New-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Start_TrackDocs" -Value 0 -PropertyType DWORD
Remove-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "Start_TrackDocs"
}
<#
.SYNOPSIS
Pins a file or all files in a folder to the SSD tier named "StoragePool01-SSDTier".
USAGE:
Set-SSDTier -FilePath "C:\Path\To\File"
Set-SSDTier -FolderPath "C:\Path\To\Folder"
#>
function Set-SSDTier
{
param
(
# The file to pin
[Parameter(Mandatory = $false)]
[string]$FilePath,
# The folder to pin
[Parameter(Mandatory = $false)]
[string]$FolderPath
)
$SSDTierName = "StoragePool01-SSDTier"
if ($FilePath)
{
if (Test-Path $FilePath)
{
Set-FileStorageTier -FilePath $FilePath -DesiredStorageTierFriendlyName $SSDTierName -Verbose
Write-Verbose "pinned: $FilePath to $SSDTierName"
}
else
{
throw "the path $filepath cannot be found"
}
}
elseif ($FolderPath)
{
if (Test-Path $FolderPath)
{
$files = Get-ChildItem -Path $FolderPath -Recurse | Select-Object FullName -ExpandProperty FullName
foreach ($FilePath in $files)
{
Set-FileStorageTier -FilePath $FilePath -DesiredStorageTierFriendlyName $SSDTierName -Verbose
Write-Verbose "pinned: $FilePath to $SSDTierName"
}
}
else
{
throw "the path $FolderPath cannot be found"
}
}
}
<#
.SYNOPSIS
Switches screenshot tools between PicPick and Lightshot.
USAGE:
Set-DocuMode -Start # Stops Lightshot, starts PicPick
Set-DocuMode -Stop # Stops PicPick, starts Lightshot
#>
function Set-DocuMode
{
param(
[switch]$Start,
[switch]$Stop
)
$PicPickexec = 'C:\Program Files (x86)\PicPick\picpick.exe'
$LightShotexec = 'C:\Program Files (x86)\Skillbrains\lightshot\Lightshot.exe'
if ($Start)
{
try
{
Write-Host 'Killing Lightshot'
Stop-Process -Name 'Lightshot' -ErrorAction Stop
}
catch
{
Write-Warning 'Failed to stop Lightshot. Was it even running?'
}
try
{
Write-Host 'Starting PicPick'
Start-Process -FilePath $PicPickexec | Out-Null
}
catch
{
Write-Error 'Failed to start PicPick'
}
}
elseif ($Stop)
{
try
{
Write-Host 'Killing PicPick'
Stop-Process -Name 'picpick' -ErrorAction Stop
}
catch
{
Write-Warning 'Failed to stop PicPick. Was it even running?'
}
try
{
Write-Host 'Starting Lightshot'
Start-Process -FilePath $LightShotexec | Out-Null
}
catch
{
Write-Error 'Failed to start Lightshot'
}
}
else
{
Write-Warning 'Please specify either -Start or -Stop.'
}
}
<#
.SYNOPSIS
Writes a Configuration Manager-style log entry to a file and displays it in the console.
USAGE:
write-cmlog -LogFile "C:\log.txt" -Message "Something happened" -Component "MyScript" -Severity 2
#>
function write-cmlog
{
[CmdletBinding()]
Param
(
[String]$LogFile = $loglocation,
[String]$Message,
[String]$Component,
[ValidateRange(1, 3)][Single]$Severity
)
# Set log message color based on severity
$ForegroundColor = switch ($Severity)
{
1 { "White" }
2 { "DarkYellow" }
3 { "Red" }
Default { "White" }
}
# Create log line
$UtcOffset = (New-Object -ComObject WbemScripting.SWbemDateTime).SetVarDate((Get-Date)).Value.Substring(21)
$LogLine = "<![LOG[$Message]LOG]!>" + `
"<time=`"$(Get-Date -Format HH:mm:ss.fff)$UtcOffset`" " + `
"date=`"$(Get-Date -Format M-d-yyyy)`" " + `
"component=`"$Component`" " + `
"context=`"$([System.Security.Principal.WindowsIdentity]::GetCurrent().Name)`" " + `
"type=`"$Severity`" " + `
"thread=`"$($pid)`" " + `
"file=`"`">"
# Write log to file and host
Out-File -InputObject $LogLine -Append -NoClobber -Encoding Default -FilePath $LogFile
Write-Host $Message -ForegroundColor $ForegroundColor
}
<#
.SYNOPSIS
Creates a new Hyper-V VM with a differencing disk and optional auto-start.
USAGE:
New-DifferencingVm -VMName "TestVM" -Memory "light" -vSwitch "LAB-INTERNAL" -StartVm
#>
function New-DifferencingVm
{
param
(
[Parameter(Mandatory = $true)][string]$VMName,
[Parameter(Mandatory = $false)][string]$DiskName = $VMName,
[Parameter(Mandatory = $false)][ValidateSet('Windows11-x64-24h2-BusinessEditions-112024.vhdx')][string]$BaseDiskName,
[Parameter(Mandatory = $true)][ValidateSet('light', 'medium', 'heavy', 'custom')][string]$Memory,
[Parameter(Mandatory = $true)][ValidateSet('Default Switch', 'LAB-INTERNAL', 'LAB-EXTERNAL')][string]$vSwitch,
[Parameter(Mandatory = $false)][switch]$StartVm
)
$HPVBaseLocation = Get-VMHost | Select-Object VirtualHardDiskPath -ExpandProperty VirtualHardDiskPath
$VmLocation = "$HPVBaseLocation\"
$BaseDiskLocation = "$HPVBaseLocation\PARENTS\Virtual HardDrives"
if (-not $BaseDiskName)
{
$BaseDiskName = Get-ChildItem -Path $BaseDiskLocation -Filter "*vhdx" | Select-Object -ExpandProperty Name | Out-GridView -PassThru -Title "Select the Parent Disk for $VMName"
}
$VMConfig = @{
path = "$VmLocation"
name = $VMName
NoVHD = $true
generation = 2
switch = $vSwitch
}
$VHDConfig = @{
parentPath = "$BaseDiskLocation\$BaseDiskName"
path = "$VmLocation\$VMName\Virtual Hard Disks\$VMName.vhdx"
}
New-VHD @VHDConfig -Differencing -Verbose
New-VM @VMConfig
Add-VMHardDiskDrive -Path $VHDConfig.path -VMName $VMName -Verbose
Set-VMFirmware -VMName $VMName -EnableSecureBoot 'on' -FirstBootDevice (Get-VMHardDiskDrive -VMName $VMName)
switch ($Memory)
{
"light" { Set-VMMemory -VMName $VMName -MinimumBytes 1Gb -StartupBytes 2Gb -MaximumBytes 4Gb }
"medium" { Set-VMMemory -VMName $VMName -MinimumBytes 2Gb -StartupBytes 4Gb -MaximumBytes 8Gb }
"heavy" { Set-VMMemory -VMName $VMName -MinimumBytes 4Gb -StartupBytes 6Gb -MaximumBytes 8Gb }
}
if ($StartVm) { Start-VM -Name $VMName -Verbose }
}
<#
.SYNOPSIS
Generates a secure random password and copies it to the clipboard.
USAGE:
New-RandomPassword # 16-character password without special characters
New-RandomPassword -Length 20 -IncludeSpecialChars
#>
function New-RandomPassword
{
param
(
[Parameter(Mandatory = $false)][int]$Length = 16,
[Parameter(Mandatory = $false)][switch]$IncludeSpecialChars
)
# Create an array of characters properly
$Chars = @()
$Chars += [char[]](97..122) # 'a' to 'z'
$Chars += [char[]](65..90) # 'A' to 'Z'
$Chars += [char[]](48..57) # '0' to '9'
if ($IncludeSpecialChars)
{
$Chars += [char[]]('!@#$%^&*()-_=+')
}
# Generate the password
$Password = -join (1..$Length | ForEach-Object { $Chars | Get-Random })
# Copy to clipboard
$Password | Set-Clipboard
# Return the password
return $Password
}
<#
.SYNOPSIS
Copies non-Markdown files from a source folder to a destination folder, interactively by filename.
this function is used to migrate my obsidian assets to a new vault
USAGE:
Move-ObsidianAttachments -SourcePath "C:\Path\To\IMPORT" -DestinationPath "C:\Path\To\Assets"
#>
function Move-ObsidianAttachments
{
param
(
[Parameter(Mandatory = $true)]
[ValidateSet("import", "inbox")]
[string]$Mode,
[Parameter(Mandatory = $true)]
[ValidateSet("laptop", "desktop")]
[string]$DeviceType
)
# Resolve source and destination paths based on Mode and DeviceType
switch ("$DeviceType-$Mode")
{
"laptop-import"
{
$SourcePath = "C:\Users\BoDewitte\ObsidianVaults\SynapseGarden\IMPORT"
$DestinationPath = "C:\Users\BoDewitte\ObsidianVaults\SynapseGarden\RESOURCES\Assets"
}
"laptop-inbox"
{
$SourcePath = "C:\Users\BoDewitte\ObsidianVaults\SynapseGarden\inbox"
$DestinationPath = "C:\Users\BoDewitte\ObsidianVaults\SynapseGarden\RESOURCES\Assets"
}
"desktop-import"
{
$SourcePath = "D:\Obsidian\Desktop\Import"
$DestinationPath = "D:\Obsidian\Desktop\Assets"
}
"desktop-inbox"
{
$SourcePath = "D:\Obsidian\Desktop\Inbox"
$DestinationPath = "D:\Obsidian\Desktop\Assets"
}
default
{
Write-Error "Invalid combination of Mode and DeviceType."
return
}
}
do
{
$filename = Read-Host "Enter the filename (or type 'exit' to quit)"
if ($filename -eq "exit")
{
break
}
$sourceFiles = Get-ChildItem -Path $SourcePath -Filter "$filename*" -Recurse |
Where-Object { $_.Extension -ne ".md" }
if ($sourceFiles)
{
foreach ($file in $sourceFiles)
{
Move-Item -Path $file.FullName -Destination $DestinationPath -Force
Write-Host "Moved: $($file.Name)"
}
}
else
{
Write-Host "No matching files found in '$SourcePath'."
}
} while ($true)
}
<#
.SYNOPSIS
Initializes the KeePass SecretManagement vault.
.DESCRIPTION
Installs the required KeePass SecretManagement module (if missing) and registers the vault
.USAGE
Initialize-KeePassVault -VaultPath "P:\ath\to\your\vault.kdbx"
.PARAMETER VaultPath
The full path to your KeePass `.kdbx` file.
#>
function Initialize-KeePassVault
{
param
(
[Parameter(Mandatory = $true)]
[string]$VaultPath
)
$vaultName = "KeePass"
# Install module if needed
if (-not (Get-Module -ListAvailable -Name "SecretManagement.KeePass"))
{
Write-Host "Installing SecretManagement.KeePass module..."
Install-Module -Name "SecretManagement.KeePass" -Force -Scope CurrentUser
}
# Register the vault
Write-Host "Registering the KeePass secret vault..."
try
{
Register-SecretVault -Name $vaultName -ModuleName "SecretManagement.KeePass" -VaultParameters @{
Path = $VaultPath
UseMasterPassword = $true
} -ErrorAction Stop
Write-Host "Vault registered successfully." -ForegroundColor Green
}
catch
{
Write-Error "Failed to register the KeePass vault: $_"
return
}
}
function Get-WanIp
{
(Invoke-WebRequest ifconfig.me/ip).Content
}
function start-speedtest
{
irm asheroto.com/speedtest | iex
}
# start Oh-My-Posh
oh-my-posh init pwsh | Invoke-Expression
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment