functions/path/Get-PSUPathAlias.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
function Get-PSUPathAlias
{
<#
    .SYNOPSIS
        Gets the PSUPathAlias configuration values.
 
    .DESCRIPTION
        Gets the PSUPathAlias configuration values from the PSFConfig system.
 
    .PARAMETER Alias
        This is the name of the alias that you want for Set-PSUPath. Wildcards accepted
 
        Default Value: *
 
    .EXAMPLE
        PS C:\> Get-PSUPathAlias
     
        Returns all aliases
#>

    [CmdletBinding()]
    param (
        [string]
        $Alias = '*'
    )
    
    $aliases = Get-PSFConfig -FullName psutil.pathalias.$Alias
    
    foreach ($currentAlias in $aliases)
    {
        [pscustomobject]@{
            Alias = ($currentAlias.fullname -replace '^psutil.pathalias.')
            Path  = $currentAlias.value
        }
    }
}