i'm trying to create a script to revert the screen saver on a computer every five minutes (so as to keep people from changing the screen saver on a display computer, without limiting their ability to examine it)...
I have the reverting part down, but the AT command doesn't seem to produce a scheduled task...
here's the code:
any ideas?Code:'******************************************************* '* Script that resets screensaver * '* for security purposes * '* * '* Author: Scobee * '* * '* Date: August 23, 2008 * '* * '* Desc: place in startup, to reset screensaver * '* every 5 minutes * '******************************************************* Option Explicit On Error Resume Next Const saver = "C:\WINDOWS\System32\logon.scr" 'Creating objects and variables Const HKEY_CURRENT_USER = &H80000001 Dim WSHShell, RegKey, ScreenSaver, objReg, lastscreensaver Set objReg = GetObject("winmgmts:\\.\root\default:StdRegProv") RegKey = "HKEY_CURRENT_USER\Control Panel\Desktop\" objReg.SetStringValue HKEY_CURRENT_USER,RegKey,"LastScreenSaver","None" Set WSHShell = CreateObject("WScript.Shell") 'Sets the screensaver to the default XP screensaver... WSHShell.RegWrite regkey & "scrnsave.exe", saver '...then saves this as the last used screensaver WSHShell.RegWrite regkey & "LastScreenSaver", saver 'makes this script run every 5 minutes Dim rTime, hourInt, minInt rTime = Time() 'get AM or PM from the time myAMPM = Right(rTime,2) 'get Hour and Minute myColon = instr(1, rTime, ":",vbBinaryCompare) IF myColon = 2 THEN myHour = Left(rTime,1) myMinute = Mid(rTime, 3, 2) ELSE myHour = Left(rTime,2) myMinute = Mid(rTime, 4, 2) END IF hourInt = CInt(myHour) minInt = CInt(myMinute) IF minInt >= 55 THEN hourInt = hourInt + 1 IF hourInt > 12 THEN hourInt = 1 END IF IF hourInt = 12 THEN IF myAMPM = "AM" THEN myAMPM = "PM" ELSE myAMPM = "AM" END IF END IF minInt = 0 END IF IF minInt < 55 THEN minInt = minInt + 5 END IF 'concatenate the time myTime = hourInt & ":" & minInt & myAMPM Set ObjShell = CreateObject("WScript.Shell") dim shellText shellText = "AT " + myTime + " " + Wscript.ScriptFullName objShell.run(shellText) Set ObjShell = nothing


Reply With Quote
