Skip to main content

Update-SessionEnvironmentVariables

SYNOPSISโ€‹

Updates the environment variables for the current PowerShell session with any environment variable changes that may have occurred during script execution.

SYNTAXโ€‹

Update-SessionEnvironmentVariables [-LoadLoggedOnUserEnvironmentVariables] [[-ContinueOnError] <Boolean>]
[<CommonParameters>]

DESCRIPTIONโ€‹

Environment variable changes that take place during script execution are not visible to the current PowerShell session.

Use this function to refresh the current PowerShell session with all environment variable settings.

EXAMPLESโ€‹

EXAMPLE 1โ€‹

Update-SessionEnvironmentVariables

PARAMETERSโ€‹

-LoadLoggedOnUserEnvironmentVariablesโ€‹

If script is running in SYSTEM context, this option allows loading environment variables from the active console user. If no console user exists but users are logged in, such as on terminal servers, then the first logged-in non-console user.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-ContinueOnErrorโ€‹

Continue if an error is encountered. Default is: $true.

Type: Boolean
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: True
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โ€‹

Noneโ€‹

You cannot pipe objects to this function.โ€‹

OUTPUTSโ€‹

None. This function does not return objects.โ€‹

NOTESโ€‹

This function has an alias: Refresh-SessionEnvironmentVariables

https://psappdeploytoolkit.com