• Home
  • About
  • Projects
  • Contact
  • Tech Tips
Tom Way Entertainment Technology

Batch Scripts to Display and Change Screen Saver Settings on Windows

5/15/2016

0 Comments

 
An annoyance I have with my workplace-provided laptop is that periodically updates are pushed to it by the IT department. This resets the screen saver settings to I have to login again anytime I am away from my machine for more than a pretty short period of time. While this may be desired behavior in a general case, since I am in an already secure area I don't need to have my machine log me out in this way.

The address the problem, here are two batch scripts. These must be run as administrator. To use, open a Command Prompt and use the right-click context menu to "Run as administrator". Once you have changed to the directory where these two scripts are located, run them as you would any other batch command. Of course, feel free to edit them to your liking. I have tested them on my system only and they work fine. Use at your own risk, blah blah blah, yadda yadda.

listscreensaver.bat


​REM
REM Script to list current screen saver settings
REM

@echo off
reg query "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveTimeOut
reg query "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveActive
reg query "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaverIsSecure
reg query "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop" /v ScreenSaveTimeOut
reg query "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop" /v ScreenSaveActive
reg query "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop" /v ScreenSaverIsSecure

pause

listscreensaver.bat
File Size: 0 kb
File Type: bat
Download File

screensaver.bat


REM
REM Script to automate setting of screen saver timeout,
REM whether or not it is active and whether or not you
REM have to login again when screen saver is active.
REM
REM Use with caution as this will directly change registry values.
REM

@echo off
SET timeout=0
SET active=0
SET secure=0

net session >nul 2>&1
if %errorLevel% == 0 (
    echo Running as Administrator
) else (
    echo Running as %USERNAME%
)

echo Setting ScreenSaveTimeOut to %timeout%
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveTimeOut /d %timeout% /f

echo Setting ScreenSaveActive to %active%
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaveActive /d %active% /f

echo Setting ScreenSaverIsSecure to %secure%
reg add "HKEY_CURRENT_USER\Control Panel\Desktop" /v ScreenSaverIsSecure /d %secure% /f

echo Setting Group Permissions screen saver parameters to %timeout%, %active%, %secure%
reg add "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop" /v ScreenSaveTimeOut /d %timeout% /f
reg add "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop" /v ScreenSaveActive /d %active% /f
reg add "HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop" /v ScreenSaverIsSecure /d %secure% /f

echo Updating user parameters
rundll32.exe user32.dll, UpdatePerUserSystemParameters

pause

screensaver.bat
File Size: 1 kb
File Type: bat
Download File

0 Comments

    Author

    Tom Way is a computer science professor, software engineer and entertainment professional who likes solving problems that challenge, vex or annoy him and others.

    Archives

    July 2019
    March 2017
    October 2016
    June 2016
    May 2016
    April 2016
    March 2016
    June 2015
    May 2015
    April 2015
    March 2015

    Categories

    All
    Backdrop
    DIY
    Google Chrome
    Omnibox
    PVC
    Set Construction
    Speed Up
    SUO File
    Theater
    Visual Studio

    RSS Feed

Powered by Create your own unique website with customizable templates.