VBS Scripts

  • Thread starter Thread starter Geordie
  • Start date Start date
G

Geordie

Hi,
I am unable to run VBS Scripts,when I double click on them the following
message appears.
Line 1
char 18
Error Expected end of statement
code 800A0401
source Microsoft VBScript compilation error.
 
Geordie said:
Hi,
I am unable to run VBS Scripts,when I double click on them the following
message appears.
Line 1
char 18
Error Expected end of statement
code 800A0401
source Microsoft VBScript compilation error.

Let's have a look at your script!
 
Let's have a look at your script!

Thanks for the reply,

This is one of them.

Set IRP = getobject("winmgmts:\\.\root\default:Systemrestore")
MYRP = IRP.createrestorepoint ("Quick Restore Point", 0, 100)
 
Can you post the script here?

Hi,

This is another one downloaded from Doug Knox's site.

'Unattended System Restore Point
'sysrestorepoint.vbs
'© Doug Knox - rev 02/11/2002
'Downloaded from www.dougknox.com
'Extracted from original code by Bill James - www.billsway.com

Set sr = getobject("winmgmts:\\.\root\default:Systemrestore")

msg = "New Restore Point successfully created." & vbCR
msg = msg & "It is listed as: " & vbCR
msg = msg & "Automatic Restore Point " & Date & " " & Time

'Put a ' in front of the next five lines to disable the Success Failed
Prompt.
If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then
MsgBox msg
Else
MsgBox "Restore Point creation Failed!"
End If

'Remove the ' from the next 3 lines to only alert you if the process failed
'If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) <> 0 Then
' MsgBox "Restore Point creation Failed!"
'End If
-------------------------------------------------
This is the error message for this one
Script C:\downloads\xpsysrestorepoint.
line 14
char 1
Error no such interface supported
Code 80004002
Source SWbemObjectEX
 
You mean this script does not work:


WScript.Echo "Click Ok to Start Restore Point, this will take about 10
seconds."
Set sr = getobject("winmgmts:\\.\root\default:Systemrestore")
msg = "New Restore Point successfully created." & vbCR
msg = msg & "It is listed as: " & vbCR
msg = msg & "Automatic Restore Point " & Date & " " & Time

If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then
MsgBox msg
Else
MsgBox "Restore Point creation Failed!"
End If

Set sr = Nothing
 
You mean this script does not work:


WScript.Echo "Click Ok to Start Restore Point, this will take about 10
seconds."
Set sr = getobject("winmgmts:\\.\root\default:Systemrestore")
msg = "New Restore Point successfully created." & vbCR
msg = msg & "It is listed as: " & vbCR
msg = msg & "Automatic Restore Point " & Date & " " & Time

If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then
MsgBox msg
Else
MsgBox "Restore Point creation Failed!"
End If

Set sr = Nothing

That is correct, it does not work.
 
Geordie said:
line 1
char 72
Error unterminated string constant
code 800A0409
Source Micosoft VB Script compilation error

What happens when you run this code?

WScript.Echo "Click Ok to Start"

and this one:

WScript.Echo "Click Ok to Start"
line = "winmgmts:\\.\root\default:Systemrestore"
Set sr = GetObject(line)
msg = "New Restore Point created." & vbCr
msg = msg & "It is listed as: " & vbCr
line = "Automatic Restore Point"
If (sr.createrestorepoint("Line", 0, 100)) = 0 Then
MsgBox msg
Else
MsgBox "Restore Point creation Failed!"
End If
 
Line 1 does not have 72 chars in it?
Did you edit the script in any way?
Because it works on XP and Vista.
 
PaulM said:
Line 1 does not have 72 chars in it?
Did you edit the script in any way?
Because it works on XP and Vista.

I have a strong suspicion that the OP is saving his
script in one file and that he is executing a completly
different file. This would explain all of his problems.
 
He is doing something wrong. I even redid some of the script and I tested it
on XP and Vista and it works.
 
Here is the new one.


'Auto Restore Point for Vista
set WshShell = CreateObject("WScript.Shell")
Result = WshShell.Popup("System Restore will start in 5 seconds", 5,
"AutoRestore", 65)
Result = WshShell.Popup("It will take about 10 seconds to create the file."
,4, "Creating File",65)
Set sr = getobject("winmgmts:\\.\root\default:Systemrestore")
phm = "New Restore Point successfully created." & vbCR
phm = phm & "It is listed as: "
phm = phm & "Automatic Restore Point " & vbCR & Date & " " & Time

If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then
MsgBox phm
Else
MsgBox "Restore Point creation Failed!"
End If

Set sr = Nothing
 
What happens when you run this code?

WScript.Echo "Click Ok to Start"

and this one:

WScript.Echo "Click Ok to Start"
line = "winmgmts:\\.\root\default:Systemrestore"
Set sr = GetObject(line)
msg = "New Restore Point created." & vbCr
msg = msg & "It is listed as: " & vbCr
line = "Automatic Restore Point"
If (sr.createrestorepoint("Line", 0, 100)) = 0 Then
MsgBox msg
Else
MsgBox "Restore Point creation Failed!"
End If

Hi,
When the above is run, this is the error message that I get.

line 8
char 1
Error no such interface supported.
Code 80004002
Source SWbemObjectEx
 
Here is the new one.


'Auto Restore Point for Vista
set WshShell = CreateObject("WScript.Shell")
Result = WshShell.Popup("System Restore will start in 5 seconds", 5,
"AutoRestore", 65)
Result = WshShell.Popup("It will take about 10 seconds to create the file."
,4, "Creating File",65)
Set sr = getobject("winmgmts:\\.\root\default:Systemrestore")
phm = "New Restore Point successfully created." & vbCR
phm = phm & "It is listed as: "
phm = phm & "Automatic Restore Point " & vbCR & Date & " " & Time

If (sr.createrestorepoint("Automatic Restore Point", 0, 100)) = 0 Then
MsgBox phm
Else
MsgBox "Restore Point creation Failed!"
End If

Hi,
Thanks for your help,when I try to use the above script,this is the error
message that appears.

line 1
char 14
Error Expected end of statement
code 800A0401
source microsoft VBScript compilation error
 
As I said before, I can smell a rat. Let's try and nail this one
down. Please follow the instructions below ***verbatim***,
without deviating one bit!
1. Click Start / Run / cmd{OK}
This will give you a black Command Prompt screen.
2. Type these commands:
echo wscript.echo "Hello world" > c:\test.vbs{Enter}
%SystemRoot%\system32\cscript.exe c:\test.vbs{Enter}
3. Report what you see on the screen.
 
Back
Top