Remove-Application.ps1

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
<#
.Synopsis
    Removes a saved application reference.
 
.Description
    Removes a saved application reference and persists this
    information to disk at $home\AppData\Low\SimplyCredential\.
 
.Parameter Name
    The reference name of the application.
#>

function Remove-Application {
    param([Parameter(Mandatory, ValueFromPipeline, ValueFromPipelineByPropertyName)][string]$Name)

    if($script:AppList.Keys -contains $name) { 
        $script:AppList.Remove($name)
        $script:AppList | Export-Clixml -Path $script:AppListPath -Force
    }
    else { Write-Warning "The application reference '$name' does not exist." }
}

Export-ModuleMember -Function Remove-Application