Windows Server - Error: Expected statement
Asked By gary_pietil
26-Jul-08 08:52 PM
I am getting an Expected statement error with a code of 800A0400,
source: MS VBScript compilation error
on the line below that contains <job>
Any ideas on how I can fix this?
On Error Resume Next
Const ForReading = 1
Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objTextFile = objFSO.OpenTextFile("c:\scripts\servers.txt",
ForReading)
Do Until objTextFile.AtEndOfStream
strComputer = objTextFile.Readline
'====================================================================================
' Begin main code
'====================================================================================
' general constants
Scripting.FileSystemObject
(1)
ObjTextFile.AtEndOfStream
(1)
ObjFSO.OpenTextFile
(1)
ObjTextFile.Readline
(1)
VBScript
(1)
ObjFSO
(1)
CreateObject
(1)
ObjTextFile
(1)
Tom Lavedas replied...
This is being run as a .wsf file, right? I am no expert, but I think
all of the code must fall between a pair of job tags.
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
gary_pietil replied...
/>
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
Yes it does, I cut out the rest of the script to save space. this is
a .wsf script inside a VBscript to run against multiple computers that
calls another VBScript file. I get the error at the <job> tag.
Tom Lavedas replied...
What do you mean by "a .wsf script inside a VBscript"?
The problem seems to me that there is code OUTSIDE of the JOB block.
AFAIK a JOB cannot exist inside of another JOB. And no code is
allowed outside of a JOB block.
Tom Lavedas
===========
http://members.cox.net/tglbatch/wsh/
gary_pietil replied...

ipt" />
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
nk
I found this site (http://www.lynchconsulting.com.au/blog/index.cfm/
2007/2/11/Disk-space-monitoring-script-for-windows) that had a .wsf
script that called a .vbs script but it only runs on one computer.
I then found a script that runs against multiple computers listed in a
text file (http://www.microsoft.com/technet/scriptcenter/scripts/
templates/wmi/basic/default.mspx?mfr=3Dtrue) it had a section that said
within this script & it throws the error. I am guessing I need to turn
the .wsf & .vbs scripts into functions within the 3rd script & call
them???
Hope this makes sense. The whole purpose of this exercise is to get a
listing of disk space/free space on multiple servers & to learn how to
script in VBS. New to scripting, I appreciate the help.
Tom Lavedas replied...
cript" />
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=AD=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=
=3D=3D=3D=3D=3D=3D=3D=3D=AD=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
hink
h/
t
-
Yes, now it makes sense, but I don't have enough to go on to say more
that general comment.
WSF is VBS, if that's the language invoked. It is possible the code
can just be stripped of all of the XML tags and used as is, but it
depends on what aspects of WSF usage was used. Without the exact
code, its impossible to tell. But, one thing is clear, it won't run
with the XML tags - unless it is a WSF.
Tom Lavedas
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

Dim FileName, OutputName, Marker, CRLF, p Dim oFSO, oArgs, Input, InputStream, objOutFile Set oFSO = CreateObject("Scripting.FileSystemObject") Set oArgs = WScript.Arguments Marker = Chr(183) CRLF = Chr(13) & Chr(10) FileName = objArgs(0 ObjWshShell.Environment ("PROCESS")("temp")· Tempname1 = temp & .tmp"· · Err.Clear· On Error Resume Next · Set objStream = objFSO.OpenTextFile(Te mpname1, ForWriting, True)· If Err.numbe r <> 0 Then· WScript.Echo ("Cannot open Echo Status = WshRunning· WScript.Sleep 100· Loop·· Err.Clear· On Error Resume N ext· Set InputFile = objFSO.OpenTextFile (Tempname2)· If Err.number <> 0 Then· W Script.Echo ("Cannot access """ & TempNa me2 & """.")· WScript.Echo rdir.vbs C: \ {OK} and I get: C: \ rdir.vbs(40, 44) Kompilierungsfehler in Microsoft VBScript: 'Then' erwartet which means compilation error in M. . . 'Then' expected. Could you please check if is some error in the code or my fault? I am not an expert in VBScript. . . Thanks, Guilherme Hello John, I have run again It reports 89GB total 84.9GB used
name on command line has maximum length of 28 characters / / = = = = = = = = = = = = = = = = = = = = = = = = = = = [ Variables ] = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = var fso = new ActiveXObject("Scripting.FileSystemObject"); var FileHandle, ExitStatus = 0, BackupStatus = 0; var ForReading = 1, ForWriting = 2, ForAppending = 8; var EmailBody var ExitCode, LogF = 0x2; if (FsLogFlag(LogF)) IoLogEvent("open", LogHandle, "FsCheckFileExists"); var fso = new ActiveXObject("Scripting.FileSystemObject"); ExitCode = fso.FileExists(FileName) if (FsLogFlag(LogF)) { if (ExitCode) IoLogEvent("content", LogHandle, FileName +" does exist LogHandle) { var ExitCode, LogF = 0x200; if (FsLogFlag(LogF)) IoLogEvent("open", LogHandle, ""); var fso = new ActiveXObject("Scripting.FileSystemObject"); ExitCode = fso.FolderExists(FolderName) if (FsLogFlag(LogF)) { if (ExitCode) IoLogEvent("content", LogHandle, "FsCheckFolderExists success: else FileName, LogHandle) && Overwrite) | | (!FsCheckFileExists(FileName, LogHandle))) { if (FsLogFlag(LogF)) IoLogEvent("open", LogHandle, ""); fso = new ActiveXObject("Scripting.FileSystemObject"); f = fso.CreateTextFile(FileName, Overwrite, Unicode); f.Close(); if (FsLogFlag(LogF)) { IoLogEvent("content", LogHandle, "FsFileCreate
Script: c: \ remote_printer_cleanup_install.vbs Line: 39 Char: 45 Error: Syntax error Code: 800A03EA Source: Microsoft VBScript compilation error Here's my script: ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ' remote_printer_cleanup_install.vbs ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = On Error Resume Next Const ForReading = 1 Const WbemAuthenticationLevelPktPrivacy = 6 strUser = "Administrator" strPassword = "domainadminpassword" Set objFSO = CreateObject("Scripting.FileSystemObject") Set objTextFile = objFSO OpenTextFile(". \ computers.txt", ForReading) Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator") ' strComputerUser = "Computer" & vbTab & "Logged in User" Do Until objTextFile.AtEndOfStream strComputer = objTextFile.Readline ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = ' Insert your code here ' = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = Set objWMIService = objwbemLocator.ConnectServer (strComputer, strNamespace, strUser, strPassword) objWMIService.Security_
out how to do this? On Error Resume Next Const ForReading = 1 Set objFSO = CreateObject("Scripting.FileSystemObject") Set objTextFile = objFSO.OpenTextFile("c: \ scripts \ servers.txt", ForReading) Do Until objTextFile.AtEndOfStream strComputer = objTextFile.Readline Set objShell = CreateObject("WScript.Shell") strCommand = "%comspec% / c ping -n 3 -w 1000 " & strComputer & "" Set