我试图从IIS中检索特定的时间值。但我得到了一些配置元素的引用。
这适用于Microsoft Internet信息服务(版本10.0.14393.0)。
我试过了
$itemsInIis = Get-ItemProperty -Path IIS:\AppPools\DefaultAppPool -Name recycling.periodicRestart.schedule.collection
Write-Host "Times present in IIS: [$itemsInIis]."
我得到Microsoft.IIs.PowerShell.Framework.ConfigurationElement
而不是实际值。我该怎么做才能检索00:00:00之类的时间
不知道我在这里缺少什么来检索数组内的实际时间。
您将获得一组ConfigurationElements,每个ConfigurationElements都有value
类型的TimeSpan
。尝试这样的事情:
$itemsInIis = (Get-ItemProperty -Path IIS:\AppPools\DefaultAppPool -Name recycling.periodicRestart.schedule.collection).value -F 'hhmmsss'
Write-Host "Times present in IIS: [$itemsInIis]."