22
33## Get-ADFSEvents Overview
44
5- This script gathers ADFS related events from the security, admin, and debug logs into a single file ,
5+ This script gathers ADFS related events from the security, admin, and debug logs,
66and allows the user to reconstruct the HTTP request/response headers from the logs.
77
88Given a correlation id, the script will gather all events with the same identifier and reconstruct the request
@@ -11,31 +11,83 @@ all correlation ids and proceed to gather the events for each. If start and end
1111that fall into that span will be returned. The start and end times will be assumed to be base times. That is, all
1212time conversions will be based on the UTC of these values.
1313
14+ The output produced by Get-ADFSEvents is a list of objects with each containing the following properties:
15+
16+ 1 . CorrelationID
17+
18+ 2 . Events
19+
20+ 3 . Headers
21+
22+ The CorrelationID property contains a string representation of the correlation id that all events and headers within that object share.
23+
24+ The Events property contains a list of [ EventLogRecord] ( https://msdn.microsoft.com/en-us/library/system.diagnostics.eventing.reader.eventlogrecord )
25+ objects that share the particular correlation id.
26+
27+ The Headers property contains a list of objects, each composed of the following properties:
28+
29+ 1.QueryString
30+
31+ 2.ResponseString
32+
33+ 3.RequestHeader
34+
35+ 4.ResponseHeader
36+
37+ The QueryString property contains the HTTP verb (GET, POST, etc) and the corresponding query string.
38+
39+ The ResponseString property contains the HTTP response string (ex. 200 ok)
40+
41+ The RequestHeader property is a dictionary representing the various headers included in the HTTP request
42+
43+ The ResponseHeader property is a dictionary representing the various headers included in the HTTP response
44+
45+ As a final note, the output is, by default, merely dumped to the console to allow users to manipulate the objects returned.
46+ While this will likely prove sufficient for many users, those who desire future access to the output should use ``` Export-Clixml ```
47+ to write the output to an xml file. ``` Import-Clixml ``` can then be used to reconstruct the objects from the file. Examples of both are
48+ included in the Using Get-ADFSEvents section below.
49+
1450## Using Get-ADFSEvents
1551
16521 . Import the PowerShell Module
1753
18- In a PowerShell window, run the following:
54+ In a PowerShell window, run the following:
1955
20- ``` ipmo Get-ADFSEvents.psm1 ```
56+ ``` ipmo Get-ADFSEvents.psm1 ```
2157
22582 . Run Get-ADFSEvents
2359
2460EXAMPLE
2561
26- ``` Get-ADFSEvents -Logs Security, Admin, Debug -CorrelationID 669bced6-d6ae-4e69-889b-09ceb8db78c9 -Servers LocalHost, MyServer ```
62+ ``` Get-ADFSEvents -Logs Security, Admin, Debug -CorrelationID 669bced6-d6ae-4e69-889b-09ceb8db78c9 -Server LocalHost, MyServer ```
2763
2864EXAMPLE
2965
30- ``` Get-ADFSEvents -Logs Admin -AllWithHeaders -Servers LocalHost ```
66+ ``` Get-ADFSEvents -Logs Admin -AllWithHeaders -Server LocalHost ```
3167
3268EXAMPLE
3369
34- ``` Get-ADFSEvents -Logs Debug, Security -AllWithoutHeaders -Servers LocalHost, Server1, Server2 ```
70+ ``` Get-ADFSEvents -Logs Debug, Security -AllWithoutHeaders -Server LocalHost, Server1, Server2 ```
71+
72+ EXAMPLE
73+
74+ ``` Get-ADFSEvents -Logs Debug -StartTime (Get-Date -Date "1970-01-01 00:00:00Z") -EndTime (Get-Date) -Server localhost ```
75+
76+ EXAMPLE
77+
78+ ``` $Result = Get-ADFSEvents -Logs Admin -AllWithHeaders -Server LocalHost ```
79+
80+ ``` $CorrelationID = $Result[0].CorrelationID #Obtain correlation id for first entry in output ```
81+
82+ ``` $Events = $Result[0].Events #List of EventLogRecord objects ```
83+
84+ ``` $QueryString = $Result[0].Headers[0].QueryString #Query String for first header in list ```
85+
86+ EXAMPLE
3587
36- Example
88+ ``` Get-ADFSEvents -Logs Security, Admin, Debug -AllWithHeaders -Server localhost | Export-Clixml "output.xml" #Store output in file ```
3789
38- ``` Get-ADFSEvents -Logs Debug -StartTime $start -EndTime $End -server localhost ```
90+ ``` $ReconstructedOutput = Import-Clixml output.xml #Rebuild objects from xml file ```
3991
4092## Get-ADFSEvents Parameters
4193
0 commit comments