Help on VBS program

  • Thread starter Thread starter PaulM
  • Start date Start date
P

PaulM

Try this:

If WScript.Arguments.length =0 Then
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "wscript.exe", """" & _
WScript.ScriptFullName & """" &_
" RunAsAdministrator", , "runas", 1
else
CONST DEVICE_DRIVER_INSTALL = 10
CONST BEGIN_SYSTEM_CHANGE = 100

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")

Set objItem = objWMIService.Get("SystemRestore")
errResults = objItem.CreateRestorePoint _
("12 hr restore point", DEVICE_DRIVER_INSTALL, BEGIN_SYSTEM_CHANGE)
End If

Copy and paste just the way it is,
 
RScotti said:
Hi,
I had a vbs program that I used for System Restore every 12 hours but it
does work any more I get an error massage . Says Script: C:SR.vbs
Line: 18
Char: 5
Error: Expected end of statement
Source: Microsoft VBScript compilation error.

Here is the script:

' Create a System Restore Point

' Windows Server 2003 : No
' Windows XP : Yes
' Windows 2000 : No
' Windows NT 4.0 : No
' Windows 98 : No

CONST DEVICE_DRIVER_INSTALL = 10
CONST BEGIN_SYSTEM_CHANGE = 100

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer &
"\root\default")

Set objItem = objWMIService.Get("SystemRestore")
errResults = objItem.CreateRestorePoint _
"12 hr restore point", DEVICE_DRIVER_INSTALL, BEGIN_SYSTEM_CHANGE)


This was for originally Windows XP I can't find line 18????

Maybe you guys know one for Vista Ultimate SP1?

You also need help on sorting out your system time/date/timezone.

ss.
 
Synapse,
If you would please read my message two lines up from yours. You would see I already did that.
You should READ at all the reply's before making a false statement. Than you will know what your talking about!

Sorry, I just noticed my time was off by 24 hours.
 
RScotti said:
Synapse,
If you would please read my message two lines up from yours. You would
see I already did that. You should READ at all the reply's before making
a false statement. Than you will know what your talking about!


Whadda Mistaka Da Maka!

ss.
 
Hi,
I had a vbs program that I used for System Restore every 12 hours but it does work any more I get an error massage .
Says Script: C:SR.vbs
Line: 18
Char: 5
Error: Expected end of statement
Source: Microsoft VBScript compilation error.

Here is the script:

' Create a System Restore Point

' Windows Server 2003 : No
' Windows XP : Yes
' Windows 2000 : No
' Windows NT 4.0 : No
' Windows 98 : No

CONST DEVICE_DRIVER_INSTALL = 10
CONST BEGIN_SYSTEM_CHANGE = 100

strComputer = "."
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\default")

Set objItem = objWMIService.Get("SystemRestore")
errResults = objItem.CreateRestorePoint _
"12 hr restore point", DEVICE_DRIVER_INSTALL, BEGIN_SYSTEM_CHANGE)


This was for originally Windows XP I can't find line 18????

Maybe you guys know one for Vista Ultimate SP1?
 
PaulM,
Thank you very much. it works! Will see if it works from Task Schedule tonight?
Thanks again.
 
Back
Top