Add-type-AssemblyName System.webimport-Module Webadministration$ip= (Gwmi Win32_NetworkAdapterConfiguration-Filter "ipenabled= ' true '"| ? {$_. DefaultIPGateway-ne $null}). Ipaddress[0]#Export the IISLog directory list of all sites to the iislog.htm file$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-fileD:\iislog\IISLog.htm- Force#Export the list of virtual directories under the IISLog site to the applog.htm file$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-fileD:\iislog\APPLog.htm-Force
IISLog
Applog
Export the IIS log list and export the list of virtual directories under the site