Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsWindows Server 2003Windows 2000Windows NTSmall Business ServerVirtual ServerExchange ServerIISHost Integration ServerISA ServerSMSWSUSMOMWindows Media ServerSecurityCertification
Related Topics
SQL ServerMS WindowsMS OfficePC HardwareMore Topics ...

Windows Server Forum / IIS / IIS General Topics / December 2005

Tip: Looking for answers? Try searching our database.

Help!!  Invalid Syntax in VBS script

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
rich - 28 Dec 2005 16:46 GMT
Hello,

The following code sniplet exists in numerous vbscript files that I've
downloaded from Microsoft or other sources. When I run the script, I get the
following error:
Error: Invalid Syntax
Line 7, character 1
Code: 800401e$
Source: (null)

'Option Explicit

Dim ObjIIS
Dim strComputer

strComputer = "LocalHost"
Set objIIS = GetObject("IIS://" & "LocalHost" & "/W3SVC/1")

Wscript.Echo "Access Flags: " & objIIS.AccessFlags
Wscript.Echo "ASP Enable Parent Paths: " & objIIS.AspEnableParentPaths

I don't understand the problem. Can anyone help me?

TIA,
Rich
Egbert Nierop (MVP for IIS) - 28 Dec 2005 16:56 GMT
> Hello,
>
> The following code sniplet exists in numerous vbscript files that I've
> downloaded from Microsoft or other sources. When I run the script, I get
> the

Where are you trying to run this?
if you name the file as .vbs it should work.
If you run this within ASP
you should rename the wscript.echo to Response.Write

> following error:
> Error: Invalid Syntax
[quoted text clipped - 17 lines]
> TIA,
> Rich
rich - 28 Dec 2005 17:05 GMT
I am running the script on my desktop.  It should get the various properties
from a remote IIS server.

--Rich

> > Hello,
> >
[quoted text clipped - 28 lines]
> > TIA,
> > Rich
David Wang [Msft] - 30 Dec 2005 04:20 GMT
Sample code which shows how to retrieve various website properties from IIS,
both local and remote:
http://blogs.msdn.com/david.wang/archive/2005/07/13/HOWTO_Enumerate_IIS_Website_
Configuration.aspx


Should be easy to adapt/modify to your needs on a per-website basis.

Example output:

Enumerating websites on localhost

Site ID = 1
Comment = "Default WebSite"
State   = Started (MD_SERVER_STATE_STARTED)
LogDir  = %WinDir%\System32\LogFiles
IP Address      Port    Host
All Unassigned  80      *
1.2.3.4         81      *
12.34.56.78     82      HostHeader
All Unassigned  443     *

Site ID = 2
Comment = "Administration Web Site"
State   = Started (MD_SERVER_STATE_STOPPED)
LogDir  = %WinDir%\System32\LogFiles
IP Address      Port    Host
All Unassigned  8734    *
All Unassigned  443     *

Signature

//David
IIS
http://blogs.msdn.com/David.Wang
This posting is provided "AS IS" with no warranties, and confers no rights.
//

>I am running the script on my desktop.  It should get the various
>properties
[quoted text clipped - 35 lines]
>> > TIA,
>> > Rich
rich - 28 Dec 2005 17:06 GMT
Oops,

The file is named lwsi.vbs  (list web server info.vbs)

> > Hello,
> >
[quoted text clipped - 28 lines]
> > TIA,
> > Rich
Egbert Nierop (MVP for IIS) - 28 Dec 2005 22:20 GMT
> Oops,
>
> The file is named lwsi.vbs  (list web server info.vbs)

ok,
thanks for clearing up.
Your code is really ok.
I've ran it on my own system, and it just works (on XP with Sp2) and
I named the file test.vbs

It might be a version problem but that sounds very rare. What's your OS?
Do you run specific anti-virus tools, that disable or cripple script?

IN addition, the error code you show us, is 800401e$.
I don't swear, but I'm sure this code is not shown by VBScript normally.
It looks like not CScript.exe or WScript.exe is running your vbs file but
something else that has replaced it.

Can you show us through regedit what is listed below
HKEY_CLASSES_ROOT\VBSFile\Shell\Open
and
HKEY_CLASSES_ROOT\VBSFile\Shell\Open2
rich - 29 Dec 2005 15:16 GMT
Hello,

I am running XP/SP2.  Other scripts are working.  When I run "cscript" from
a command line, it reports WSH v5.6.  We run Symantec anti-virus Corp. Ed.
v8.0.x.  Confirm that the error code I get is:  800401E4.  There is no "$".

Thanks,
Rich

> > Oops,
> >
[quoted text clipped - 18 lines]
> and
> HKEY_CLASSES_ROOT\VBSFile\Shell\Open2
rich - 29 Dec 2005 20:12 GMT
> > Oops,
> >
[quoted text clipped - 18 lines]
> and
> HKEY_CLASSES_ROOT\VBSFile\Shell\Open2

Sorry, forgot to include the registry info:
..\Shell\Command\Open:  %systemroot%\system32\wscript.exe %1 %

..\shell\Command\Open2: %systemroot%\system32\cscript.exe %1 %
Egbert Nierop (MVP for IIS) - 30 Dec 2005 08:30 GMT
>> IN addition, the error code you show us, is 800401e$.
>> I don't swear, but I'm sure this code is not shown by VBScript normally.
[quoted text clipped - 10 lines]
>
> ..\shell\Command\Open2: %systemroot%\system32\cscript.exe %1 %

ok, all looks ok.
Just try just once, to disable your virustools and try your code again.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2010 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.