How can I get just the site name from the "AppCmd.exe list site" command?
Solution 1:
Got it:
appcmd list site /text:name
Gives you this:
MyCompany.MyProject.WebRole_IN_0_Web
The help describes how this works:
/text<:value> Generate output in text format (default).
/text:* shows all object properties in detail view.
/text:<attribute> shows the value of the specified
attribute for each object.
I worked out that name
was the correct attribute by calling:
appcmd list site /xml
Which returns in XML format (including attribute names):
<?xml version="1.0" encoding="UTF-8"?>
<appcmd>
<SITE SITE.NAME="MyCompany.MyProject.WebRole_IN_0_Web" SITE.ID="1273337555" bindi
gs="https/555.555.555.555:443:" state="Started" />
</appcmd>
Solution 2:
If you are looking to configure the site/application pool using an AppCmd startup task, check out my recent post about this:
http://mvolo.com/configure-iis-websites-windows-azure-startup-tasks-appcmd/
This covers how to find the site/application pool to edit, and also how to run the task AFTER the site/apppool configuration is created and not before.
Hope this helps.