|
-
Aug 23rd, 2008, 10:51 PM
#1
Thread Starter
Lively Member
Basic VBScript scheduled task
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:
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
any ideas?
-
Aug 24th, 2008, 05:58 AM
#2
Re: Basic VBScript scheduled task
Could you not just restrict their access to the registry key or through policies?
-
Aug 28th, 2008, 12:52 PM
#3
Thread Starter
Lively Member
Re: Basic VBScript scheduled task
not really, they're demo computers at an electronics store I work at... The customer needs to be able to fiddle around and test things out (e.g. try different screensavers or wallpapers), but we don't want the changes to stick... that way, we don't have to deal with obscene wallpapers, screensavers, or the ubiquitous "all your base are belong to us" marquee.
I've already patched the registry to ignore bat files and only run vbs files from the administrator account, but I need to be able to revert screensaver and wallpaper on a regular basis... this is the first step, I will add wallpaper control later (once I work it out)
anyway, how can I get this to work?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|