I'm using appcmd to create a new virtual directory in IIS8. The syntax for this is:
appcmd add vdir /app.name:<NAME> /path:<PATH> /physicalPath:<PHYSICAL-PATH>
This works fine. Now I need to set some credentials; this is easy in the GUI (virtual dir > basic settings > connect as). When I set this, I can see in my applicationHost.config file that it is updating an XML entry. So I should be able to set that manually with appcmd. I'm struggling with the syntax to navigate to the right XML element so I can set the attribute userName and add the attribute password.
Here is my XML:
<sites>
  <site name="EXAMPLESITE" id="4">
    <application path="/" applicationPool="EXAMPLEPOOL">
        <virtualDirectory path="/" physicalPath="c:\wwwroot\" userName="" />
        <virtualDirectory path="/upload" physicalPath="\\SOME-COMPUTER-ON-NETWORK\upload" userName="" />
    </application>
    <bindings>
        <binding protocol="http" bindingInformation="*:80" />
    </bindings>
  </site>
</sites>
                This should work:
appcmd set vdir /vdir.name:"EXAMPLESITE/upload" /userName:user /password:password
                        If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With