appcmd.exe set config -section:system.applicationHost
/sites /[name="Default Web Site"].[path='/'].applicationPool:"Test App Pool" /commit:apphost
returns:
ERROR ( message:Cannot find requested collection element. )
If I change Default Web Site to another site without spaces say Tester it works fine. I'll keep trying a few things and hopefully nut it out, otherwise I'll just use the site's id.
Update:
I was putting my double quotes around just the name not the whole parameter and it works fine now. Thanks for your help.