• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
ControlUp Community

ControlUp Community

Connect, Learn, and Grow

  • Blog
  • Podcast
  • Meetups
  • Archives
  • Categories
    • ControlUp One Platform
    • ControlUp for Apps
    • ControlUp for Compliance
    • ControlUp for Desktops
    • ControlUp Scripts & Triggers
    • ControlUp Synthetic Monitoring
    • ControlUp for VDI
  • Topics
  • Events
    • Logos & Wallpaper
    • ControlUp.com
  • Join

How to Start a Stopped Service only via ControlUp Trigger?

Posted on January 11, 2023

A user asked if the Start Stopped Services script could be set up to only start the service upon a trigger. The user wanted to use built in features and community scripts and confirmed that Windows Services Monitoring is necessary for this to properly work. A sneak peek was shared – a beta for service monitoring was to be released likely in March 2021.


Read the entire ‘Necessity of Windows Services Monitoring for Start Stopped Services Script Setup’ thread below:

Can someone verify that the Start Stopped Services script can be set up to only start the service I have setup a trigger to monitor? The process ended trigger is looking for name=spooler and calling the start stopped script action. Does that mean it will only attempt to start the spooler service?


I think you could easily modify that with events generated on the event logs and then update your action to start it again just by using a quick net-start command or use get first check the status and then use start-service command.. have you configured it in the trigger to look for any specific event…

I am also hoping if something like this would be available in the triggers so that we can directly point to the service and configure it.


I run a scheduled script to check the services every X minutes and if they are not started to start them. It can be difficult to find a windows event sometimes to trigger for a service stopping or failing to start. There is a new services feature ben worked at the moment so realy looking forward to that


Thanks. So the trigger I described would work but it will attempt to start ALL stopped services that are set to automatic?


normally i would target the a specific service. script would 1 check the server is contactable. 2 . what is the current status of the service. 3 depending on the status of the service to state what action is taken. aka start the service


i’m not familar with the script u using but thats how i would do itoyou can also build into the script open a service desk ticket of ur helpdesk tool has that ability]$Date = Get-Date -Format "dd/MM/yy"

$Time = Get-Date -Format "HH:mm"

Write-host "Citrix StoreFront Service Monitor Checks Module $Date $Time" -ForegroundColor White

Write-host "——————————————————————" -ForegroundColor White

foreach($SF_Server in $CTX_StoreFront)

Forecah Open

