functions/path/Remove-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
function Remove-PSUPathAlias
{
<#
    .SYNOPSIS
        Removes a path alias fromm the configuration system.
     
    .DESCRIPTION
        Removes a path alias from the configuration system using Unregister-PSFConfig.
        Note: This command has no effect on configuration setings currently in memory.
     
    .PARAMETER Alias
        The name of the Alias that you want to remove from the configuration system.
     
    .EXAMPLE
        PS C:\> Remove-PSUPathAlias -Alias work
     
        Removes the path alias named work from the configuration system.
    #>

    [Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSUseShouldProcessForStateChangingFunctions", "")]
    [CmdletBinding()]
    param (
        [Parameter(ValuefromPipelineByPropertyName = $true)]
        $Alias
    )
    
    process
    {
        Get-PSFConfig -FullName psutil.pathalias.$Alias | Unregister-PSFConfig
        Remove-PSFAlias -Name $Alias
    }
}