Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Disabling screensaver for all users

90 views
Skip to first unread message

Christian Jacob

unread,
Jan 17, 2006, 2:15:16 PM1/17/06
to
Hello,

I am deploying a huge software package in our environment. The
deployment itself is done with an administrative account while the user
is logged on. The process takes place in the background and does not
require any user interaction.

I need to be able to disable the screensaver before the installation is
initiated and reenable the screensaver after the installation is finished.

I read about API calls which makes it possible to disable the
screensaver, but only for the currently logged on user. I think this is
because these calls basically only tweak the registry settings for the
user. But - as stated above - the user is logged on and the installation
takes place under a different account. So this won't work.

Does anyone know a solution for this?

I need to know a way of disabling/enabling the screensaver immediately
for any user.

Thank you for reading this mail and for your time!
Best regards,
Christian.

Alan Gillott

unread,
Jan 17, 2006, 6:33:06 PM1/17/06
to
These are what I have used in the past. you need to check the registry to
ensure the changes are right. it creates a registry entry to keep the old
value then the second script restores it.

'::Title

'::Version 0 - Date 05 Nov 2000

Option Explicit

Dim WShShell,Value,Saved

Dim Password

'Password=Inputbox ("Enter Password")

'If Password <> "running" then Wscript.quit

Set WshShell=WScript.CreateObject("WScript.Shell")

On Error Resume Next

Value = WshShell.RegRead("HKCU\Control Panel\Desktop\ScreenSaveActive")

Saved = WshShell.RegRead("HKCU\Control Panel\Desktop\SaveScreenSaved")

Err.Clear

'MsgBox Value & "-" & Saved

On Error Goto 0

If Saved <> "1" then

WSHShell.RegWrite "HKCU\Control Panel\Desktop\SaveScreenSave",Value

WSHShell.RegWrite "HKCU\Control Panel\Desktop\SaveScreenSaved","1"

WshShell.RegWrite "HKCU\Control Panel\Desktop\ScreenSaveActive","0"

end if

WScript.Quit(0)

and this restores it...

'::Title Restore Saved Screen Saver

'::Version 0 - Date 05 Nov 2000

Option Explicit

Dim WShShell,Value,Saved

Set WshShell=WScript.CreateObject("WScript.Shell")

On Error Resume Next

Value = WshShell.RegRead("HKCU\Control Panel\Desktop\SaveScreenSave")

Saved = WshShell.RegRead("HKCU\Control Panel\Desktop\SaveScreenSaved")

Err.Clear

'MsgBox Value & "-" & Saved

On Error Goto 0

If Saved = "1" then

WSHShell.RegWrite "HKCU\Control Panel\Desktop\ScreenSaveActive",Value

WSHShell.RegWrite "HKCU\Control Panel\Desktop\SaveScreenSaved","0"

end if

WScript.Quit(0)

"Christian Jacob" <cja...@toptechnologies.de> wrote in message
news:%23Nc95n5...@TK2MSFTNGP09.phx.gbl...

Al Dunbar

unread,
Jan 17, 2006, 8:21:50 PM1/17/06
to
But, as the OP says, the deployment is done with an admin account while the
user is logged in. Any reference to HKCU in the code will resolve itself to
that of the admin account, not that of the user.

/Al


"Alan Gillott" <agil...@sunglobal.com> wrote in message
news:OUUch57...@tk2msftngp13.phx.gbl...

Christian Jacob

unread,
Jan 18, 2006, 12:57:08 AM1/18/06
to
Hi Al,

that's right.

I did more research on this and now I am wondering if this works:
Is it possible to write some code that will (under the administrators
account) find out who is actually logged on, load this user's registry
hive into the registry (through his ntuser.dat), change the screensaver
settings and unload the hive again?

It seems like this isn't a vbs question anymore, but I am desperated... ;-)

Thanks,
Christian.

Al Dunbar

unread,
Jan 19, 2006, 8:01:43 PM1/19/06
to

"Christian Jacob" <cja...@toptechnologies.de> wrote in message
news:%23t$XjO$GGHA...@TK2MSFTNGP09.phx.gbl...

> Hi Al,
>
> that's right.
>
> I did more research on this and now I am wondering if this works:
> Is it possible to write some code that will (under the administrators
> account) find out who is actually logged on,

Yes. One way would be to use WMI. I can't seem to find scriptomatic.hta on
my computer, so I'm sorry I cannot give you the code snippet to do this.

> load this user's registry hive into the registry (through his
> ntuser.dat), change the screensaver settings and unload the hive again?

I am not aware of any way to automate regedit from script, however there
might be tools that would do this. I'm just not aware of any.

> It seems like this isn't a vbs question anymore, but I am desperated...
> ;-)

It's a vbs question if a vbs solution would be acceptable to you. If the
ultimate answer to the question is that it cannot be done with script, I
would say that it still is a vbs question, and that, ideally, there should
be a scriptable answer even if there currently isn't one.

/Al

0 new messages