Error Numbers, VBScript

Error Numbers, VBScript

am 09.04.2008 10:43:27 von Paolo

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

Re: Error Numbers, VBScript

am 10.04.2008 01:30:53 von Ken Schaefer

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" wrote in message
news:eivBb4hmIHA.5080@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
>

Re: Error Numbers, VBScript

am 10.04.2008 18:08:09 von Paolo

> 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