Skip to content

Instantly share code, notes, and snippets.

@fastcall22
fastcall22 / remove-consoleprops.ps1
Created January 28, 2018 17:50
PowerShell Script to Remove and Block `CONSOLE_PROPS` in Windows Shortcuts
<#
.SYNOPSIS
Utility script to remove custom console customizations from shortcuts and additionally adjusts permissions to block them from being re–added.
.DESCRIPTION
This script can take a set of shortcuts from the pipeline or optionally crawl the user’s start menu for shortcuts having an embedded `CONSOLE_PROPS` data block. Shortcuts that have the datablock are stripped of its `CONSOLE_PROPS` then, if enabled, its permission inheritance is disabled, then changed to deny the user write access to the shortcut. In effect, this prevents re–adding the `CONSOLE_PROPS` to the shortcut and prevents the shortcut from diverging from the default terminal settings on the user.
If specified, this script will also remove any console customizations in the registry. Note: Denying subkey creation on `HKCU:\Console` will break some installers expecting to create subkeys here.