1

I am curious on how i would list out Web services, Web sites, and App Pools to a .txt file on a Windows Server 2003 machine. I have Powershell 2.0 configured and have been trying to run some scripts but nothing seems to work.

I've tried:

iisweb /query

and i get an error saying:

   - This script does not work with WScript
   - Would you like to register CScript as your default host for VBscript?
   - To run this script type: `"CScript.exe IIsCnfg.vbs[params]"`

I tried using CScript.exe IIsCnfg.vbs[params]"but even that command fails and errors out to anInput error: Can not find script file "C:\%SYSTEMROOT%\system32\iiscnfg.vbs`

Anyone have any experience with Windows Server 2003 and using Powershell with it? Version of Powershell is 2.0


@pk

Here is what it gives me as an error code. I also dont understand the parameters it wants me to give it.

PS U:> CSript.exe IIsCnfg.vsb /query

The term 'CSript.exe' is not recognized as the name of a cmdlet, function, script file, oroperable program. Check the spelling of the name, or if a path was 
included, verify that the path is correct and try again.
At line:1 char:11
            + CSript.exe <<<<  IIsCnfg.vsb /query
    + CategoryInfo          : ObjectNotFound: (CSript.exe:String) [], CommandN 
   otFoundException
    + FullyQualifiedErrorId : CommandNotFoundException
4
  • Is it really looking for C:\%SYSTEMROOT%\system32\iiscnfg.vbs? If so, that path doesn't exist. The %SYSTEMROOT% variable already contains the drive letter, so in effect it's looking for C:\C:\Windows\system32\iiscnfg.vbs.
    – pk.
    Jun 4, 2014 at 14:24
  • 1
    It's cscript, not csript (notice the c after cs) Jun 4, 2014 at 17:33
  • @MathiasR.Jessen : thank you! I ended up just accepting "Would you like to register CScript as your default host for VBscript?" and my /queries work. Would you perhaps know how to list application pools, and web services fromm IIS using Cscript?
    – user38725
    Jun 4, 2014 at 17:46
  • He's saying you wrote the wrong word, as in a typo. CSCRIPT IISWEB.VBS or IISAPP.VBS works fine.
    – TristanK
    Jun 6, 2014 at 3:43

1 Answer 1

0

With PowerShell 2.0 you can access all the configuration objects through WMI:

$appPools = Get-WmiObject -Namespace "root\MicrosoftIISv2" -Class IIsApplicationPool
$webSites = Get-WmiObject -Namespace "root\MicrosoftIISv2" -Class IIsWebServerSetting
$vDirs    = Get-WmiObject -Namespace "root\MicrosoftIISv2" -Class IIsWebVirtualDir

The "Name" property is always the full path to the object, ie. W3SVC/2 for a website with ID 2.

The full list of WMI classes provided by IIS in Windows Server 2003 SP1

1
  • Thank you! This worked perfectly, i just can format them to view the fields i want! :D Thanks!
    – user38725
    Jun 4, 2014 at 19:17

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .