I have a script that uses appcmd to find sites using a particular vdir and iterates through them to find which ones are currently running

appcmd.exe list vdir /physicalPath:Z:\My\Path
:: save sites to array

:: foreach SiteName in array
appcmd.exe list site SiteName
:: hunt for "Started" in the output

but I would like to directly filter down to running sites using said virtual directory. I have expectations that there's a /parameter:value that does exactly that, but I can't seem to find a list of possible parameters.

  • Best would be arguments on the list vdir call that render the list site unnecessary.

  • Second best would be a filter on the list site call that removes the need to hunt for "Started"

  • If there is a (complete) list of appcmd parameters on MSDN, TechNet, or somewhere that proves this is not possible, that would also be helpful.

  • 1
    You should use PowerShell instead – Brock Hensley Aug 26 '13 at 21:40
  • Company policy restricts the languages we can use. :) The non-appcmd processing is actually Python. I'll take the PS recommendation under advisement, though. – Michael Aug 27 '13 at 14:13
  • PS ties directly into IIS with IIS-Module and would be silly to be ruled out IMHO as its MS->MS technology and in fact the Server Manager / IIS Manager just execute PowerShell cmdlets in the background :) PS has replaced appcmd. – Brock Hensley Aug 27 '13 at 14:38
  • @dirt - It is a misconception that IIS Manager uses PowerShell cmdlets under the hood. It uses the Web Administration API which is mostly COM. Appcmd, PowerShell and the GUI just use the API. You can still use the GUI without the PowerShell Provider for IIS installed. But I agree you should use the PowerShell provider over appcmd. Much more powerful. – Peter Hahndorf Aug 31 '13 at 7:07

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.