PowerShell QuickEdit, Why It Wrecks Scripts
- Tenaka

- Jun 8
- 4 min read
My scripting language of choice is PowerShell. For my sins, and there are plenty, I am a Microsoft engineer. Life choices were made, clearly not all of them wise. Still, PowerShell is built into Windows.
Then there is PowerShell's QuickEdit.
QuickEdit is one of those “helpful” Windows console features that sounds useful right up until it parks a Tank on top of your deployment script. It lets you interact with a running PowerShell window, select text directly from the console, and copy it. Wonderful. Marvellous. Exactly what nobody asked for during an unattended build.
The problem is that when QuickEdit decides text is being selected, PowerShell stops dead in its tracks. Just stop. Your carefully written script, which may be installing applications, configuring Windows, applying security settings, or doing several hours of build work, suddenly sits there doing absolutely nothing.
And the trigger? A mouse click. A tiny drag. A badly timed brush across the console window. Sometimes, it feels like the mouse only has to think about PowerShell from across the room and that is enough. The script freezes, the build stalls, and you are left wondering why it's taking so long to complete
I could almost forgive it if QuickEdit only caused problems when I deliberately selected text. But no, that would be far too reasonable. Instead, it has a special gift for interrupting scripts at exactly the wrong moment, when there's deadlines.
And breathe...
And then there's Turning QuickEdit Off
QuickEdit can be turned off from the PowerShell window properties, but in true Microsoft fashion, changing the setting does not always mean the console window currently open will pay the slightest bit of attention.
That would be too easy.
Registry changes are not always picked up by an already running console, because apparently asking Windows to apply the setting you just changed to the thing you are actually using is an unreasonable expectation. Somewhere deep inside the operating system, a committee clearly decided that the correct behaviour was “yes, we have accepted your change, no, we will not be using it yet.”
So, for reliable behaviour, close PowerShell and reopen it, because naturally even turning off the thing that randomly pauses your scripts requires the traditional Microsoft ritual of shutting it down and starting it again.
And breathe... (again)... Clearly, I'm having a bad Microsoft day.
Where QuickEdit Is Configured
QuickEdit settings are stored in the user console registry settings.
The main location is:
HKCU:\ConsolePowerShell also has per-application console settings under:
HKCU:\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe
HKCU:\Console\%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exeThe values used are:
QuickEdit = 0
InsertMode = 0Setting QuickEdit to 0 disables QuickEdit.Setting InsertMode to 0 keeps console input behaviour predictable.
Disable QuickEdit for the Current User
This function disables QuickEdit for the currently logged-on user.
Function Disable-ConsoleQuickEdit
{
Set-ItemProperty -Path 'HKCU:\Console' -Name 'QuickEdit' -Value 0x00000000 -Force
Set-ItemProperty -Path 'HKCU:\Console' -Name 'InsertMode' -Value 0x00000000 -Force
Set-ItemProperty -Path 'HKCU:\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe' -Name 'QuickEdit' -Value 0 -Force
Set-ItemProperty -Path 'HKCU:\Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe' -Name 'InsertMode' -Value 0 -Force
Set-ItemProperty -Path 'HKCU:\Console\%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exe' -Name 'QuickEdit' -Value 0 -Force
Set-ItemProperty -Path 'HKCU:\Console\%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exe' -Name 'InsertMode' -Value 0 -Force
}
This only affects the current user profile.
Disable QuickEdit for New Users
To apply the same setting to new user profiles, update the Default User registry hive.
Function DefaultUser-ConsoleQuickEdit
{
& REG LOAD HKLM\DEFAULT C:\Users\Default\NTUSER.DAT
$RegistrySettings = @(
@{ RelativePath = "Console"; Name = "QuickEdit"; Value = 0; Type = "DWord" },
@{ RelativePath = "Console"; Name = "InsertMode"; Value = 0; Type = "DWord" },
@{ RelativePath = "Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe"; Name = "QuickEdit"; Value = 0; Type = "DWord" },
@{ RelativePath = "Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe"; Name = "InsertMode"; Value = 0; Type = "DWord" },
@{ RelativePath = "Console\%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exe"; Name = "QuickEdit"; Value = 0; Type = "DWord" },
@{ RelativePath = "Console\%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exe"; Name = "InsertMode"; Value = 0; Type = "DWord" }
)
foreach ($Setting in $RegistrySettings) {
$FullPath = "HKLM:\DEFAULT\$($Setting.RelativePath)"
if (!(Test-Path $FullPath)) {
$Item = New-Item -Path $FullPath -Force
if ($Item -and $Item.Handle) { $Item.Handle.Close() }
}
New-ItemProperty -Path $FullPath -Name $Setting.Name -PropertyType $Setting.Type -Value $Setting.Value -Force | Out-Null
}
[gc]::Collect()
[gc]::WaitForPendingFinalizers()
& REG UNLOAD HKLM\DEFAULT
}This affects users created after the change is made.
Disable QuickEdit for Administrator Before First Logon
If the local Administrator profile exists but has not been used yet, the same settings can be written directly into its profile hive.
Function Administrator-ConsoleQuickEdit
{
try
{
Get-ChildItem C:\Users\Administrator\NTUSER.DAT -ErrorAction Stop
& REG LOAD HKLM\DEFAULT C:\Users\Administrator\NTUSER.DAT
$RegistrySettings = @(
@{ RelativePath = "Console"; Name = "QuickEdit"; Value = 0; Type = "DWord" },
@{ RelativePath = "Console"; Name = "InsertMode"; Value = 0; Type = "DWord" },
@{ RelativePath = "Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe"; Name = "QuickEdit"; Value = 0; Type = "DWord" },
@{ RelativePath = "Console\%SystemRoot%_System32_WindowsPowerShell_v1.0_powershell.exe"; Name = "InsertMode"; Value = 0; Type = "DWord" },
@{ RelativePath = "Console\%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exe"; Name = "QuickEdit"; Value = 0; Type = "DWord" },
@{ RelativePath = "Console\%SystemRoot%_SysWOW64_WindowsPowerShell_v1.0_powershell.exe"; Name = "InsertMode"; Value = 0; Type = "DWord" }
)
foreach ($Setting in $RegistrySettings) {
$FullPath = "HKLM:\DEFAULT\$($Setting.RelativePath)"
if (!(Test-Path $FullPath)) {
$Item = New-Item -Path $FullPath -Force
if ($Item -and $Item.Handle) { $Item.Handle.Close() }
}
New-ItemProperty -Path $FullPath -Name $Setting.Name -PropertyType $Setting.Type -Value $Setting.Value -Force | Out-Null
}
[gc]::Collect()
[gc]::WaitForPendingFinalizers()
& REG UNLOAD HKLM\DEFAULT
}
catch
{
}
}This is useful in build environments where the Administrator account may be enabled or used later.
Recommended Usage
For deployment scripts or image builds, QuickEdit should be disabled early in the process.
Disable-ConsoleQuickEdit
DefaultUser-ConsoleQuickEdit
Administrator-ConsoleQuickEdit
This covers the current user, future users, and the local Administrator profile where it exists.
Final Thoughts
QuickEdit is useful for manual console work, but it is not ideal for automation.
A single accidental click inside the console window can make a script appear to hang. For build scripts, deployment scripts, and first boot configuration, that risk is not worth keeping.
Disabling QuickEdit makes PowerShell-based automation more predictable, which is exactly what you want during a build or deployment.




Comments