Skip to content

Get PSModulePath

dscbot edited this page Feb 13, 2024 · 3 revisions

Get-PSModulePath

SYNOPSIS

Returns the individual scope path or the environment variable PSModulePath from one or more of the specified targets.

SYNTAX

Scope (Default)

Get-PSModulePath [-Scope <String>] [<CommonParameters>]

FromTarget

Get-PSModulePath -FromTarget <String[]> [<CommonParameters>]

DESCRIPTION

Returns the individual scope path or the environment variable PSModulePath from one or more of the specified targets.

If more than one target is provided in the parameter FromTarget the return value will contain the concatenation of all unique paths from the targets. If there are no paths to return the command will return an empty string.

EXAMPLES

EXAMPLE 1

Get-PSModulePath

Returns the module path to the CurrentUser scope.

EXAMPLE 2

Get-PSModulePath -Scope 'CurrentUser'

Returns the module path to the CurrentUser scope.

EXAMPLE 3

Get-PSModulePath -Scope 'AllUsers'

Returns the module path to the AllUsers scope.

EXAMPLE 4

Get-PSModulePath -Scope 'Builtin'

Returns the module path to the Builtin scope. This is the module path containing the modules that ship with PowerShell.

EXAMPLE 5

Get-PSModulePath -FromTarget 'Session'

Returns the paths from the Session target.

EXAMPLE 6

Get-PSModulePath -FromTarget 'Session', 'User', 'Machine'

Returns the unique paths from the all targets.

PARAMETERS

-FromTarget

Specifies the environment target to get the PSModulePath from.

Type: String[]
Parameter Sets: FromTarget
Aliases:

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

-Scope

Specifies the scope to get the individual module path of.

Type: String
Parameter Sets: Scope
Aliases:

Required: False
Position: Named
Default value: CurrentUser
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

System.String

[System.String]

If there are no paths to return the command will return an empty string.

NOTES

RELATED LINKS

Clone this wiki locally