Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Logoff Script to set screensaver

Status
Not open for further replies.
Dec 24, 2003
132
US
Greetings-

We have a logoff script which checks for a screensaver and if the workstation doesn't have one it will set it to a default. It will also set the time for the screensave to kick in to 10 minutes if it's anything higher than that.

One PC, a Toshiba Satellite laptop, gets an error when processing the script: Line 12 Character 4

Here is the script:

********************
main

sub main
const HKEY_CURRENT_USER = &H80000001
const strKeyPath = "Control Panel\Desktop"
const strSaver = "SCRNSAVE.EXE"
const strTimeout = "ScreenSaveTimeOut"
const intTargetTimeout = 600
const strTargetSaver = "C:\WINDOWS\System32\logon.scr"

const strComputer = "."
Set oReg=GetObject( "winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")

oReg.GetStringValue HKEY_CURRENT_USER,strKeyPath,strSaver,strValueSaver
oReg.GetStringValue HKEY_CURRENT_USER,strKeyPath,strTimeout,strValueTimeout
'WScript.Echo strValueSaver & ":" & strValueTimeout
intValueTimeout = CInt(strValueTimeout)

if Len(strValueSaver) > 0 then
else
oReg.SetStringValue HKEY_CURRENT_USER,strKeyPath,strSaver,strTargetSaver
end if

if intValueTimeout > intTargetTimeout or intValueTimeout <= 0 then
oReg.SetStringValue HKEY_CURRENT_USER,strKeyPath,strTimeout,intTargetTimeout
end if

end sub
*****************************

Here is line 12: Set oReg=GetObject( "winmgmts:{impersonationLevel=impersonate}!\\" & strComputer & "\root\default:StdRegProv")


Thanx
OregonSteve

"..You should never, never doubt what nobody is sure about." -Willy Wonka
 
Only thing Ive noticed is if its an NT box to make sure WMI is installed...if its a 2000...I think its already installed...usually a reboot fixes it..what error erre ya gettin
 
Hey, now!

It appears the solution this time around was to do an OS repair on the laptop. That's what my Tech did, anyways. Thanks for the reply.

Thanx
OregonSteve

"..You should never, never doubt what nobody is sure about." -Willy Wonka
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top