Help on VBS program

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,
 
S

Synapse Syndrome

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.
 
R

RScotti

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.
 
S

Synapse Syndrome

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.
 
R

RScotti

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?
 
R

RScotti

PaulM,
Thank you very much. it works! Will see if it works from Task Schedule tonight?
Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top