使用Powershell脚本回收应用程序池 [英] Recycle Application Pool using Powershell Script

查看:275
本文介绍了使用Powershell脚本回收应用程序池的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想使用一个可以在Powershell脚本中放入的内衬命令来回收我的应用程序池.我在powershell脚本中添加了以下代码:

I want to recycle my application pool using one liner command which I can put in my powershell script. I added the following code in my powershell script:

Import-Module WebAdministration

$site = "Default Web Site"

$pool = (Get-Item "IIS:\Sites\$site"| Select-Object applicationPool).applicationPool

Restart-WebAppPool $pool

但是我收到一个错误,指出名称IIS不存在.请指教

But I am getting an error that name IIS doesn't exist. Please advise

推荐答案

我喜欢答案简短而简单的事情,像这样...

I like when answers are short and simple, like this...

Restart-WebAppPool (Get-Website -Name <YourSiteName>).applicationPool

这篇关于使用Powershell脚本回收应用程序池的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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