Remove-ADTEnvironmentVariable
SYNOPSIS
Removes the specified environment variable.
SYNTAX
Remove-ADTEnvironmentVariable [-Variable] <String> [[-Target] <EnvironmentVariableTarget>] [-WhatIf] [-Confirm]
[<CommonParameters>]
DESCRIPTION
The Remove-ADTEnvironmentVariable function removes the specified environment variable.
EXAMPLES
EXAMPLE 1
Remove-ADTEnvironmentVariable -Variable Path
Removes the Path environment variable.
EXAMPLE 2
Remove-ADTEnvironmentVariable -Variable Path -Target Machine
Removes the Path environment variable for the machine.
PARAMETERS
-Variable
The variable to remove.
Type: String
Parameter Sets: (All)
Aliases:
Required: True
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Target
The target of the variable to remove. This can be the machine, user, or process.
Type: EnvironmentVariableTarget
Parameter Sets: (All)
Aliases:
Accepted values: Process, User, Machine
Required: False
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-WhatIf
Shows what would happen if the cmdlet runs. The cmdlet is not run.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-Confirm
Prompts you for confirmation before running the cmdlet.
Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf
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
None
You cannot pipe objects to this function.
OUTPUTS
None
This function does not return any output.
NOTES
An active ADT session is NOT required to use this function.
This function supports the -WhatIf and -Confirm parameters for testing changes before applying them.
Tags: psadt
Website: https://psappdeploytoolkit.com
Copyright: (C) 2026 PSAppDeployToolkit Team (Sean Lillis, Dan Cunningham, Muhammad Mashwani, Mitch Richters, Dan Gough).
License: https://opensource.org/license/lgpl-3-0
RELATED LINKS
https://psappdeploytoolkit.com/docs/reference/functions/Remove-ADTEnvironmentVariable