Support Center

Set Screen Lock Inactivity Timeout with JumpCloud Commands

The commands listed in this article are specific to locking a user's screen after a specified period of inactivity for Windows and Mac systems.

Windows

 

Note: For either existing or new users, add the registry edits to a batch file and use the file upload function of commands to upload the file to a location such as C:\Windows\Temp, then use the COMMAND field to run the batch file. In the attached example (at bottom), the command is C:\Windows\Temp\screensaver.bat

Note: Depending on OS architecture and command being run, it may execute without error (exit 0), but there will be no evidence a change was made. The command likely needs to run as 64-bit.


Existing Users


In order for commands to modify existing users, it's necessary to get the SID of the user being modified to open the correct registry hive. To get that information:
C:\Users\Administrator>wmic useraccount get name,sid
Name           SID
Administrator  S-1-5-21-4293981643-699336205-1451118203-500
In the below example, line 1 has a value of '180' which is in seconds. The screen would lock after 3 minutes of inactivity.  Line 5 will disable the user from being able to access any screensaver settings after the changes have been made.  
reg add "HKEY_Users\SID_OF_USER\Control Panel\Desktop" /v ScreenSaveTimeOut /t REG_SZ /d 180 /f
reg add "HKEY_Users\SID_OF_USER\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 1 /f
reg add "HKEY_Users\SID_OF_USER\Control Panel\Desktop" /v ScreenSaverIsSecure /t REG_SZ /d 1 /f
reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon" /v DisableLockWorkstation /t REG_DWORD /d 0 /f  /reg:64 #Remove the '/reg:64' if you are running this on a 32 bit operating system
reg add "HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v NoDispScrSavPage /t REG_DWORD /d 1 /f


New Users


For new users, setting the defaults will allow the settings to take affect on first logon.

In the below example, line 1 has a value of '180' which is in seconds. The above example would lock after 3 minutes of inactivity.  Line 5 will disable the user from being able to access any screensaver settings after the changes have been made.  Note that this may be applied for new users to be applied on first login.
 
reg add "hku\.DEFAULT\Control Panel\Desktop" /v ScreenSaveTimeOut /t REG_SZ /d 180 /f
reg add "hku\.DEFAULT\Control Panel\Desktop" /v ScreenSaveActive /t REG_SZ /d 1 /f
reg add "hku\.DEFAULT\Control Panel\Desktop" /v ScreenSaverIsSecure /t REG_SZ /d 1 /f
reg add "hku\.DEFAULT\Control Panel\Desktop" /v DisableLockWorkstation /t REG_DWORD /d 0 /f
reg add "hku\.DEFAULT\Control Panel\Desktop" /v NoDispScrSavPage /t REG_DWORD /d 1 /f  

 

Mac


Note: These commands need to be RUN AS: the user whose settings you want to modify. 
#Require a password after sleep or screen saver begins
defaults write com.apple.screensaver askForPassword -bool true;
#Require the password be entered immediately after sleep or screen saver begins
defaults write com.apple.screensaver askForPasswordDelay 0;
#Set the screen saver idle delay, in seconds, for a specific user
defaults write /Users/YOUR_USERNAME/Library/Preferences/ByHost/com.apple.screensaver idleTime 120;
Attachments
 

Last Updated: Jul 07, 2017 04:09PM MDT

Related Articles
31b11a79e2c94470a66430cfe6d3eecd@jumpcloud.desk-mail.com
https://cdn.desk.com/
false
desk
Loading
seconds ago
a minute ago
minutes ago
an hour ago
hours ago
a day ago
days ago
about
false
Invalid characters found
/customer/en/portal/articles/autocomplete