{

try

#Open_Try

{

$Service_Name = "StoreFront Service Monitor"

Write-host "Server: $SF_Server : $Service_Name " -ForegroundColor Yellow

#Checks that the sever is online and pingable

Test-Connection $SF_Server -ErrorAction Stop

Write-host "Server: $SF_Server" -ForegroundColor Yellow

Write-host "Stage 1.1: Confirmed Server Contactable Using Test Connection $Date $Time " -ForegroundColor Yellow

$CTX_SF_CTXMonitor_status_Check = $(Get-Service -ComputerName $SF_Server | ? {$_.Name -eq "$CTX_SF_CTXMonitor"}).Status

if($CTX_SF_CTXMonitor_status_Check -eq "Running")

{

$subject = "$Subject_company_Name Citrix StoreFront Service Monitor Service $CTX_SF_CTXMonitor on $SF_Server is $CTX_SF_CTXMonitor_status_Check $Date $Time"

$body = BodyMail-Stage_1 -Affected_Systems $SF_Server -Server $SF_Server -Service $CTX_SF_CTXMonitor -Status $CTX_SF_CTXMonitor_status_Check -Tag_Top $tag_P4 -Priority $Priority_4 -Tag_1 $tag_Source_Auto -Tag_2 $tag_Type -Tag_3 $tag_Agreement -Tag_4 $tag_Close_Y -Service_Name $Service_Name

# Service was started no actions need to be taken

#Send-Mail_Checks -to $toaddress_DEMMS_CatchALL -subject $subject -body $body

Write-host "—————————————– " -ForegroundColor Yellow

Write-host "Stage 1.2 Service $CTX_SF_CTXMonitor was started no actions needed to be taken: $SF_Server " -ForegroundColor Green

#Write-host "Stage 1.3 Mail Sent $Date $Time " -ForegroundColor Yellow

Write-host "—————————————– " -ForegroundColor Yellow

$CTX_SF_CTXMonitor_Array += New-Object psobject -Property @{ ‘Stage’ = "1"; ‘Name’ = $SF_Server; ‘Status’ = $CTX_SF_CTXMonitor_status_Check;}

}

else

{

Write-host "Stage 2.1: First Check on Service Failed " -ForegroundColor Red

Write-host "Stage 2.2: Service $CTX_SF_CTXMonitor status $CTX_SF_CTXMonitor_status_Check on Server $SF_Server $Date $Time " -ForegroundColor Red

Write-host "Stage 2.4: Automation will now try start the servive " -ForegroundColor Yellow

(Get-Service -ComputerName $SF_Server | ? {$_.Name -eq "$CTX_SF_CTXMonitor"}) | Start-Service

$CTX_SF_CTXMonitor_status_Check = $(Get-Service -ComputerName $SF_Server | ? {$_.Name -eq "$CTX_SF_CTXMonitor"}).Status

if($CTX_SF_CTXMonitor_status_Check -eq "Running")

{

$subject = "$Subject_company_Name Citrix StoreFront Service Monitor Service $CTX_SF_CTXMonitor on $SF_Server is $CTX_SF_CTXMonitor_status_Check $Date $Time"

$body = BodyMail-Stage_2 -Affected_Systems $SF_Server -Server $SF_Server -Service $CTX_SF_CTXMonitor -Status $CTX_SF_CTXMonitor_status_Check -Tag_Top $tag_P1 -Priority $Priority_1 -Tag_1 $tag_Source_Auto -Tag_2 $tag_Type -Tag_3 $tag_Agreement -Tag_4 $tag_Close_Y -Service_Name $Service_Name

#Send Mail serice was stopped but started

Write-host "—————————————– " -ForegroundColor Yellow

Write-host "Stage 2.5 Automation Started the service Sucessfully" -ForegroundColor Green

Write-host "Stage 2.3 Status of the Service $CTX_SF_CTXMonitor is $CTX_SF_CTXMonitor_status_Check $Date $Time " -ForegroundColor Green

Send-Mail_Checks -to $toaddress_DEMMS -subject $subject -body $body

Write-host "Stage 2.6 Mail Sent $Date $Time " -ForegroundColor Yellow

Write-host "—————————————– " -ForegroundColor Yellow

$CTX_SF_CTXMonitor_Array += New-Object psobject -Property @{ ‘Stage’ = "2"; ‘Name’ = $SF_Server; ‘Status’ = $CTX_SF_CTXMonitor_status_Check;}

}

else

{

Write-host "Stage 3.1: Service status $CTX_SF_CTXMonitor_status_Check on Server $SF_Server $Date $Time " -ForegroundColor Red

Write-host "Stage 3.2: Automation Failed to Start the service" -ForegroundColor Red

#Automation Failed to Start the service

$subject = "$Subject_company_Name Citrix StoreFront Service Monitor Service $CTX_SF_CTXMonitor on $SF_Server is $CTX_SF_CTXMonitor_status_Check $Date $Time"

$body = BodyMail-Stage_3 -Affected_Systems $SF_Server -Server $SF_Server -Service $CTX_SF_CTXMonitor -Status $CTX_SF_CTXMonitor_status_Check -Tag_Top $tag_P1 -Priority $Priority_1 -Tag_1 $tag_Source_Auto -Tag_2 $tag_Type -Tag_3 $tag_Agreement -Tag_4 $tag_Close_N -Service_Name $Service_Name

#

Write-host "—————————————– " -ForegroundColor Yellow

Write-host "Stage 3.3: Service status $CTX_SF_CTXMonitor_status_Check on Server $SF_Server $Date $Time " -ForegroundColor Red

Send-Mail_Checks -to $toaddress_DEMMS -subject $subject -body $body

Write-host "Stage 3.4 Mail Sent $Date $Time " -ForegroundColor Yellow

Write-host "—————————————– " -ForegroundColor Yellow

$CTX_SF_CTXMonitor_Array += New-Object psobject -Property @{ ‘Stage’ = "3"; ‘Name’ = $SF_Server; ‘Status’ = $CTX_SF_CTXMonitor_status_Check;}

}

}

}

#Close_Try

catch

#Open-Catch

{

$subject = "$Subject_company_Name Citrix StoreFront Service Monitor Service $CTX_SF_CTXMonitor on $SF_Server is Down $Date $Time"

$body = BodyMail-Stage_4 -Affected_Systems $SF_Server -Server $SF_Server -Service $CTX_SF_CTXMonitor -Status $CTX_SF_CTXMonitor_status_Check -Tag_Top $tag_P1 -Priority $Priority_1 -Tag_1 $tag_Source_Auto -Tag_2 $tag_Type -Tag_3 $tag_Agreement -Tag_4 $tag_Close_N -Service_Name $Service_Name

Write-host "Stage 4.1: Failed Server Contactable Using Test Connection" -ForegroundColor Red

Write-host "Stage 4.2: Server $SF_Server is Down " -ForegroundColor Red

Write-host "Stage 4.3 Mail Sent $Date $Time " -ForegroundColor Yellow

Send-Mail_Checks -to $toaddress_DEMMS -subject $subject -body $body

Write-host "—————————————– " -ForegroundColor Yellow

$CTX_SF_CTXMonitor_status_Check = "Down"

$CTX_SF_CTXMonitor_Array += New-Object psobject -Property @{ ‘Stage’ = "4"; ‘Name’ = $SF_Server; ‘Status’ = $CTX_SF_CTXMonitor_status_Check;}

}

#Close-Catch

}

