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 } }