How to Get IIS logging Directory/Path using Poweshell


To get the IIS web sites log paths .below is sample PowerShell snippet.

Import-Module WebAdministration

$webistes=get-website

foreach($WebSite in $webistes)

{

$logFile="$($Website.logFile.directory)\w3scv$($website.id)".replace("%SystemDrive%",$env:SystemDrive)

Write-host "$($WebSite.name) [$logfile]"

}

Crediting this snippet to stack over flow site for this.

Regards,

Chaitanya

Leave a comment

Design a site like this with WordPress.com
Get started