Jump to content

Postpone screensaver until script finishes


vnavna
 Share

Recommended Posts

Don't worry I got it figured out. All I did was run a file at the start of the script consisting of the following

RunWait(@ComSpec & " /c " & "regedit -s \\UNC Path\screesaveroff.reg","",@SW_HIDE) Inside of the reg file is the following.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop]

"ScreenSaveActive"="0"

And when the script finishes I run another

RunWait(@ComSpec & " /c " & "regedit -s \\UNC Path\screesaveron.reg","",@SW_HIDE)

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop]

"ScreenSaveActive"="1"

This seems to work. This is going to work for me because my settings are getting deployed through a Group Policy. if you don't use a GPO you have to go to a different place in the registry. HKEY_CURRENT_USER\Control Panel\Desktop and make your changes.

Link to comment
Share on other sites

Registry import don't have immediate action.

Here is another way...

#include <A3LWinAPI.au3>

;~ Disable
_API_SystemParametersInfo($SPI_SETSCREENSAVEACTIVE,0,0,$SPIF_UPDATEINIFILE)
ConsoleWrite('ScreenSaveActive: ' & RegRead('HKEY_CURRENT_USER\Control Panel\Desktop','ScreenSaveActive') & @LF)

;~ Enable
_API_SystemParametersInfo($SPI_SETSCREENSAVEACTIVE,1,0,$SPIF_UPDATEINIFILE)
ConsoleWrite('ScreenSaveActive: ' & RegRead('HKEY_CURRENT_USER\Control Panel\Desktop','ScreenSaveActive') & @LF)
Link to comment
Share on other sites

Hello vnavna,

I banged my head against this very issue last week.

Problem is, our screen saver settings are deployed via Group Policies and I'm unable to locate [HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop] from my non-admin account (GO SECURITY!).

From my understanding of the TechNet documentation, group policy trumps "HKEY_CURRENT_USER\Control Panel\Desktop" settings such that I can disable my screen saver registry settings all day long, but the group policy settings will always win out.

Has this been your experience as well? I'm not looking to hack around it, but I couldn't disable the screensaver using any non-admin reg settings I could find. Perhaps I'm misunderstanding all this ( wouldn't be the first time ).

Thanks,

Zach...

Edited by zfisherdrums
Link to comment
Share on other sites

Don't worry I got it figured out. All I did was run a file at the start of the script consisting of the following

RunWait(@ComSpec & " /c " & "regedit -s \\UNC Path\screesaveroff.reg","",@SW_HIDE) Inside of the reg file is the following.

Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Windows\Control Panel\Desktop]

"ScreenSaveActive"="0"

Why use a .reg file? Why not use RegRead and RegWrite

Lofting the cyberwinds on teknoleather wings, I am...The Blue Drache

Link to comment
Share on other sites

Here is the trick with Policy...

Read Screen Saver timeout value from the registry and just enable the ScreenSaver again before it times out. This will reset the Screen Saver timer.

You have to use API call like my above post.

Edited by Joon
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...