Skip to main content

Export-PDHostedSPF

SYNOPSIS

Exports Hosted SPF (PowerSPF) configuration to one JSON file per domain.

SYNTAX

Export-PDHostedSPF [[-DomainId] <Int32[]>] [-All] -Path <String> [-EnabledOnly] [-Depth <Int32>]
[-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Calls Get-PDHostedSPF for each domain ID and writes every returned record to its own JSON file under -Path, named after the domain. Modeled after the per-object JSON export pattern used by Microsoft's EntraExporter (https://github.com/microsoft/EntraExporter): one file per object rather than one combined dump, with a guard against exceeding the Windows 260-character MAX_PATH.

EXAMPLES

EXAMPLE 1

Export-PDHostedSPF -DomainId 12345 -Path C:\Export

EXAMPLE 2

Export-PDHostedSPF -Path C:\Export -EnabledOnly
# Exports every domain under the selected account (Reseller mode requires an AccountId
# via Select-PDAccount or Connect-PowerDMARC -AccountId).

EXAMPLE 3

Export-PDHostedSPF -All -Path C:\Export -EnabledOnly
# Exports every domain across every customer account (Reseller mode).

EXAMPLE 4

Get-PDDomain | Export-PDHostedSPF -Path C:\Export -EnabledOnly

PARAMETERS

-DomainId

The PowerDMARC domain ID(s) to export. Accepts pipeline input, including by property name (e.g. piped from Get-PDDomain). If omitted (and nothing is piped in), every domain visible to Get-PDDomain is enumerated and exported -- in Reseller mode that means the selected account only, unless -All is also used.

Type: Int32[]
Parameter Sets: (All)
Aliases: Id

Required: False
Position: 1
Default value: None
Accept pipeline input: True (ByPropertyName, ByValue)
Accept wildcard characters: False

-All

Reseller mode only. Passed through to Get-PDDomain: exports domains across every customer account instead of just the selected one. Ignored if -DomainId is also given.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Path

Directory to write the exported JSON files to. Created if it doesn't already exist.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-EnabledOnly

Only export entries where is_enabled is true. Passed through to Get-PDHostedSPF.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-Depth

JSON serialization depth passed to ConvertTo-Json. Defaults to 10.

Type: Int32
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: 10
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

Fill ProgressAction Description

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

OUTPUTS

System.IO.FileInfo

NOTES

https://github.com/microsoft/EntraExporter