I'm having trouble writing a ConnectAs domain user account for embedded web applications in IIS. My target environment is MS Server 2012 R2 with IIS 8, however I see the same problems on Windows 7 with IIS 7.5.
For example, suppose I have a "Default Website". In doing so, I have "MainApplication". In doing so, I have another web application for "SubApplication".
I tried the suggestions found on other sites similar to the ones below with partial success: These first 2 statements work.
Set-WebConfigurationProperty "system.applicationHost/sites/site[@name='Default Web Site']/application[@path='/MainApplication']/virtualDirectory[@path='/']" -name "username" -value "mydomain\user"
Set-WebConfigurationProperty "system.applicationHost/sites/site[@name='Default Web Site']/application[@path='/MainApplication']/virtualDirectory[@path='/']" -name "password" -value "mypassword"
I cannot get the syntax for the following two statements:
Set-WebConfigurationProperty "system.applicationHost/sites/site[@name='Default Web Site']/application[@path='/MainApplication/SubApplication']/virtualDirectory[@path='/']" -name "username" -value "mydomain\user"
Set-WebConfigurationProperty "system.applicationHost/sites/site[@name='Default Web Site']/application[@path='/MainApplication/SubApplication']/virtualDirectory[@path='/']" -name "password" -value "mypassword"
In an ideal world, I could do something similar below to quickly make all web applications running under the same domain user account:
Get-WebApplication | ForEach-Object { $_ | Set-ItemProperty -Name "username" -Value "domain\user" }
Get-WebApplication | ForEach-Object { $_ | Set-ItemProperty -Name "password" -Value "passwordValue" }
or something like this:
Get-WebApplication | ForEach-Object { $_.ChildElements | Select-Object -First 1 | Get-Member -Name "Attributes" | Set-Member -Name "userName" -Value "domain\username" }
Is there a script way to install all sites, applications, etc. under the domain user account?
source
share