functions/clear-axactiveenvironmentconfig.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
37
38
39
40
41
42
43
44
45
46
47
48
49

<#
    .SYNOPSIS
        Clear the active environment config
         
    .DESCRIPTION
        Clear the active environment config from the configuration store
         
    .PARAMETER Temporary
        Instruct the cmdlet to only temporarily clear the active environment configuration in the configuration store
         
    .EXAMPLE
        PS C:\> Clear-AxActiveEnvironmentConfig
         
        This will clear the active environment configuration from the configuration store.
         
    .NOTES
        Tags: Environment, Config, Configuration, Servers
         
        Author: Mötz Jensen (@Splaxi)
    .LINK
        Add-AxEnvironmentConfig
         
    .LINK
        Get-AxActiveEnvironmentConfig
         
    .LINK
        Get-AxEnvironmentConfig
         
    .LINK
        Remove-AxEnvironmentConfig
         
    .LINK
        Set-AxActiveEnvironmentConfig
#>


function Clear-AxActiveEnvironmentConfig {
    [CmdletBinding()]
    [OutputType()]
    param (
        [switch] $Temporary
    )

    $configurationName = "ax2012.tools.active.environment.config.name"
    
    Reset-PSFConfig -FullName $configurationName

    if (-not $Temporary) { Register-PSFConfig -FullName $configurationName -Scope UserDefault }
}