Save-HubContext

    2025-01-30

    Save-HubContext

    SYNOPSIS

    Save the current PSHubContext to a .json file at the path received

    SYNTAX

    Secure Password

    Save-HubContext -Path <string> -SecurePassword [-PSHubContext <PSHubContext>] [-Force]
     [<CommonParameters>]
    

    Password

    Save-HubContext -Path <string> [-PSHubContext <PSHubContext>] [-Password <string>] [-Force]
     [<CommonParameters>]
    

    ALIASES

    This cmdlet has the following aliases,

    DESCRIPTION

    Save the current PSHubContext to a .json file at the path received. If PSHubContext is provided, save this one to a .sjon file. If Force is provided, overwrite file if the path already exist. If SecurePassword is provided, prompt to user to enter a password to encrypt the .json file. If Password provided, encrypt the .json file with the password received.

    EXAMPLES

    EXAMPLE 1

    PS C:> Save-HubContext -Path "C:\PATH\TO\YOUR\FILE\file.json"

    Save the current PSHubContext.

    EXAMPLE 2

    PS C:> Save-HubContext -Path "C:\PATH\TO\YOUR\FILE\file.json" -Password "password"

    Save the current PSHubContext in a file protected by a password.

    EXAMPLE 3

    PS C:> $availCtxs = Get-HubContext; Save-HubContext -Path "C:\PATH\TO\YOUR\FILE\file.json" -PSHubContext $availCtxs[2] -SecurePassword

    Fetch all available contexts. Save the third PSHubContext in a file protected by a password who will be filled be a prompt.

    PARAMETERS

    -Force

    Overwrite the file if exist

    Type: System.Management.Automation.SwitchParameter
    DefaultValue: ''
    SupportsWildcards: false
    ParameterValue: []
    Aliases: []
    ParameterSets:
    - Name: (All)
      Position: Named
      IsRequired: false
      ValueFromPipeline: false
      ValueFromPipelineByPropertyName: false
      ValueFromRemainingArguments: false
    DontShow: false
    AcceptedValues: []
    HelpMessage: ''
    

    -Password

    Will encrypt the file with the clear password

    Type: System.String
    DefaultValue: ''
    SupportsWildcards: false
    ParameterValue: []
    Aliases: []
    ParameterSets:
    - Name: Password
      Position: Named
      IsRequired: false
      ValueFromPipeline: false
      ValueFromPipelineByPropertyName: false
      ValueFromRemainingArguments: false
    DontShow: false
    AcceptedValues: []
    HelpMessage: ''
    

    -Path

    Specifies the path of the file to save Hub context.

    Type: System.String
    DefaultValue: ''
    SupportsWildcards: false
    ParameterValue: []
    Aliases: []
    ParameterSets:
    - Name: (All)
      Position: Named
      IsRequired: true
      ValueFromPipeline: false
      ValueFromPipelineByPropertyName: false
      ValueFromRemainingArguments: false
    DontShow: false
    AcceptedValues: []
    HelpMessage: ''
    

    -PSHubContext

    Save Hub context to file.

    Type: Devolutions.Hub.PowerShell.Entities.PowerShell.PSHubContext
    DefaultValue: ''
    SupportsWildcards: false
    ParameterValue: []
    Aliases: []
    ParameterSets:
    - Name: (All)
      Position: Named
      IsRequired: false
      ValueFromPipeline: false
      ValueFromPipelineByPropertyName: false
      ValueFromRemainingArguments: false
    DontShow: false
    AcceptedValues: []
    HelpMessage: ''
    

    -SecurePassword

    Will prompt the password to encrypt the file with

    Type: System.Management.Automation.SwitchParameter
    DefaultValue: ''
    SupportsWildcards: false
    ParameterValue: []
    Aliases: []
    ParameterSets:
    - Name: Secure Password
      Position: Named
      IsRequired: true
      ValueFromPipeline: false
      ValueFromPipelineByPropertyName: false
      ValueFromRemainingArguments: false
    DontShow: false
    AcceptedValues: []
    HelpMessage: ''
    

    CommonParameters

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

    INPUTS

    OUTPUTS

    NOTES

    For more information, type "Get-Help Save-HubContext -detailed". For technical information, type "Get-Help Save-HubContext -full".