I want to disable Password protection the screen saver in group policy with a PowerShell command/script.
I have run this command it didn't work. still shows as enabled in the group policy
Set-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name ScreenSaveUsePassword -Value 0
i have tried below but it didn't work.
Setting Windows screensaver require password with powershell
following the function on above StackOverflow link when i run,
Set-OnResumeDisplayLogon(0)
it outputs an error.
you cannot call a method on a null-valued expression.
Try this PowerShell command/script that you can use to disable password protection for the screen saver in group policy
New-Item -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Control Panel\Display -Name ScreenSaverIsSecure -Value 0 -Force
This command will create a new registry key called ScreenSaverIsSecure under the HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\Control Panel\Display key. The value of the registry key will be set to 0, which will disable password protection for the screen saver.
To apply this change to all users, you can use the following command:
New-Item -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\User -Name ScreenSaverIsSecure -Value 0 -Force
This will create the same registry key under the HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies\User key, which will apply the change to all users.
You can also use the following command to apply the change to a specific OU:
$ou = Get-ADOrganizationalUnit -Identity "OU=YourOU,DC=YourDomain,DC=com" New-Item -Path HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies$ou -Name ScreenSaverIsSecure -Value 0 -Force
This will create the registry key under the HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies<OU> key, where is the name of the OU you want to apply the change to.