Posted in
Windows Powershell |
No Comment | 1,394 views | 04/05/2015 17:23
These are IIS Website Logging properties that you can get using CIM via PowerShell.
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
| # Get WebSites
$WebSites = Get-CimInstance -Namespace "root\MicrosoftIISv2" -ClassName "IIsWebServerSetting" -OperationTimeoutSec 15 -EA Stop
$WebSite = $WebSites[0];
# WebSite Log Information
[string]$WebSiteLogFormat = $WebSite.LogType
[string]$WebSiteLogDirectory = $WebSite.LogFileDirectory
[string]$WebSiteLogPeriod = $WebSite.LogFilePeriod
[string]$WebSiteLogTruncateSize = $WebSite.LogFileTruncateSize
[string]$WebSiteLogLocalTimeRollover = $WebSite.LogFileLocaltimeRollover
[string]$WebSiteLogState = $WebSite.DontLog
[string]$WebSiteLogExtFileBytesRecv = $WebSite.LogExtFileBytesRecv
[string]$WebSiteLogExtFileBytesSent = $WebSite.LogExtFileBytesSent
[string]$WebSiteLogExtFileClientIp = $WebSite.LogExtFileClientIp
[string]$WebSiteLogExtFileComputerName = $WebSite.LogExtFileComputerName
[string]$WebSiteLogExtFileCookie = $WebSite.LogExtFileCookie
[string]$WebSiteLogExtFileDate = $WebSite.LogExtFileDate
[string]$WebSiteLogExtFileFlags = $WebSite.LogExtFileFlags
[string]$WebSiteLogExtFileHost = $WebSite.LogExtFileHost
[string]$WebSiteLogExtFileHttpStatus = $WebSite.LogExtFileHttpStatus
[string]$WebSiteLogExtFileHttpSubStatus = $WebSite.LogExtFileHttpSubStatus
[string]$WebSiteLogExtFileMethod = $WebSite.LogExtFileMethod
[string]$WebSiteLogExtFileProtocolVersion = $WebSite.LogExtFileProtocolVersion
[string]$WebSiteLogExtFileReferer = $WebSite.LogExtFileReferer
[string]$WebSiteLogExtFileServerIp = $WebSite.LogExtFileServerIp
[string]$WebSiteLogExtFileServerPort = $WebSite.LogExtFileServerPort
[string]$WebSiteLogExtFileSiteName = $WebSite.LogExtFileSiteName
[string]$WebSiteLogExtFileTime = $WebSite.LogExtFileTime
[string]$WebSiteLogExtFileTimeTaken = $WebSite.LogExtFileTimeTaken
[string]$WebSiteLogExtFileUriQuery = $WebSite.LogExtFileUriQuery
[string]$WebSiteLogExtFileUriStem = $WebSite.LogExtFileUriStem
[string]$WebSiteLogExtFileUserAgent = $WebSite.LogExtFileUserAgent
[string]$WebSiteLogExtFileUserName = $WebSite.LogExtFileUserName
[string]$WebSiteLogExtFileWin32Status = $WebSite.LogExtFileWin32Status |
# Get WebSites
$WebSites = Get-CimInstance -Namespace "root\MicrosoftIISv2" -ClassName "IIsWebServerSetting" -OperationTimeoutSec 15 -EA Stop
$WebSite = $WebSites[0];
# WebSite Log Information
[string]$WebSiteLogFormat = $WebSite.LogType
[string]$WebSiteLogDirectory = $WebSite.LogFileDirectory
[string]$WebSiteLogPeriod = $WebSite.LogFilePeriod
[string]$WebSiteLogTruncateSize = $WebSite.LogFileTruncateSize
[string]$WebSiteLogLocalTimeRollover = $WebSite.LogFileLocaltimeRollover
[string]$WebSiteLogState = $WebSite.DontLog
[string]$WebSiteLogExtFileBytesRecv = $WebSite.LogExtFileBytesRecv
[string]$WebSiteLogExtFileBytesSent = $WebSite.LogExtFileBytesSent
[string]$WebSiteLogExtFileClientIp = $WebSite.LogExtFileClientIp
[string]$WebSiteLogExtFileComputerName = $WebSite.LogExtFileComputerName
[string]$WebSiteLogExtFileCookie = $WebSite.LogExtFileCookie
[string]$WebSiteLogExtFileDate = $WebSite.LogExtFileDate
[string]$WebSiteLogExtFileFlags = $WebSite.LogExtFileFlags
[string]$WebSiteLogExtFileHost = $WebSite.LogExtFileHost
[string]$WebSiteLogExtFileHttpStatus = $WebSite.LogExtFileHttpStatus
[string]$WebSiteLogExtFileHttpSubStatus = $WebSite.LogExtFileHttpSubStatus
[string]$WebSiteLogExtFileMethod = $WebSite.LogExtFileMethod
[string]$WebSiteLogExtFileProtocolVersion = $WebSite.LogExtFileProtocolVersion
[string]$WebSiteLogExtFileReferer = $WebSite.LogExtFileReferer
[string]$WebSiteLogExtFileServerIp = $WebSite.LogExtFileServerIp
[string]$WebSiteLogExtFileServerPort = $WebSite.LogExtFileServerPort
[string]$WebSiteLogExtFileSiteName = $WebSite.LogExtFileSiteName
[string]$WebSiteLogExtFileTime = $WebSite.LogExtFileTime
[string]$WebSiteLogExtFileTimeTaken = $WebSite.LogExtFileTimeTaken
[string]$WebSiteLogExtFileUriQuery = $WebSite.LogExtFileUriQuery
[string]$WebSiteLogExtFileUriStem = $WebSite.LogExtFileUriStem
[string]$WebSiteLogExtFileUserAgent = $WebSite.LogExtFileUserAgent
[string]$WebSiteLogExtFileUserName = $WebSite.LogExtFileUserName
[string]$WebSiteLogExtFileWin32Status = $WebSite.LogExtFileWin32Status
You can find more properties in my blog.