简体   繁体   English

使用脚本将IIS站点物理路径凭据更改为Apppool Idenity

[英]changing IIS site physical path credentials to apppool idenity with a script

I have a webserver with many websites on it. 我有一个上面有很多网站的网络服务器。

They are currently using an administrator account for physical path credentials, which is less than ideal. 他们当前正在使用管理员帐户来获取物理路径凭据,这不理想。

I have added a user for every single site and set the appropriate permissions etc. I have also gone through and changed the app pool user for each application pool. 我为每个站点添加了一个用户,并设置了适当的权限等。我还仔细检查并更改了每个应用程序池的应用程序池用户。

What i need to do now is change the physical path credentials for every site to use the 'Application User'. 我现在需要做的是更改每个站点的物理路径凭据以使用“应用程序用户”。

I've used the following script before to change a specific sites credentials to a specific user, but not sure how this would change to become the application user... 我之前使用以下脚本将特定站点的凭据更改为特定用户,但是不确定如何更改为应用程序用户...

 appcmd set site "mywebsite.co.uk" -virtualDirectoryDefaults.userName:mywebsite_co_uk -virtualDirectoryDefaults.password:AbCdEfGh!1

Any help is greatly appriciated :) 任何帮助都非常感谢:)

If I understand correctly, it sounds like you have previously used "credentials" at the site level to connect to read the content, and now you are using application pool configured with isolated credentials (much better approach) and want to now set the sites to use that identity instead of the previously setup ones. 如果我理解正确,听起来您以前曾经在站点级别使用“凭据”来读取内容,而现在您正在使用配置了独立凭据的应用程序池(更好的方法),现在想将站点设置为使用该身份代替以前设置的身份。 To do that you just need to clear the credentials in the site that were there before, you can do that with the following appcmd.exe command line (this example is clearing the "default web site" so just change that as needed) 为此,您只需要清除以前存在的站点中的凭据,就可以使用以下appcmd.exe命令行进行此操作(此示例正在清除“默认网站”,因此只需根据需要进行更改即可)。

appcmd.exe clear config -section:system.applicationHost/sites /"[name='Default Web Site'].[path='/'].[path='/'].userName" /"[name='Default Web Site'].[path='/'].[path='/'].password" /commit:apphost

In your case above, it seems you were setting it in the "defaults" section (probably not the right thing, and should have set it at the root one instead), but to clear that one you need to use a command line like this: 在上述情况下,您似乎在“默认值”部分中进行了设置(可能不正确,应该将其设置为根目录),但是要清除该目录,您需要使用这样的命令行:

appcmd.exe clear config -section:system.applicationHost/sites /"[name='Default Web Site'].virtualDirectoryDefaults.userName" /"[name='Default Web Site'].virtualDirectoryDefaults.password" /commit:apphost

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM