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

  • SEARCH
  • Home
  • 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 7749905
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 1, 20262026-06-01T11:09:10+00:00 2026-06-01T11:09:10+00:00

The following vbscript worked fine on XP computers but is not working on Windows

  • 0

The following vbscript worked fine on XP computers but is not working on Windows 7 computers.

Set objIISRoot = getObject("IIS://localhost/W3SVC/1/Root")

mstrIISRootPath = objIISRoot.Path

' yadda yadda yadda...more stuff goes on..

Set objIISRoot = nothing

“objIISRoot” is null so referencing objIISRoot.Path throws an error. How do you get at the default web in IIS on Windows 7?

  • 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-06-01T11:09:11+00:00Added an answer on June 1, 2026 at 11:09 am

    Windows7 removed the WMI-based administrative programming interface that allows you to do getObject("iis://localhost...")

    you have a couple options:

    • If you are building for IIS7, it may be easier to invoke Appcmd.exe from within script, and then parse the output. I found that command-line tool to be more intuitive and very powerful. This is an example of doing it from within Javascript:
        
        function RunAppCmd(command, deleteOutput) {
            deleteOutput = deleteOutput || false;
            LogMessage("RunAppCmd("+command+") ENTER");
            var shell = new ActiveXObject("WScript.Shell");
            var fso = new ActiveXObject("Scripting.FileSystemObject");
            var tmpdir = fso.GetSpecialFolder(SpecialFolders.TemporaryFolder);
            var tmpFileName = fso.BuildPath(tmpdir, fso.GetTempName());
            var windir = fso.GetSpecialFolder(SpecialFolders.WindowsFolder);
            var appcmd = fso.BuildPath(windir,"system32\\inetsrv\\appcmd.exe") + " " + command;
    
            LogMessage("shell.Run("+appcmd+")");
    
            // use cmd.exe to redirect the output
            var rc = shell.Run("%comspec% /c " + appcmd + "> " + tmpFileName, WindowStyle.Hidden, true);
            LogMessage("shell.Run rc = "  + rc);
    
            if (deleteOutput) {
                fso.DeleteFile(tmpFileName);
            }
            return {
                rc : rc,
                outputfile : (deleteOutput) ? null : tmpFileName
            };
        }
    

    I guess the VBScript would be pretty similar.

    • On the other hand if you are building this thing for both XP and Win7, then you will need to stay with the COM monikers. To allow this on Win7 you need to install the IIS6 Management pack. Access it via Start...Run...optionalfeatures.exe and then turn on the WMI stuff.

    enter image description here

    After doing that your old WMI script will run.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following VBScript: SET Wmi = GetObject(winmgmts:\\.\root\cimv2) SET QR = Wmi.ExecQuery(SELECT *
I have the following VBScript code: Dim returnVal returnVal = You did not pass
I have the following VBScript in a reusable action: 'Gather links Browser(1).Navigate http://InternalWebmail/something/inbox.nsf set
Running the following vbscript to call svnadmin dump fails (i.e. no dump is being
Following command will let me know the names of databases. $ mysqlshow But how
i did the following vbscript code to write a text file called level.txt in
i created a text file list.txt in commonapplicationdatafolder by using the following VBscript.i am
Consider the following VBScript which, when run, lists all the files in the current
I am working on a code base which as VBScript code embedded in HTML.
Just wondering if anyone would be able to help with the following VBScript script

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.