IIS Server - Help!! Invalid Syntax in VBS script

This is Interesting: Free IT Magazines  
Home > Archive > IIS Server > December 2005 > Help!! Invalid Syntax in VBS script





You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

Author Help!! Invalid Syntax in VBS script
rich

2005-12-28, 6:10 pm

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\)

2005-12-28, 6:10 pm


"rich" <rich@discussions.microsoft.com> wrote in message
news:D4351A3B-771E-4EFC-9D29-FF0515851899@microsoft.com...
> 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
> 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


rich

2005-12-28, 6:10 pm

I am running the script on my desktop. It should get the various properties
from a remote IIS server.

--Rich

"Egbert Nierop (MVP for IIS)" wrote:

>
> "rich" <rich@discussions.microsoft.com> wrote in message
> news:D4351A3B-771E-4EFC-9D29-FF0515851899@microsoft.com...
>
> 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
>
>
>
>

rich

2005-12-28, 6:10 pm

Oops,

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

"Egbert Nierop (MVP for IIS)" wrote:

>
> "rich" <rich@discussions.microsoft.com> wrote in message
> news:D4351A3B-771E-4EFC-9D29-FF0515851899@microsoft.com...
>
> 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
>
>
>
>

Egbert Nierop \(MVP for IIS\)

2005-12-28, 6:10 pm


"rich" <rich@discussions.microsoft.com> wrote in message
news:244426F5-2109-4317-B70B-F640B0DB0080@microsoft.com...
> 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

2005-12-29, 6:04 pm

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

"Egbert Nierop (MVP for IIS)" wrote:

>
> "rich" <rich@discussions.microsoft.com> wrote in message
> news:244426F5-2109-4317-B70B-F640B0DB0080@microsoft.com...
>
> 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

2005-12-29, 6:04 pm



"Egbert Nierop (MVP for IIS)" wrote:

>
> "rich" <rich@discussions.microsoft.com> wrote in message
> news:244426F5-2109-4317-B70B-F640B0DB0080@microsoft.com...
>
> 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
>


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

...\shell\Command\Open2: %systemroot%\system32\cscript.exe %1 %
David Wang [Msft]

2005-12-30, 3:00 am

Sample code which shows how to retrieve various website properties from IIS,
both local and remote:
http://blogs.msdn.com/david.wang/ar...io
n.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 *

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

"rich" <rich@discussions.microsoft.com> wrote in message
news:57FE4FD1-A0D3-4707-B9DB-2D833D2D1BCD@microsoft.com...[vbcol=seagreen]
>I am running the script on my desktop. It should get the various
>properties
> from a remote IIS server.
>
> --Rich
>
> "Egbert Nierop (MVP for IIS)" wrote:
>



Egbert Nierop \(MVP for IIS\)

2005-12-30, 3:00 am


"rich" <rich@discussions.microsoft.com> wrote in message
news:1DF7CF38-71BF-4D7C-9541-93602E469838@microsoft.com...
>
>


>
> Sorry, forgot to include the registry info:
> ..\Shell\Command\Open: %systemroot%\system32\wscript.exe %1 %
>
> ..\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.

Sponsored Links






Free braindumps | Software forum | Database administration forum

Copyright 2003 - 2008 webservertalk.com