Windows Vista Tips

Windows Vista Tips > Newsgroups > Windows Vista General Discussion > Help on VBS program

Reply
Thread Tools Display Modes

Help on VBS program

 
 
PaulM
Guest
Posts: n/a

 
      11-15-2008
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,

--
Paul's XP and Vista Tweaks
---------------------------------------
www.paulsxp.com

Paul's XP and Vista Help Forum
--------------------------------------------
www.paulsxp.com/forum

Live Support
------------------
www.paulsxp.com/livesupport.html

"RScotti" <> wrote in message
news:...
> 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?
> --
> Have a good day,
> RScotti
>
> remove "nospam" in order to email me.
>

 
Reply With Quote
 
 
 
 
Mark L. Ferguson
Guest
Posts: n/a

 
      11-15-2008
--myrestore.vbs--
set SysResPoint = getobject("winmgmts:\\.\root\default:Systemrestore ")
CSRP = SysResPoint.createrestorepoint (" test", 0, 100)
--end file-
Use a scheduled task to run this script.

--
Please use the Communities guidelines when posting.
http://www.microsoft.com/wn3/locales...help_en-us.htm
Use the "Ratings" feature. It helps the new users.
Mark L. Ferguson MS-MVP
https://mvp.support.microsoft.com/profile/Mark.Ferguson

"RScotti" <> wrote in message
news:...
> 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?
> --
> Have a good day,
> RScotti
>
> remove "nospam" in order to email me.
>

 
Reply With Quote
 
PaulM
Guest
Posts: n/a

 
      11-15-2008
You are Welcome.

--
Paul's XP and Vista Tweaks
---------------------------------------
www.paulsxp.com

Paul's XP and Vista Help Forum
--------------------------------------------
www.paulsxp.com/forum

Live Support
------------------
www.paulsxp.com/livesupport.html

"RScotti" <> wrote in message
news:...
>
>
> PaulM,
> Thank you very much. it works! Will see if it works from Task Schedule
> tonight?
> Thanks again.
>
>
> On Sat, 15 Nov 2008 13:11:22 -0500, "PaulM" <> wrote:
>
>>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,

> --
> Have a good day,
> RScotti
>
> remove "nospam" in order to email me.
>

 
Reply With Quote
 
Synapse Syndrome
Guest
Posts: n/a

 
      11-16-2008
RScotti <> wrote:
>
> 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.


 
Reply With Quote
 
RScotti
Guest
Posts: n/a

 
      11-16-2008

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!

On Sat, 15 Nov 2008 23:48:51 -0500, RScotti <> wrote:

>Sorry, I just noticed my time was off by 24 hours.
>
>




On Sun, 16 Nov 2008 05:13:26 -0000, "Synapse Syndrome" <> wrote:

>RScotti <> wrote:
>>
>> 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.
>

--
Have a good day,
RScotti

remove "nospam" in order to email me.

 
Reply With Quote
 
Synapse Syndrome
Guest
Posts: n/a

 
      11-16-2008
RScotti <> wrote:
>
> 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.


 
Reply With Quote
 
RScotti
Guest
Posts: n/a

 
      11-16-2008
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?
--
Have a good day,
RScotti

remove "nospam" in order to email me.

 
Reply With Quote
 
RScotti
Guest
Posts: n/a

 
      11-16-2008


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


On Sat, 15 Nov 2008 13:11:22 -0500, "PaulM" <> wrote:

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

--
Have a good day,
RScotti

remove "nospam" in order to email me.

 
Reply With Quote
 
RScotti
Guest
Posts: n/a

 
      11-17-2008
Hi Mark,
That's good also and it's shorter!
Thanks




On Sat, 15 Nov 2008 16:13:31 -0600, "Mark L. Ferguson" <> wrote:

>--myrestore.vbs--
>set SysResPoint = getobject("winmgmts:\\.\root\default:Systemrestore ")
>CSRP = SysResPoint.createrestorepoint (" test", 0, 100)
>--end file-
>Use a scheduled task to run this script.

--
Have a good day,
RScotti

remove "nospam" in order to email me.

 
Reply With Quote
 
RScotti
Guest
Posts: n/a

 
      11-18-2008
Take care of your self everybody is human and makes mistakes.

On Sun, 16 Nov 2008 15:11:09 -0000, "Synapse Syndrome" <> wrote:

>RScotti <> wrote:
>>
>> 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.
>

--
Have a good day,
RScotti

remove "nospam" in order to email me.

 
Reply With Quote
 
 
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
After a program is closed, Vista informs that the program has stoppedworking. Huh? Raymond Windows Vista General Discussion 5 01-20-2008 07:22 PM
Uninstalled Program, but Program Name Remains in Program & Featur kuyarog Windows Vista General Discussion 3 12-01-2007 11:26 PM
program Install and program has stopped working Drew Windows Vista General Discussion 1 08-17-2007 09:30 AM
program Install and program has stopped working Drew Windows Vista Installation 1 08-17-2007 09:30 AM
Spyware .exe program won't save or run into Program Files folder Little Lil Windows Vista General Discussion 3 03-20-2007 10:14 PM



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59