如何使用PowerShell在IIS中停止和启动各个网站? [英] How can I stop and start individual websites in IIS using PowerShell?

查看:770
本文介绍了如何使用PowerShell在IIS中停止和启动各个网站?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在Windows 7开发计算机上的IIS7中配置了多个站点,以便在同一端口上运行,并且通常一次只运行一个,具体取决于我正在处理的内容。我希望能够从PowerShell启动和停止我的开发站点,而不是打开IIS管理器。有没有人有一个很好的资源指出我正确的方向或已经完成这个的脚本?

I have multiple sites configured in IIS7 on my Windows 7 development machine to run on the same port and usually only run one at a time depending on what I'm working on. I would like to be able to start and stop my development sites from PowerShell instead of having the IIS manager opened. Does anyone have a good resource to point me in the right direction or a script that already accomplishes this?

推荐答案

为了将来的快速参考,命令是:

Just for future quick reference, the commands are:

Import-Module WebAdministration
Stop-WebSite 'Default Web Site'
Start-WebSite 'Default Web Site'

这篇关于如何使用PowerShell在IIS中停止和启动各个网站?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