简体   繁体   中英

How to get the “periodic restart recycle value” of an IIS Application Pool using Powershell

I am using Powershell 5.0.10586.117 with an IIS 7.5.

When running

Get-ItemProperty ($singleAppPool) -Name Recycling.periodicRestart.schedule.collection

I receive ie

DefaultAppPool
value          : 03:00:00
Attributes     : {Microsoft.IIs.PowerShell.Framework.ConfigurationAttribute}
ChildElements  : {}
ElementTagName : add
Methods        : 
Schema         : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema

However I only want to get the value . But

Get-ItemProperty ($singleAppPool) -Name Recycling.periodicRestart.schedule.collection 

fails with a "not found" error message.

How to be able to get value only here?

For the sake of being able to reproduce use

Import-Module WebAdministration

in the beginning.

If the command works per your example, you can get the value property like this:

(Get-ItemProperty ($singleAppPool) -Name Recycling.periodicRestart.schedule.collection).Value

I can't diagnose why you get a "not found" error message without you sharing the error or without knowing what is in $singleAppPool or if that is a valid item on your server.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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