Skip to content

Instantly share code, notes, and snippets.

View mmotti's full-sized avatar

mmotti

View GitHub Profile
function Test-IsAdminElevated {
if (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::
GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
return $true
} else {
return $false
}
}
function Start-AdminElevatedTerminal {
@mmotti
mmotti / Get-InstalledSteamGames.ps1
Created August 16, 2024 18:02
Retrieve a list of your installed Steam games.
param (
[switch]$libraryPaths
)
$STEAM_REG_PATHS = @(
'HKLM:\SOFTWARE\WOW6432Node\Valve\Steam',
'HKLM:\SOFTWARE\Valve\Steam'
)
$steamPath = $null
@mmotti
mmotti / Auto-Shutdown.ps1
Last active April 27, 2025 14:35
Simple script to automatically shut down your PC after Steam downloads are complete.
<#
.SYNOPSIS
Monitors Steam downloads and initiates a system shutdown when downloads have completed.
.DESCRIPTION
This script will check for active Steam downloads and monitor their progress. Other scripts rely on
network / disk activity however they are somewhat flawed as they don't accommodate for user intervention
or drop in network connectivity.
Providing Steam doesn't change how the registry settings work, this script should correctly identify when
@mmotti
mmotti / Set-DarkTheme.ps1
Last active September 18, 2024 13:02
Set Windows 11 to use Dark Mode. Particularly useful as part of a logon script for Windows Sandbox.
$strRegJson = @"
[
{
"RegPath": "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes",
"Name": "CurrentTheme",
"Type": "STRING",
"Value": "C:\\Windows\\resources\\Themes\\dark.theme"
},
{
"RegPath": "HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Themes\\HighContrast",
Function Test-IsAdminElevated {
if (([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::
GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
return $true
}
else {
return $false
}
}