Forum Discussion
AB21805
Jul 10, 2023Bronze Contributor
Unable to change screensaver active to 0 via powershell - intune
Hi all, I have used this locally on a device which works : $RegistryPath = "HKCU:\Control Panel\Desktop" $RegistryName = "screensaveactive" $NewValue = "0" Set-ItemProperty -Path $RegistryPath -...
- Jul 14, 2023I added the script to my tenant and deployed it to my user, and the value was changed to 0. I changed it to your value (320), changed the script (Changed the log file name), and uploaded it again to Intune. The script ran on my client, and the value is back to 0. It just works... Not sure what is happening to your machine... Do you have a Configuration Profile which sets the ScreenSaver time-out? You have to exclude the group that you use for this script on that Configuration Profile
AB21805
Jul 13, 2023Bronze Contributor
The value doesnt change from 1 to 0 for savescreenactive
I use script to do it not win32 - even though the script succeeds the value doesnt change
I did get a response here : https://learn.microsoft.com/en-us/answers/questions/1327706/unable-to-change-screensaver-active-to-0-via-power which did indicate I needed to change HKCU to HKU but that didnt work / failed on deployment.
Jul 13, 2023
As a user, I tested it again in a powershell prompt, and it works fine... You do run the script as a user, right?
- Jul 14, 2023I added the script to my tenant and deployed it to my user, and the value was changed to 0. I changed it to your value (320), changed the script (Changed the log file name), and uploaded it again to Intune. The script ran on my client, and the value is back to 0. It just works... Not sure what is happening to your machine... Do you have a Configuration Profile which sets the ScreenSaver time-out? You have to exclude the group that you use for this script on that Configuration Profile
- AB21805Jul 14, 2023Bronze Contributor
- AB21805Jul 14, 2023Bronze ContributorYes ahha Sorry about that I misunderstood, I am just waiting for policy to deploy
- Jul 14, 2023Seems ok, you're using a group with just users now?
- AB21805Jul 14, 2023Bronze Contributor
Ahhh my bad I apologies! Ill deploy to the user also can you check if this is correct:
- Jul 14, 2023You do need to deploy it to the user 😅
- AB21805Jul 14, 2023Bronze ContributorOh wait I have been deploying this script to the device but setting "Run this script using the logged on credentials" as on is this correct I dont need to deploy it to the user instead do i?
- Jul 13, 2023Yes, test this first... not sure if a user can write there, but I think so... Deploy the script to a test user, check the log
- AB21805Jul 13, 2023Bronze ContributorI have set this to deploy as so:
start-transcript c:\programdata\log.txt
Write-Host "Disabling Screensaver"
Set-ItemProperty "HKCU:\Control Panel\Desktop" -Name ScreenSaveActive -Value 0 -Type DWord
& powercfg -x -monitor-timeout-ac 0
& powercfg -x -monitor-timeout-dc 0
Stop-transcript
Is that correct? - Jul 13, 2023Could you try a start-transcript c:\programdata\log.txt before the script and a stop-transcript after (First and last line). What does the log say?
- AB21805Jul 13, 2023Bronze ContributorYes running as user, works if I do it locally on the machine but if I upload the script via the script blade on intune and have run as user on and other 2 options as off no luck