IIS 7 and Above
Configuration & Scripting
Physical Path Credentials with APPCMD
Last post Apr 27, 2009 12:20 PM by anilr
Apr 24, 2009 06:26 AM|hgerrit|LINK
After numerous searches on the web and on these forums I got an issue which I can't resolve. Maybe someone can help me out.
I managed to create sites apppools etc etc with APPCMD, but when I want to enter credentials for the physical path, I doesn't seem to be possible with appcmd.
IS there anyone who has come across the same issue?
Thnx in advance
Apr 24, 2009 10:12 AM|Rovastar|LINK
Ummh I haven't come across this yet but it doesn't appear possible. Maybe one of the IIS team can confirm this or if there is some undocumented feature in there.
Apr 24, 2009 02:41 PM|anilr|LINK
Depends on exactly what level you want to do it at, at the web-site level
%windir%\system32\inetsrv\appcmd.exe set site "My Site" -virtualDirectoryDefaults.userName:name -virtualDirectoryDefaults.password:password
Apr 25, 2009 03:45 PM|CarlosAg|LINK
The settings in the UI you are referring to can be set with something like the following, note that the quotes are quite hard to get right, and that Anil mentions, it really depends on where you want to do it.
The following example sets it for the /TestApp inside the site "Default Web Site" for its Root virtual directory (/)
appcmd.exe set config -section:system.applicationHost/sites "/[name='Default Web Site'].[path='/TestApp'].[path='/'].userName":"MyUser" "/[name='Default Web Site'].[path='/TestApp'].[path='/'].password":"MyPassword" /commit:apphost
Apr 27, 2009 03:06 AM|hgerrit|LINK
Your code worked perfectly. Because I already came across .virtualdirectory command, which I thought it was'nt for the root username and password I didnt' pay much attention to it.
CarlosAg, I didn't tried out your code, but I will keep this one archified.
Is'nt there any documentation available from MS? Appcmd is very complicated, imho.
Thank u very much for your time, it saved me alot of time trying.
Apr 27, 2009 12:20 PM|anilr|LINK
Actually, appcmd uses a pretty consistent syntax, and once you get used to it, the exact details on how to apply the syntax depends on the section in question which you can infer from the schema files in %windir%\system32\inetsrv\config\schema\ - to provide
the command, I (and probably Carlos) just looked at the schema and applied the standard appcmd syntax. Another option is of course to use ConfigEditor to generate appcmd scripts.