Search code examples
iisiis-7.5iis-8appcmdiis-logs

appcmd to check a config exists?


I can run this command to add a custom log:

.\appcmd.exe set config -section:system.applicationHost/sites /+"[name='MyWebSite'].logFile.customFields.[logFieldName='OriginalIP',sourceName='X-FORWARDED-FOR',sourceType='RequestHeader']" /commit:apphost

What command to I use to see if that config has already been set? There is no appcmd.exe get config -section...


Solution

  • Try something like

    appcmd.exe list config -section:system.applicationHost/sites /text:*
    

    Depending on what you want to check for, you will have to parse the output.

    For more information, run

    appcmd.exe /? config