PowerShell Sript设置IIS环境变量 [英] PowerShell sript to set IIS environment variable
本文介绍了PowerShell Sript设置IIS环境变量的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何使用PowerShell自动执行以下步骤?:
How can I automate the following steps by using PowerShell? :
- 转到IIS并选择一个网站(该网站名称很可能作为参数传递给脚本)
- 进入配置编辑器
- 在下拉菜单中选择aspNetCore部分
- 进入环境变量
- 添加新收藏
- 创建新的环境变量
推荐答案
感谢Lex Li,似乎配置编辑器在保存之前会自动生成脚本.这使我获得了最终的PS脚本:
Thanks to Lex Li, Seems like Configuration Editor generates scripts automatically before savings. This has lead me to getting the final PS script to be:
Add-WebConfigurationProperty -pspath 'MACHINE/WEBROOT/APPHOST/WEBSITENAME' -filter "system.webServer/aspNetCore/environmentVariables" -name "." -value @{name='EnvironmentVariableName';value='EnvironmentVariableValue'}
这篇关于PowerShell Sript设置IIS环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文