ps/Modules/Alkami.PowerShell.Services/Public/Test-IsNagRunning.ps1

28 lines
673 B
PowerShell
Raw Normal View History

2023-05-30 22:51:22 -07:00
function Test-IsNagRunning {
<#
.SYNOPSIS
Tests if Nag is running on the specified server
.PARAMETER server
Server to test
#>
param(
[ValidateNotNullOrEmpty()]
[Alias("ComputerName")]
[string]$Server = "localhost"
)
$logLead = (Get-LogLeadName);
try {
$remoteNagServiceInfo = Get-Service "Alkami Nag Service" -ComputerName $Server
} catch [Microsoft.PowerShell.Commands.ServiceCommandException] {
Write-Warning "$logLead : Nag was not found on $Server"
return $false
}
if ($remoteNagServiceInfo.Status -match "Running") {
return $true
} else {
return $false
}
}