PowerShell: How to change screen saver timeout in Windows 10

Set Screen Saver Timeout

Windows computers are usually configured to lock the screen after some time of inactivity. This is especially inconvenient if the remote desktop session keeps disconnecting each time after a few minutes of being idle. The Windows registry holds the value for the screensaver timeout. A PowerShell script to change the screen saver timeout can be written easily.

How to Increase Screensaver Timeout

Open Regedit, and take a look in the HKEY_CURRENT_USER hive. The Registry values related to the screensaver, ScreenSaveTimeout, can be found. This registry value determines how long the system must be idle before the screensaver kicks in. By default, the screen saver kicks in after 600 seconds or 10 minutes of inactivity. to modify this default screensaver timeout setting, supply the screen timeout as an integer value in the following script.
Script

<#
.SYNOPSIS
This script can be used to set the Screen Saver Timeout interval.
.DESCRIPTION
This script can be used to set the Screen Saver Timeout interval.
.EXAMPLE
C:\PS> C:\Script\Set_Screen_Saver_Timeout.ps1 100
Sets the ScreenSaverTimeOut value as 100.
#>

Param([int]$value)
$path = ‘HKCU:\Control Panel\Desktop’
$name = ‘ScreenSaveTimeOut’
#To get the ScreenSaveTimeOut value.

$old_value=(Get-ItemProperty -path $path -name $name).$name
echo “Old ScreenSaveTimeout: $old_value”
#To set the new ScreenSaveTimeOut value.

Set-ItemProperty -Path $path -name $name -value $value
#To get the new ScreenSaveTimeOut value.

$new_value=(Get-ItemProperty -path $path -name $name).$name
echo “New ScreenSaveTimeout: $new_value”

 




    • Related Articles

    • Get Screen Resolution of remote computers

      Administrators sometimes have to document certain properties of the computers in their network. The most common one is the screen resolution. Doing so on a collection of remote computers only adds to the complication. However, with the help of the ...
    • How to Get and Set properties of the Active Directory user using PowerShell

      In this article, we will discuss how to get and set properties of an Active Directory user using PowerShell. Here’s how to get User Properties To get user properties from Active Directory, Get-ADUser cmdlet can be used. Here is an example of how to ...
    • Add Attributes to Global Catalog Replication

      It is common for IT admins to notice that few AD attributes are not natively in the global catalog replication set. Adding these attributes to the Global Catalog replication set is necessary so that all the DC's in the network carry the updated ...
    • Remove read only property of a file

      A common issue that administrators face while restoring files from their backups is that the read-only property of the files comes marked by default. This can cause serious trouble as end users will not be able to edit their documents without ...
    • PowerShell as an AD user management tool

      User management can be quite a challenge for Active Directory (AD) administrators day in and day out. Many administrators use Microsoft's PowerShell technology to perform basic AD user management tasks. Below are some key PowerShell scripts and ...