Search code examples
iisiis-7iis-7.5appcmd

How to display the physical path of a web application using appcmd.exe?


Please, observe:

PS C:\Dayforce\DayforceRTQA\150520_747\SharpTop> $a
C:\Program Files\IIS Express\appcmd.exe
PS C:\Dayforce\DayforceRTQA\150520_747\SharpTop> &$a list app "MyDayforce/" /text:*
APP
  path:"/"
  APP.NAME:"MyDayforce/"
  APPPOOL.NAME:"Clr4IntegratedAppPool"
  SITE.NAME:"MyDayforce"
  [application]
    path:"/"
    applicationPool:"Clr4IntegratedAppPool"
    enabledProtocols:"http"
    serviceAutoStartEnabled:"false"
    serviceAutoStartProvider:""
    preloadEnabled:"false"
    [virtualDirectoryDefaults]
      path:""
      physicalPath:""
      userName:""
      password:""
      logonMethod:"ClearText"
      allowSubDirConfig:"true"
    [virtualDirectory]
      path:"/"
      physicalPath:"C:\Dayforce\SharpTop\UI\MyWORKBits"
      userName:""
      password:""
      logonMethod:"ClearText"
      allowSubDirConfig:"true"
PS C:\Dayforce\DayforceRTQA\150520_747\SharpTop> &$a list app "MyDayforce/" /text:applicationPool
Clr4IntegratedAppPool
PS C:\Dayforce\DayforceRTQA\150520_747\SharpTop> &$a list app "MyDayforce/" /text:enabledProtocols
http
PS C:\Dayforce\DayforceRTQA\150520_747\SharpTop>

I have no idea how to display the value of physicalPath. Tried all kinds of variants - nothing works.

So, how do I fetch the physicalPath from the app object ?

P.S.

I know how to do it from the vdir object:

PS C:\Dayforce\DayforceRTQA\150520_747\SharpTop> &$a list vdir /app.name:"MyDayforce/" /text:physicalPath
C:\Dayforce\SharpTop\UI\MyWORKBits
PS C:\Dayforce\DayforceRTQA\150520_747\SharpTop>

But I have a specific interest in the app object in order to understand whether nested properties can be fetched using the /text flag.


Solution

  • Good afternoon mark!

    To display the physical path using only the app object you can reference it using the [path='string'] syntax. Using this you can reference all of the properties of the nested VirtualDirectory object.

    So for your example you would use the following command: &$a list app "MyDayforce/" /text:[path='/'].physicalPath

    Or more generally for default IIS installations

    C:\Windows\system32\inetsrv\appcmd.exe list app "Default Web Site/" /text:[path='/'].physicalPath