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[]>]
 [<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

-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

-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