ps/Modules/Alkami.PowerShell.Services/Public/Disable-Nag.ps1
2023-05-30 22:51:22 -07:00

38 lines
1.2 KiB
PowerShell

function Disable-Nag {
<#
.SYNOPSIS
Break Nag By Disabling the Service and Adding Bogus Values to the Config
.PARAMETER nagPath
The path where Nag is installed. Defaults to (Get-OrbPath)\Nag
#>
[CmdletBinding()]
param(
[Parameter(Mandatory=$false)]
[string]$nagPath
)
$logLead = (Get-LogLeadName);
if([string]::IsNullOrEmpty($nagPath)) {
$nagPath = (Join-Path(Get-OrbPath) "\Nag")
}
Write-Verbose "$logLead : Using Nag Path $nagPath"
$nagService = Get-Service "Alkami Nag Service" -ErrorAction SilentlyContinue
if ($null -eq $nagService) {
Write-Host "$logLead : The Nag Service is not installed on this machine"
} else {
Disable-Service $nagService
Stop-AlkamiService $nagService.Name
}
# ToDo: When dev changes the app setting key in ORB we'll remove the term WhiteList from this function
# Until then, we will match the development code base to avoid any confusion
# See: SRE-14133
$nagConfig = (Join-Path $nagPath "Alkami.App.Nag.Host.Service.exe.config")
Set-AppSetting -key 'TenantFIWhitelistRegex' -value 'DISABLE ALL TENANTS' -filePath $nagConfig
Set-AppSetting -key 'JobNameWhitelistRegex' -value 'DISABLE ALL JOBS' -filePath $nagConfig
}