Public/Export-AdfsDiagnosticsFile.ps1

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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<#
.SYNOPSIS
Gathers and exports diagnostic data into a file. This cmdlet is used with the Diagnostics Analyzer Tool on
the AD FS Help website (https://adfshelp.microsoft.com/DiagnosticsAnalyzer).
 
.DESCRIPTION
The Export-AdfsDiagnosticsFile cmdlet gathers diagnostic data from the current AD FS server and exports the diagnostic file
required for the AD FS Help Diagnostic Analyzer. This cmdlet works on AD FS 2.0 and later.
 
.PARAMETER FilePath
String parameter that specifies the location of the exported file. By default, a file will be created in the current folder.
 
.PARAMETER VerifyTrustCerts
Boolean parameter that will enable additional checks for relying party trust and claims provider trust certificates. It is false by default.
 
.PARAMETER SslThumbprint
String parameter that corresponds to the thumbprint of the AD FS SSL certificate. This is required for running test cases on proxy servers.
 
.PARAMETER AdfsServers
Array of fully qualified domain names (FQDN) of all of the AD FS STS servers that you want to run health checks on. For Windows Server 2016 this is automatically populated using Get-AdfsFarmInformation.
By default the tests are already run on the local machine, so it is not necessary include the FQDN of the current machine in this parameter.
 
.PARAMETER Local
Switch that indicates that you only want to run the health checks on the local machine. This takes precedence over -AdfsServers parameter.
 
.EXAMPLE
Export-AdfsDiagnosticsFile -verifyTrustCerts:$true
Export a diagnostic file of an AD FS Farm and examine the relying party trust and claims provider trust certificates.
 
.EXAMPLE
Export-AdfsDiagnosticsFile -adfsServers @("sts1.contoso.com", "sts2.contoso.com", "sts3.contoso.com")
Export a diagnostic file of an AD FS farm by running checks on the following servers: sts1.contoso.com, sts2.contoso.com, sts3.contoso.com. This automatically runs the test on the local machine as well.
 
.EXAMPLE
Export-AdfsDiagnosticsFile -sslThumbprint ‎c1994504c91dfef663b5ce8dd22d1a44748a6e16
Export a diagnostic file of a WAP server and utilize the provided thumbprint to check SSL bindings.
#>



# the final output format is as follows (in JSON):
# diagnosticData:
# { module1: { cmdlet1.1: results, cmdlet1.2: results, ...},
# module2: { cmdlet2.1: results, ...}
# ...
# }
# where results will be the desired output or an exception message.
Function Export-AdfsDiagnosticsFile()
{
    # aggregate parameters for all cmdlets
    [CmdletBinding()]
    Param
    (
        [string]    $filePath = $null,
        [switch]    $includeTrusts = $false,
        [string]    $sslThumbprint = $null,
        [string[]]  $adfsServers = $null,
        [switch]    $local = $null
    )

    Write-DeprecationNotice
}