Skip to content

Save-PodeState

SYNOPSIS

Saves the current shared state to a supplied JSON file.

SYNTAX

Save-PodeState [-Path] <String> [[-Scope] <String[]>] [[-Exclude] <String[]>] [[-Include] <String[]>]
 [[-Depth] <Int16>] [-Compress] [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

Saves the current shared state to a supplied JSON file. When using this function, it's recommended to wrap it in a Lock-PodeObject block.

EXAMPLES

EXAMPLE 1

Save-PodeState -Path './state.json'

EXAMPLE 2

Save-PodeState -Path './state.json' -Exclude Name1, Name2

EXAMPLE 3

Save-PodeState -Path './state.json' -Scope Users

PARAMETERS

-Compress

If supplied, the saved JSON will be compressed.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Depth

Saved JSON maximum depth. Will be passed to ConvertTo-JSON's -Depth parameter. Default is 10.

Type: Int16
Parameter Sets: (All)
Aliases:

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

-Exclude

An optional array of state object names to exclude from being saved. (This has a higher precedence than Include)

Type: String[]
Parameter Sets: (All)
Aliases:

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

-Include

An optional array of state object names to only include when being saved.

Type: String[]
Parameter Sets: (All)
Aliases:

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

-Path

The path to a JSON file which the current state will be saved to.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 1
Default value: None
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

-Scope

An optional array of scopes for state objects that should be saved. (This has a lower precedence than Exclude/Include)

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
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

NOTES