Skip to content

Instantly share code, notes, and snippets.

@lukejjh
lukejjh / AddOutlookToStartup.ps1
Created August 22, 2021 00:18
Short PowerShell one-liner to make Outlook run at startup (user logon).
cp(gci([Environment]::GetFolderPath(22)) -r -fi *Outlook*.lnk).FullName ([Environment]::GetFolderPath(7))
@lukejjh
lukejjh / ToggleDarkMode.ps1
Created August 22, 2021 00:08
PowerShell script that toggles dark mode in Windows 10/11, for both apps and system.
$k = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
$v = (Get-ItemProperty -Path $k).SystemUsesLightTheme -bxor 1
Set-ItemProperty -Path $k -Name "SystemUsesLightTheme" -Value $v
Set-ItemProperty -Path $k -Name "AppsUseLightTheme" -Value $v
@lukejjh
lukejjh / ssh-fingerprints.sh
Created July 5, 2021 02:48
Get all SSH server fingerprints, both in SHA256 and MD5, on Linux using Bash.
for h in {sha256,md5}; do for f in /etc/ssh/ssh_host_*_key.pub; do ssh-keygen -lf $f -E $h; done; done
@lukejjh
lukejjh / ssh-fingerprints.ps1
Created July 5, 2021 02:46
Get all SSH server fingerprints, both in SHA256 and MD5, on Windows using PowerShell.
"sha256","md5" | % { $h = $_; gi "${env:ProgramData}\SSH\ssh_host_*_key.pub" | % { ssh-keygen -lf $_.FullName -E $h } }
@lukejjh
lukejjh / Get-DistributionGroupRecursive.ps1
Created June 23, 2021 02:11
Function providing missing -Recurse parameter for Get-DistributionGroup.
function Get-DistributionGroupRecursive {
<#
.SYNOPSIS
Function providing missing -Recurse parameter for Get-DistributionGroup.
.DESCRIPTION
Takes an identity string and returns the matching distribution group and any nested groups beneath it.
Only distribution groups are returned, not mailboxes, etc.
.EXAMPLE