Public/ps1/Configuration/General/Remove-ApprxrConfigurationValue.ps1
|
<#
.SYNOPSIS Removes a configuration value from the Apprxr config file. .DESCRIPTION Deletes the specified property from config.json if it exists. .PARAMETER name The name of the configuration property to remove. .EXAMPLE Remove-ApprxrConfigurationValue -name 'UserName' .NOTES Used for cleaning up configuration values in Apprxr scripts and modules. #> function Remove-ApprxrConfigurationValue{ param($name) $folder = Get-ApprxrConfigurationFolder if (Test-Path "$folder\config.json") { } else { "{}"|set-content "$folder\config.json" } $config = Get-Content "$folder\config.json" | ConvertFrom-Json # the prpoerty does not exist $config.PSObject.Properties.Remove($name) $config | ConvertTo-Json | Set-Content "$folder\config.json" } |