Forecah Open

Write-host "——————————————————————" -ForegroundColor Whitesomething like thatThanks. I’m trying to use built in features and community scripts. I know what I outlined isn’t perfect, just trying to get confirmation that it will work the way I understand it to.


FYI. The trigger I setup does not work. Back to the drawing board I am going to try this.

Create a Trigger to monitor this service stopping: Service = Spooler

Script action to run: (will check if service is not running and start it:

$service = Get-Service -Name Spooler

if ($service.Status -ne "Running") {

`Start-Service -Name Spooler`

}@member since you are online. Any thoughts?Hm. Haven’t used that trigger for a while. @member maybe has some thoughts on this. He’s much smarter


That’s debatable. lol.


Oh no, by a mile. But he’s in my team so I just ride that wave 😂


I think you will need Windows Services Monitoring for this to function properly. Process monitoring is not going to work for that I believe. We have Service monitoring on the plan for the release, 8.8

Am I correct that is what is needed for this scenario? @member @member(sneak peek)


I believe you are right. I tried using the process ended trigger but there is no filter for process name only PID which changes.


I think we might be doing a beta probably somewhere in March


Stay tuned, i have been asking for service monitoring for near 4 years 🙂 i’ll have beta now please

Continue reading and comment on the thread ‘How to Start a Stopped Service only via ControlUp Trigger?’.  Not a member? Join Here!


Categories: All Archives, ControlUp Scripts & Triggers
Topics: Automation, Automation & Alerting, Citrix, Logs, Microsoft Windows, Scripts, Service Desk, Triggers

Ask Us Anything, Connect, Learn, and Grow with the ControlUp Community!

Login to the ControlUp Community to ask us anything, stay up-to-date on what’s new and coming soon and meet other like-minded techies like you.

Not already a member? Join Today!

Primary Sidebar

ControlUp Academy

Enroll in ControlUp Academy for expert-led technical training, equipping you with skills to effectively deploy, manage, and grow your ControlUp investment.

Learn here >

Rotating Images

Hidden Gem from our Community on Slack!

ControlUp Betas - What's Coming Next?
NEW ControlUp Features - Stay Up-to-Date!
ControlUp Scripts - Scripting, Zero to Hero
Latest KB Articles - Be the First to Learn
Did you Know - with Sivan Kroitoru
Practical Perspectives Technical Use Case Training

Video Tutorials Library

Visit our technical how-to videos, offering step-by-step tutorials on advanced features, troubleshooting, and best practices.

Watch here >

ControlUp Blog

Check out the ControlUp blog for expert advice and in-depth analysis.

Read here >

ControlUp Script Library

Visit the ControlUp technical script library, which offers a multitude of pre-built scripts and custom actions for your monitoring and troubleshooting requirements.

See here >

ControlUp Support

Visit the ControlUp support home and to delve deeper into ControlUp solutions.

Browse here >

Download ControlUp RealTime DX

Start with ControlUp for real-time end-user environment insights, swift troubleshooting, and unprecedented performance optimization. Download now.

Download here >

Footer

      

ControlUp Community
Of Techie, By Techie, For Techie!

Terms of Use | Privacy Policy | Security
Dive Deeper, Learn more at ControlUp.com

  • facebook
  • twitter
  • youtube
  • linkedin

© 2023–2025 ControlUp Technologies LTD, All Rights Reserved.

We use cookies to ensure that we give you the best experience on our website. by continuing to use this site you agree to our Cookie policy..