Add-Type -AssemblyName System.Web import-module webadministration $ip = (gwmi Win32_NetworkAdapterConfiguration -Filter "IPEnabled=‘true‘" | ? {$_.DefaultIPGateway -ne $null}).IPAddress[0] #导出所有站点的IISLog目录列表到IISLog.htm文件 $html = Get-Website|Select @{Label="Website";Expression={$_.Name}}, @{Label="IIS Log";Expression={‘<a href="http://‘ + $ip + ":11000/W3SVC" + $_.id + ‘">‘ + "http://" + $ip + ":11000/W3SVC" + $_.id + ‘</a>‘}} |sort Website |ConvertTo-Html $html = $html | % { if($_ -match ‘a href‘ ) { [System.Web.HttpUtility]::HtmlDecode($_) } else { $_ } } $html |out-file d:\iislog\IISLog.htm -Force #导出IISLog站点下的虚拟目录列表到APPLog.htm文件 $html_app = Get-WebVirtualDirectory -site "IISLog" |Select @{Label="LogName";Expression={($_.path).replace("/","")}}, @{Label="Log";Expression={‘<a href="http://‘ + $ip + ":11000" + $_.path + ‘">‘ + "http://" + $ip + ":11000" + $_.path + ‘</a>‘}} |sort LogName |ConvertTo-Html $html_app = $html_app | % { if($_ -match ‘a href‘ ) { [System.Web.HttpUtility]::HtmlDecode($_) } else { $_ } } $html_app |out-file d:\iislog\APPLog.htm -Force
IISlog
APPLog
时间: 2024-12-29 12:47:38