Jump to content
Sign in to follow this  

ScreenSaver TimeOut Refresh

Recommended Posts

I am successfully using AutoIt to send the registry keys to change the current user screensaver and timeout values. However, my attempts to call the user32.dll to update the per user system parameters are not working, so the time doesn't change for the user until they log out and back in... Below is a snippet of my code. I've been putting in various quick msgbox statements to track where my errors are and I've been using SMTP mail to send a notification to the helpdesk for errors. Where I'm sure the error is occurring is highlighted in red, as I can see the changes in the registry, but I'm not seeing the change in the time when I open the Screensaver control panel unless I log out and back in again.

Mind you, if I do a START-Run and run the same command it works fine (even running as a standard non-admin user on the computer), only when AutoIt tries to run it does it suddenly fail.

PS - I'm running on Windows7...

If Not RegWrite ("HKEY_CURRENT_USER\Control Panel\Desktop", "SCRNSAVE.EXE", "REG_SZ", "C:\Windows\system32\PBSO1.scr") Then

_INetSmtpMail ($s_SmtpServer, $s_FromName1, $s_FromAddress1, $s_ToAddress1, "Screensaver registry change to PBSO1.SCR on " & @ComputerName & " failed for user: " & @UserName, $as_Body1, @ComputerName, -1)



If Not RegWrite ("HKEY_CURRENT_USER\Control Panel\Desktop", "ScreenSaveTimeOut", "REG_SZ", "600") Then

_INetSmtpMail ($s_SmtpServer, $s_FromName1, $s_FromAddress1, $s_ToAddress1, "Screensaver registry change to 10 minute timeout on " & @ComputerName & " failed for user: " & @UserName, $as_Body1, @ComputerName, -1)



If Not RunWait ("c:\windows\system32\rundll32 user32.dll,UpdatePerUserSystemParameters, 1, True") Then

_INetSmtpMail ($s_SmtpServer, $s_FromName1, $s_FromAddress1, $s_ToAddress1, "Screensaver registry refresh failed for user: " & @UserName, $as_Body1, @ComputerName, -1)



_INetSmtpMail ($s_SmtpServer, $s_FromName, $s_FromAddress1, $s_ToAddress, "You have a new PBSO Screensaver available on " & @ComputerName, $as_Body, @ComputerName, -1)


Edited by Rickster

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...