我使用 Powershell 5.0.10586.117 和 IIS 7.5。
运行时
Get-ItemProperty ($singleAppPool) -Name Recycling.periodicRestart.schedule.collection
我收到即
DefaultAppPool
value : 03:00:00
Attributes : {Microsoft.IIs.PowerShell.Framework.ConfigurationAttribute}
ChildElements : {}
ElementTagName : add
Methods :
Schema : Microsoft.IIs.PowerShell.Framework.ConfigurationElementSchema
但是我只想获得值。但是
Get-ItemProperty ($singleAppPool) -Name Recycling.periodicRestart.schedule.collection
失败并显示“未找到”错误消息。
如何才能仅在这里获得值(value)?
为了能够重现使用
Import-Module WebAdministration
一开始。
最佳答案
如果该命令适用于您的示例,您可以获得如下所示的 value 属性:
(Get-ItemProperty ($singleAppPool) -Name Recycling.periodicRestart.schedule.collection).Value
如果您不分享错误或不知道 $singleAppPool 中的内容或该项目在您的服务器上是否有效,我无法诊断您为何收到“未找到”错误消息。
关于powershell - 如何使用Powershell获取IIS应用程序池的 "periodic restart recycle value",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42855582/