Intune – PowerShell – Add Screensaver Config

email me

Step 1 – Code and save script

Step 2 – Test script locally, first

Step 3 – If that works, add script to Intune

Home > Microsoft Intune>  Device configuration > PowerShell scripts > +Add

 

Step 4 – Assign script to appropriate group in Intune

Home > Microsoft Intune > Device configuration – PowerShell scripts > Set-ScreenSaver_Ribbons  >  Properties > Edit PowerShell script > +Select groups to include


Script

$ErrorActionPreference= 'silentlycontinue'

$SSFile = "${Env:SystemRoot}\Ribbons.scr"

Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "ScreenSaveActive"

Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "ScreenSaverIsSecure"

Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "ScreenSaveTimeOut"

Remove-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name "SCRNSAVE.EXE"

New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name ScreenSaveActive -Value 1 -PropertyType String

New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name ScreenSaverIsSecure -Value 0 -PropertyType String

New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name ScreenSaveTimeOut -Value 300 -PropertyType String

New-ItemProperty -Path "HKCU:\Control Panel\Desktop" -Name SCRNSAVE.EXE -Value $SSFile -PropertyType String

 

Notes

Remove-ItemProperty

New-ItemProperty


Removing Registry Policy

Remove-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop" -Name "ScreenSaveActive"

Remove-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop" -Name "ScreenSaverIsSecure"

Remove-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop" -Name "ScreenSaveTimeOut"

Remove-ItemProperty -Path "HKCU:\Software\Policies\Microsoft\Windows\Control Panel\Desktop" -Name "SCRNSAVE.EXE"

 

tags: Azure, Intune, PowerShell, Screensaver, MrNetTek