I am trying the following appcmd commnad:

appcmd list app /site.name:"misechko.com.ua-DEV" /xml | appcmd list vdir /in /text:physicalPath

misechko.com.ua-DEV is a correct site name in IIS. appcmd is registered in path;

I get the following error output when I am trying to execute a command in cmd.exe:

ERROR ( hresult:8007000d, message:The input contained an error element, which may indicate that the operationproducing the input has failed. )

What is the mistake in the app setup? I guess I am mixing a cmd and powershell approach, but the abocementioned script doesn't work in PowerShell either. A PowerShell way of getting the path by web site name is preferable.

P.S. My PowerShell alternative that also doesn't work:

$appCmd = "$Env:SystemRoot\system32\inetsrv\appcmd.exe"

$appcmd list app /site.name:"misechko.com.ua-DEV" /xml | $appcmd list vdir /in /text:physicalPath


2 Answers 2


Researched myself and found an solution:

     function GetPhysicalPath ([String]$siteName) {

        function Get-PipelineInput
            end {
                [xml]$appConfigXml = $input
                return $appConfigXml.application.virtualDirectory.physicalPath

        $appCmd = "$Env:SystemRoot\system32\inetsrv\appcmd.exe"  

        return & $appCmd list app /site.name:"$siteName" /config | Get-PipelineInput
  • Nice solution. Have to be careful though, since appcmd list app ... will return all virtual directories as siblings i.e. it will break the XML parser. If you're only interested in the root of the site, better to use "vdir" $appCmd list vdir "$siteName/" /config (note the trailing slash on site name), and then tweak the xml path to suit i.e. $appConfigXml.virtualDirectory.physicalPath Commented May 28, 2015 at 4:07

This also worked for me. running cmd as admin.

appcmd list app /site.name:"Default Web Site" /path:"/" /xml | appcmd list vdir /in /text:physicalPath


You must log in to answer this question.

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