Skip to content

Instantly share code, notes, and snippets.

@Marshall-Hallenbeck
Last active April 8, 2024 06:31
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Marshall-Hallenbeck/de943c948854c5b75f071475ee35699f to your computer and use it in GitHub Desktop.
Save Marshall-Hallenbeck/de943c948854c5b75f071475ee35699f to your computer and use it in GitHub Desktop.
Prevent Automatic Shutdown for Expired Windows Evaluation VMs
# Create PS folder on C: drive
New-Item -ItemType Directory -Force -Path "C:\PS"
# Set TLS versions for download (it will error otherwise)
[Net.ServicePointManager]::SecurityProtocol = "tls12, tls11, tls"
# Download PsTools
Invoke-WebRequest -Uri "https://download.sysinternals.com/files/PSTools.zip" -OutFile "C:\PS\PSTools.zip"
# Extract PsTools to the PS folder
Expand-Archive -Path "C:\PS\PSTools.zip" -DestinationPath "C:\PS"
# Auto Accept EULA, can also run psexec with -accepteula
#reg ADD HKCU\Software\Sysinternals\PSexec /v EulaAccepted /t REG_DWORD /d 1 /f
# Start a new command prompt with Administrator privileges and run the commands
Start-Process -FilePath "cmd.exe" -Verb RunAs -ArgumentList '/c c: && cd / && cd PS && psexec -accepteula -i -d -s "sc delete WLMS"'
Start-Process -FilePath "cmd.exe" -Verb RunAs -ArgumentList '/c c: && cd / && cd PS && psexec -accepteula -i -s "REG DELETE HKLM\SYSTEM\CurrentControlSet\Services\WLMS /va /f"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment