Error Numbers, VBScript

Hello everyone,

I'm writing a small VBScript that will check in IIS if a given Virtual
Directory exists on the WebSite with lowest site id (weird :) ) and if it
exists will delete it.

Now on to the problem #1:
In order to check if vdir exists i do:
On Error Resume Next
.... blah blah blah...
Set objVDir = objService.GetObject("IISWebVirtualDir", "MyVDir")
if Err.Number <> 0 then
....
end if

I'd like to be able to display a MsgBox if an error occurred retrieving the
VDir obj, BUT NOT if the VDir does not exist... So the question is: Where
can I find the error values in order to check this???

TIA
Paolo
Paolo [ Mi, 09 April 2008 10:43 ] [ ID #1938940 ]

Re: Error Numbers, VBScript

WScript.Echo Err.Number

will give you the error numbers/values. Just test each of the circumstances
you outline so that you know what numbers of check in your code.

Cheers
Ken

--
My IIS blog: http://adopenstatic.com/blog

"paolo" <paolobitech [at] newsgroup.nospam> wrote in message
news:eivBb4hmIHA.5080 [at] TK2MSFTNGP02.phx.gbl...
> Hello everyone,
>
> I'm writing a small VBScript that will check in IIS if a given Virtual
> Directory exists on the WebSite with lowest site id (weird :) ) and if it
> exists will delete it.
>
> Now on to the problem #1:
> In order to check if vdir exists i do:
> On Error Resume Next
> ... blah blah blah...
> Set objVDir = objService.GetObject("IISWebVirtualDir", "MyVDir")
> if Err.Number <> 0 then
> ...
> end if
>
> I'd like to be able to display a MsgBox if an error occurred retrieving
> the VDir obj, BUT NOT if the VDir does not exist... So the question is:
> Where can I find the error values in order to check this???
>
> TIA
> Paolo
>
Ken Schaefer [ Do, 10 April 2008 01:30 ] [ ID #1939603 ]

Re: Error Numbers, VBScript

> WScript.Echo Err.Number
>
> will give you the error numbers/values. Just test each of the
> circumstances you outline so that you know what numbers of check in your
> code.
>
> Cheers
> Ken

Thanx Ken, i will do like that

Cheers
Paolo
Paolo [ Do, 10 April 2008 18:08 ] [ ID #1939623 ]
Webserver » microsoft.public.inetserver.iis » Error Numbers, VBScript

Vorheriges Thema: ODBC Logging - IIS 6
Nächstes Thema: occasional "The connection cannot be used to perform this operation. It is either closed or inv