Share via


how to change physical path credentials (connect as) by PoweShell

Question

Tuesday, September 30, 2014 10:35 AM

I need to use the next code to change the physical path credentials  (connect as) shall you help me 

Get-Website | ForEach-Object {

    Set-WebConfigurationProperty ...

}

 

All replies (3)

Tuesday, October 7, 2014 4:39 AM âś…Answered

Hi,

As I know the configuration about physical path credentials exists in the applicationhost.config file.

<site name="Default Web Site" id="1" serverAutoStart="true">
                <application path="/" preloadEnabled="true">
                    <virtualDirectory path="/" physicalPath="%SystemDrive%\inetpub\wwwroot" userName="fareast\v-pesong" password="[enc:AesProvider:KC+sbrB2la3PDARq/Nd0RAjbn5l17HdN8zxjlq1+8KazwEyLr04sI4Q2laodZ54c:enc]" />
                    <virtualDirectory path="/testVD" physicalPath="C:\inetpub\wwwroot" />
                   
                </application>

ANd have a try:

set-webconfigurationproperty "system.applicationHost/sites/site[@name='Default Web Site']/application[@path='/']/virtualDirectory[@path='/']" -name username -vaule 'test'

And as a workaround:

http://blog.thejohnreynolds.com/post/10149304231/set-iis-physical-path-credentials-with-powershell


Tuesday, September 30, 2014 12:34 PM

You could give this a try and see if it would work for you (change the site name and application name):         

Set-WebConfiguration "/system.applicationHost/sites/site[@name='Default Web Site' and @id='1']/application[@path='/TestApp1']/VirtualDirectory[@path='/']" -Value @{userName='matt';password=123}


Tuesday, September 30, 2014 1:01 PM

Thanks for you support i tried this before but didn't work 

all i know that there is one file contain this confgs 

C:\Windows\System32\inetsrv\config\redirection.onfig

how can change the line :

<configurationRedirection enabled="true" path="\clfs-xw12-2342\idscroot2342\IIS-Sheard-Configuration" userName="[email protected]" password="[enc:IISRsaProvider:DAEAAAECAAADZgAAAKQAACpKlQq3m9WK7jiFVT/+LNEZoJ7MRe49lVGJyKJcCY3txI4rdlVb/2+mnkAhd9Gb7G580Mt+9QZBPndiBPczB8PfY1Ln1mpyR4MpsL/bhSPoh7FjGcUjhFPedyCOiKaNLlhwQ2unoOndgSK5pFfsy1jf4iBQQOfYBObIaCopawIIHnR9Jr5qcDsS8wKzVupSaeOSI/LjcJIKqYtsmf4sPfIQ5uXSI1rh4eQsdfKZPbWQn+bFHDduYrNIsxP15ESG0dtQ4NJ6suuun2KlgMTjkURTzpk9MlWyuRuMrb+i+zdBDTcz8i4tcyUo6l6qez57Kfll0awHsBYwdkomRB6k4IutuGLIRmzS53iXoFQjlmT3sE2kxeS1iCu/aFDqN2YDKw==:enc]" />

to make it <configurationRedirection />

then IIS will create it back