Disable Screensaver and User Lockout with PowerShell
-
# 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"
-
@scottalanmiller said in Disable Screensaver and User Lockout with PowerShell:
Tagging @ntgGene
wrong tag.. I don't use that (prob could be removed).
-
@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
-
@gjacobse Your quotes got messed up in translation.
-
@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
-
@gjacobse try typing it out and using the quote next to the enter key.
-
@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
-
@gjacobse close. Try the single quote.
-
Oh
<redacted>
-
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
-
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?
-
@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
-
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.
-
@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.