This particular setting is not clearly shown in the logFile
object. It is a combination of settings. Property period
should have a value of MaxSize
and truncateSize
should have the maximum allowable value for that field.
$test = Get-ItemProperty "IIS:SitesDefault Web Site"
# returns True for Do not create new log files option
$test.logFile.truncateSize -eq 4gb-1 -and $test.logFile.period -eq 'MaxSize'
Note that my instance's maximum allowable log size is 4GB. Due to rounding, I could not solely rely on the 4gb
output from PowerShell. One byte needed to be subtracted from the value. You can configure the settings for the required scenario using the following:
Set-ItemProperty 'IIS:SitesDefault Web Site' -Name logFile.period -value 'MaxSize'
Set-ItemProperty 'IIS:SitesDefault Web Site' -Name logFile.truncateSize -value $(4gb-1)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…