Fix IT Scripts
0 like 0 dislike
84 views
By default, when adding Pulseway agent to a machine, and monitoring services, it monitor all Automatic services. Thats fine.

Some services are Automatic, but not started, as they get started as an when needed.

Then I have a manual task of unselecting the services that are on Auto, but not started on all machines, so that the Pulseway agent does not trigger an alert, for example, "Software Protection"
asked in Pulseway by (3.1k points) | 84 views

1 Answer

0 like 0 dislike

Ermins Dreimanis (Pulseway Support)

Hi Doug,

Thank you for contacting us. You can use this script to remove one service at a time from the list of monitored services into the Pulseway Manager. You can run this script via the automation.

$removeService = "BITS"  #the name for the service which will be removed from the list of monitored services
$name = Get-ItemProperty -Path "HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\Services"
[array]$newNameList = $null
$removed = $false
$count = 0
if($name.Count -gt 0){
  for ($i=0; $i -lt $name.Count ; $i++){
      if($name."Service$i" -eq $removeService){
          $removed = $true
          }
        else{
          $newNameList += $name."Service$i"
        }
  }
}
Remove-Item -Path "HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\Services" -Recurse
New-Item -Path "HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\Services"
Set-ItemProperty -Path "HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\Services" -Name "Count" -Value $newNameList.length;
$count = 0
foreach ($service in $newNameList) {
    Set-ItemProperty -Path "HKLM:\SOFTWARE\MMSOFT Design\PC Monitor\Services" -Name ("Service" + $count++) -Value "$service"
}
if($removed){ write-host "The service $removeService was removed from the list of monitored services successfully"}
else {write-host "Action failed or service is not monitored on this system"}
#echo $newNameList


I hope this helps.
 

Regards,
Ermins Dreimanis

Pulseway - Making IT Heroes
The world's most portable IT management platform

answered by (3.1k points)
Just to note. the Service Name is the actual service name, and not the display name..

Related questions

0 like 0 dislike
1 answer
0 like 0 dislike
1 answer
1 like 0 dislike
1 answer
30 questions
24 answers
17 comments
631 users