ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    Disable Screensaver and User Lockout with PowerShell

    IT Discussion
    powershell windows windows 10 screensaver
    7
    17
    12.0k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller
      last edited by

      We have some machines that we want to ensure don't get screensavers or users being locked out from inactivity. They are machine floor machines and need to stay logged in and displaying what is going on all of the time.

      Here is what we have so far.

      Set-ItemProperty -Path ‘HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop\’ -Name ScreenSaveTimeOut -Value 0
      Set-ItemProperty -Path ‘HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop\’ -Name ScreenSaveActive -Value 0
      Set-ItemProperty -Path ‘HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop\’ -Name ScreenSaverIsSecure -Value 0
      
      1 Reply Last reply Reply Quote 2
      • scottalanmillerS
        scottalanmiller
        last edited by

        Tagging @ntgGene

        gjacobseG 1 Reply Last reply Reply Quote 0
        • scottalanmillerS
          scottalanmiller
          last edited by

          I have to say, this approach was tempting 😉

          https://dmitrysotnikov.wordpress.com/2009/06/29/prevent-desktop-lock-or-screensaver-with-powershell/

          1 Reply Last reply Reply Quote 0
          • black3dynamiteB
            black3dynamite
            last edited by

            # InactivityTimeoutSecs
            New-ItemProperty `
            -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\System" `
            -Name "InactivityTimeoutSecs" `
            -PropertyType "DWord" `
            -Value "0"
            
            # Set computer to never sleep
            cmd /c "powercfg.exe /setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c"
            
            1 Reply Last reply Reply Quote 1
            • gjacobseG
              gjacobse @scottalanmiller
              last edited by

              @scottalanmiller said in Disable Screensaver and User Lockout with PowerShell:

              Tagging @ntgGene

              wrong tag.. I don't use that (prob could be removed).

              1 Reply Last reply Reply Quote 0
              • gjacobseG
                gjacobse
                last edited by

                @scottalanmiller said in Disable Screensaver and User Lockout with PowerShell:

                Set-ItemProperty -Path ‘HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop\’ -Name ScreenSaveTimeOut -Value 0

                Windows 10:

                C:\WINDOWS\system32>powershell Set-ItemProperty -Path ‘HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop\’ -Name ScreenSaveTimeOut -Value 0 
                Set-ItemProperty : A positional parameter cannot be found that accepts 
                argument 'Panel\Desktop\’'.
                At line:1 char:1
                + Set-ItemProperty -Path ‘HKCU:\Software\Policies\Microsoft\Windows\C ...
                + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    + CategoryInfo          : InvalidArgument: (:) [Set-ItemProperty], Paramet 
                   erBindingException
                    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell 
                   .Commands.SetItemPropertyCommand
                
                

                Windows 7:

                C:\Windows\system32>powershell Set-ItemProperty -Path ‘HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop\’ -Name ScreenSaveTimeOut -Value 0 
                Set-ItemProperty : A positional parameter cannot be found that accepts argument
                 'Panel\Desktop\’'.
                At line:1 char:17
                + Set-ItemProperty <<<<  -Path ‘HKCU:\Software\Policies\Microsoft\Windows\Con
                trol Panel\Desktop\’ -Name ScreenSaveTimeOut -Value 0
                    + CategoryInfo          : InvalidArgument: (:) [Set-ItemProperty], Paramet 
                   erBindingException
                    + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell 
                   .Commands.SetItemPropertyCommand
                
                Mike DavisM 1 Reply Last reply Reply Quote 0
                • Mike DavisM
                  Mike Davis @gjacobse
                  last edited by

                  @gjacobse Your quotes got messed up in translation.

                  gjacobseG 1 Reply Last reply Reply Quote 1
                  • gjacobseG
                    gjacobse @Mike Davis
                    last edited by gjacobse

                    @mike-davis said in Disable Screensaver and User Lockout with PowerShell:

                    @gjacobse Your quotes got messed up in translation.

                    I saw that too,.. and I used Notepad to confirm the copy / paste... still did the same thing.

                    powershell Set-ItemProperty -Path ‘HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop\’ -Name ScreenSaveTimeOut -Value 0
                    

                    straight from NotePad

                    Mike DavisM 1 Reply Last reply Reply Quote 0
                    • Mike DavisM
                      Mike Davis @gjacobse
                      last edited by

                      @gjacobse try typing it out and using the quote next to the enter key.

                      gjacobseG 1 Reply Last reply Reply Quote 0
                      • gjacobseG
                        gjacobse @Mike Davis
                        last edited by

                        @mike-davis said in Disable Screensaver and User Lockout with PowerShell:

                        @gjacobse try typing it out and using the quote next to the enter key.

                        so this not the above:

                        powershell Set-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop\" -Name ScreenSaveTimeOut -Value 0
                        
                        Mike DavisM 1 Reply Last reply Reply Quote 0
                        • Mike DavisM
                          Mike Davis @gjacobse
                          last edited by

                          @gjacobse close. Try the single quote.

                          1 Reply Last reply Reply Quote 0
                          • gjacobseG
                            gjacobse
                            last edited by gjacobse

                            Oh

                            <redacted>

                            1 Reply Last reply Reply Quote 0
                            • gjacobseG
                              gjacobse
                              last edited by

                              C:\Windows\system32>powershell Set-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop\' -Name ScreenSaveTimeOut -Value 0 
                              Set-ItemProperty : Cannot find path 'HKCU:\Software\Policies\Microsoft\Windows\
                              Control Panel\Desktop\' because it does not exist.
                              At line:1 char:17
                              + Set-ItemProperty <<<<  -Path 'HKCU:\Software\Policies\Microsoft\Windows\Contr
                              ol Panel\Desktop\' -Name ScreenSaveTimeOut -Value 0
                                  + CategoryInfo          : ObjectNotFound: (HKCU:\Software\... Panel\Deskto 
                                 p\:String) [Set-ItemProperty], ItemNotFoundException
                                  + FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.SetIt 
                                 emPropertyCommand
                              
                              
                              1 Reply Last reply Reply Quote 0
                              • travisdh1T
                                travisdh1
                                last edited by

                                I'm resurrecting this old ghost today.

                                I've got a couple of police computers that they want the screensaver password turned off for. Our remote registry editor doesn't have HKCU available of course, and Powershell is giving me the same sort of errors it was for @gjacobse. Did anyone ever get it figured out, or am I stuck waiting for them to call me back?

                                dbeatoD T 2 Replies Last reply Reply Quote 0
                                • dbeatoD
                                  dbeato @travisdh1
                                  last edited by

                                  @travisdh1 said in Disable Screensaver and User Lockout with PowerShell:

                                  I'm resurrecting this old ghost today.

                                  I've got a couple of police computers that they want the screensaver password turned off for. Our remote registry editor doesn't have HKCU available of course, and Powershell is giving me the same sort of errors it was for @gjacobse. Did anyone ever get it figured out, or am I stuck waiting for them to call me back?

                                  Can you do this?

                                  New-Item -Path Registry::HKEY_CURRENT_USER\SOFTWARE\Policies\Microsoft\Windows\"Control Panel"\Desktop -Force
                                  
                                  

                                  Then create it as the original post.

                                  Set-ItemProperty -Path ‘HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop\’ -Name ScreenSaveTimeOut -Value 0
                                  Set-ItemProperty -Path ‘HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop\’ -Name ScreenSaveActive -Value 0
                                  Set-ItemProperty -Path ‘HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop\’ -Name ScreenSaverIsSecure -Value 0
                                  
                                  1 Reply Last reply Reply Quote 0
                                  • T
                                    thecreaitvone91
                                    last edited by thecreaitvone91

                                    This is how I do it, I think it's only on Windows 10 and newer so if you have older OSes it will not work. We have one that sets it to 900 seconds (15min) for every computer, then this one that removes it filtered to an AD Security Group I have the desktop guys add computer accounts too that shouldn't get the lock. The screensaver method is the older way before windows 10.

                                    alt text

                                    1 Reply Last reply Reply Quote 1
                                    • T
                                      thecreaitvone91 @travisdh1
                                      last edited by thecreaitvone91

                                      @travisdh1 said in Disable Screensaver and User Lockout with PowerShell:

                                      I'm resurrecting this old ghost today.

                                      I've got a couple of police computers that they want the screensaver password turned off for. Our remote registry editor doesn't have HKCU available of course, and Powershell is giving me the same sort of errors it was for @gjacobse. Did anyone ever get it figured out, or am I stuck waiting for them to call me back?

                                      You can always browse to the HKEY_Users then the SID for the current user that is loggged in using remote registry, this is the same thing as HKCU.

                                      Tip: if you don't want to look up the SID using powershell just right click on the SID and check the security settings, it should give you hints to who is who unless it's been customized.

                                      1 Reply Last reply Reply Quote 1
                                      • 1 / 1
                                      • First post
                                        Last post