Skip to content

Set PSModulePath

dscbot edited this page Feb 13, 2024 · 3 revisions

Set-PSModulePath

SYNOPSIS

Set environment variable PSModulePath in the current session or machine wide.

SYNTAX

Default (Default)

Set-PSModulePath -Path <String> [-Machine] [-PassThru] 
 [<CommonParameters>]

TargetParameters

Set-PSModulePath -FromTarget <String> -ToTarget <String> [-PassThru] 
 [<CommonParameters>]

DESCRIPTION

This is a command to set environment variable PSModulePath in current session or machine wide.

EXAMPLES

EXAMPLE 1

;<Path 2>'

Sets the session environment variable PSModulePath to the specified path or paths (separated with semi-colons).

EXAMPLE 2

;<Path 2>' -Machine

Sets the machine environment variable PSModulePath to the specified path or paths (separated with semi-colons).

EXAMPLE 3

Set-PSModulePath -FromTarget 'MAchine' -ToTarget 'User'

Copies the value of the machine environment variable PSModulePath to the user environment variable PSModulePath.

PARAMETERS

-FromTarget

The target environment variable to copy the value from.

Type: String
Parameter Sets: TargetParameters
Aliases:

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

-Machine

If set the PSModulePath will be changed machine wide. If not set, only the current session will be changed.

Type: SwitchParameter
Parameter Sets: Default
Aliases:

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

-PassThru

If specified, returns the set value.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

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

-Path

A string with all the paths separated by semi-colons.

Type: String
Parameter Sets: Default
Aliases:

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

-ToTarget

The target environment variable to set the value to.

Type: String
Parameter Sets: TargetParameters
Aliases:

Required: True
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

OUTPUTS

None

NOTES

RELATED LINKS

Clone this wiki locally