Skip to content

Instantly share code, notes, and snippets.

@primaryobjects
Last active May 25, 2026 17:19
Show Gist options
  • Select an option

  • Save primaryobjects/e3cb1f17487b9a1bafe5779751f70349 to your computer and use it in GitHub Desktop.

Select an option

Save primaryobjects/e3cb1f17487b9a1bafe5779751f70349 to your computer and use it in GitHub Desktop.
Hide Windows Activation watermark on the desktop in Windows 10/11.
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class WSBWin32 {
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
}
"@
function Hide-Watermark {
$classes = @("Worker Window", "WorkerW")
foreach ($c in $classes) {
$hWnd = [WSBWin32]::FindWindow($c, "")
if ($hWnd -ne [IntPtr]::Zero) {
[WSBWin32]::ShowWindow($hWnd, 0) | Out-Null
}
}
}
while ($true) {
Hide-Watermark
Start-Sleep -Seconds 3
}
'Use this in the Task Scheduler to run the script At Log On.
Set objShell = CreateObject("WScript.Shell")
objShell.Run "powershell.exe -NoProfile -ExecutionPolicy Bypass -WindowStyle Hidden -File ""C:\Scripts\HideWatermarkMonitor.ps1""", 0, False
# Version 1.0 finds the first Worker Window instance and hides it. Does not enumerate all windows.
Add-Type @"
using System;
using System.Runtime.InteropServices;
public class WSBWin32 {
[DllImport("user32.dll")]
public static extern IntPtr FindWindow(string lpClassName, string lpWindowName);
[DllImport("user32.dll")]
public static extern bool ShowWindow(IntPtr hWnd, int nCmdShow);
}
"@
function Hide-Watermark {
$hWnd = [WSBWin32]::FindWindow("Worker Window", "")
if ($hWnd -ne [IntPtr]::Zero) {
[WSBWin32]::ShowWindow($hWnd, 0) | Out-Null
}
}
while ($true) {
Hide-Watermark
Start-Sleep -Seconds 5
}
# Finds and terminates the PowerShell process running HideWatermarkMonitor.ps1
# Run As Administrator.
$scriptName = "HideWatermarkMonitor.ps1"
# Query all processes with full command line
$monitorProcess = Get-CimInstance Win32_Process |
Where-Object {
$_.CommandLine -match [regex]::Escape($scriptName)
}
if ($monitorProcess) {
Write-Host "Found monitor process running:" -ForegroundColor Yellow
$monitorProcess | Select-Object ProcessId, CommandLine | Format-List
foreach ($proc in $monitorProcess) {
try {
Stop-Process -Id $proc.ProcessId -Force -ErrorAction Stop
Write-Host "Stopped process ID $($proc.ProcessId)" -ForegroundColor Green
}
catch {
Write-Host "Failed to stop process ID $($proc.ProcessId): $_" -ForegroundColor Red
}
}
}
else {
Write-Host "No running watermark monitor process found." -ForegroundColor Cyan
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment