简体   繁体   中英

Get the value of 'specific Times' array (IIS) from powershell

I am trying to retrieve the specific times values from IIS. But I get back some sort of reference to a configuration element.

This is for a Microsoft Internet Information Services (version 10.0.14393.0).

I tried

$itemsInIis = Get-ItemProperty -Path IIS:\AppPools\DefaultAppPool -Name recycling.periodicRestart.schedule.collection
Write-Host "Times present in IIS: [$itemsInIis]."

I get back Microsoft.IIs.PowerShell.Framework.ConfigurationElement instead of the actual values. How Should I do this to retrieve the times such as 00:00:00

NOt sure what I am missing here to retrieve the actual times inside the array.

You are getting back an array of ConfigurationElements, each of which has value of type TimeSpan . Try something like this:

$itemsInIis = (Get-ItemProperty -Path IIS:\AppPools\DefaultAppPool -Name recycling.periodicRestart.schedule.collection).value -F 'hhmmsss'
Write-Host "Times present in IIS: [$itemsInIis]."

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