I want to start and stop application pool in IIS using powershell script. I had try to write the script but i didn't get this.
相关问题
- Generic Generics in Managed C++
- How to Debug/Register a Permanent WMI Event Which
- 'System.Threading.ThreadAbortException' in
- Bulk update SQL Server C#
- How can I do variable substitution in a here-strin
You have to import the
WebAdministration
module using Import-Module and then you can use Start-WebAppPool and Stop-WebAppPoolThese days the IISAdminstration module has mostly superceded WebAdministration. So if you're on Windows 10 / Server 2016, you can use Get-IISAppPool:
You can use this
if your use (PowerShell 2.0) import WebAdministration module
Please check the state of the application pool before. If the application pool is already stopped you get an exception.
Stop application pool:
Start application pool:
Permissions: You have to be a member of the "IIS Admins" group.
You can stop and stop all application pools respectively using the following powershell script. The second line below elevates permissions. You could exclude this and just run as administrator.
Stop all application pools script
Start all application pools script
To stop an App Pool using PowerShell use
And to start the App Pool
You will need the
WebAdministration
module installed so check you have it with this command