Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 992813
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T06:19:31+00:00 2026-05-16T06:19:31+00:00

I have some vbscript code I use to set paths to virtual directories when

  • 0

I have some vbscript code I use to set paths to virtual directories when a developer switches his/her environment to work on another project. Currently, we try to set the path, and if there’s an error, we create it. It just smells funny. Is there a way to check if a Virtual Directory exists? And if not, create it?

set objIIS = GetObject("IIS://" & strComputer & "/W3SVC/1/ROOT/SomeWeb")
objIIS.Path = strNewPath & "\SomeWeb"
objIIS.SetInfo

If Err.Number =  NOT_FOUND Then
    sVirtPath = strNewPath & "\SomeWeb"
CreateVirtualDirectory "SomeWeb", sVirtPath, true
Err.Clear
End If

This works just fine, but something tells me, there must be a better way. Does anyone have any suggestions? How do I check for the existence of a Virtual Directory? Any feedback is appreciated.

Thanks for any pointers.
Cheers,
~ck in San Diego

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T06:19:32+00:00Added an answer on May 16, 2026 at 6:19 am

    Your approach seems fine. Here is a slightly different approach I did years ago when working with IIS 5.0. I’m not sure if it would still work under later versions of IIS, but you may find it useful.

    Function IsExistingWebApp(strAppPath)
        Dim oWeb
    
        On Error Resume Next
    
        ' Assume it does not exist
        IsExistingWebApp = False
    
        Set oWeb = GetObject( strAppPath )
        If ( Err <> 0 ) Then
            ' If an error occurs then we know the application does not exist
            'LogMessage strAppPath & " does not exist as an application."
    
            Err = 0
            Exit Function
        Else
            If oWeb.Class = "IIsWebVirtualDir" Then
            'LogMessage "Found existing web application " & oWeb.AdsPath
            ' If it does exist and it is configured as a 
            ' virtual directory then rerturn true
            IsExistingWebApp = True
            End If      
        End If  
    End Function
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 524k
  • Answers 523k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer The difference is important with PODs (basically, all built-in types… May 16, 2026 at 9:47 pm
  • Editorial Team
    Editorial Team added an answer You can use a look-ahead assertion: /^(?:([a-zA-Z0-9-().&@?"#,+'\s\/])(?!\1\1)){7,}$/ Here the negated… May 16, 2026 at 9:47 pm
  • Editorial Team
    Editorial Team added an answer The simplest way is to just store it in your… May 16, 2026 at 9:47 pm

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

Related Questions

I'm about to have to deal with some SQL code in classic ASP VBScript.
I have just redeveloped some vbscript in to c#.net and i have it working
We have just purchased some software that provides an API into our phone system
I have an interesting/annoying problem with some VBScripts running on Windows 2003 Server (they
Let's say I have some Classic ASP pages that produce all output via Response.Write.
I have a legacy ASP application which - at some point soon - needs
Some product serial numbers are of type varchar and have a letter indicating the
Have some audio and video files that users are to download, however depending on
I have a scenario setup where I need to test to see if the
I'm showing a modal dialog via window.showModalDialog(... which happens in a vbscript function (the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.