Remember to maintain security and privacy. Do not share sensitive information. Procedimento.com.br may make mistakes. Verify important information. Termo de Responsabilidade

Script to Prevent Screensaver Activation or Computer Locking

In the Windows environment, it is common for the screensaver to activate after a period of inactivity or for the computer to lock automatically. This can be inconvenient in certain situations, such as when running long processes or when monitoring a system remotely. In this article, we will explore different methods to prevent the screensaver from activating or the computer from locking using scripts in the Windows environment.


Examples:


1. CMD Script to Prevent Screensaver Activation:


@echo off
echo Disabling screensaver...
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 0 /f
echo Screensaver disabled.

2. PowerShell Script to Prevent Computer Locking:


Write-Output "Disabling computer lock..."
Set-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" -Name "DisableLockWorkstation" -Value 1
Write-Output "Computer lock disabled."

These scripts can be saved with a ".bat" or ".ps1" extension, respectively, and executed whenever needed. They modify the corresponding registry values to disable the screensaver or computer lock.


To share Download PDF

Gostou do artigo? Deixe sua avaliação!
Sua opinião é muito importante para nós. Clique em um dos botões abaixo para nos dizer o que achou deste conteúdo.