
# -*- coding: utf-8 -*-

name = 'set-GPO-SSaverTimeout'
description = 'set the screensaver timeout for a GPO'
args = {
	'name': dict(help='Name of the GPO'),
	'timeout': dict(help='Timeout for screensaver on client'),
	'guid': dict(help='guid of gpo'),
}

ps = '''
$ErrorActionPreference = "Stop"
$guid="%(guid)s"
if($guid -ne "None" ){
set-GPPrefRegistryValue -Guid %(guid)s -Context User -key "HKCU\Software\Policies\Microsoft\Windows\Control Panel\Desktop" -ValueName ScreenSaveTimeOut -Type String -value %(timeout)s -Action Update
}else{
set-GPPrefRegistryValue -Name "%(name)s" -Context User -key "HKCU\Software\Policies\Microsoft\Windows\Control Panel\Desktop" -ValueName ScreenSaveTimeOut -Type String -value %(timeout)s -Action Update
}
'''
