Last active
February 5, 2025 13:25
-
-
Save Marshall-Hallenbeck/de943c948854c5b75f071475ee35699f to your computer and use it in GitHub Desktop.
Prevent Automatic Shutdown for Expired Windows Evaluation VMs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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