Jump to content

Check status of a service


Recommended Posts

#include <array.au3>
#include <service.au3>

$aServices = _ServListInstalled()

_ArrayDisplay($aServices)
$spoolerStatus = _ServGetState("Spooler")
MsgBox(64, "Spooler service status", $spoolerStatus)

$appIDSvcStatus = _ServGetState("AppIDSvc")
MsgBox(64, "AppIDSvc service status", $appIDSvcStatus)

Do
    Sleep(1000)
    $myServiceStatus = _ServGetState("myServiceName")
Until $myServiceStatus = "Running"

MsgBox(64, "Yay!", "It's aliiiiiive!")

 

Roses are FF0000, violets are 0000FF... All my base are belong to you.

Link to comment
Share on other sites

In the wiki you can find a list of available UDFs: https://www.autoitscript.com/wiki/User_Defined_Functions

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

1 hour ago, SadBunny said:
#include <array.au3>
#include <service.au3>

$aServices = _ServListInstalled()

_ArrayDisplay($aServices)
$spoolerStatus = _ServGetState("Spooler")
MsgBox(64, "Spooler service status", $spoolerStatus)

$appIDSvcStatus = _ServGetState("AppIDSvc")
MsgBox(64, "AppIDSvc service status", $appIDSvcStatus)

Do
    Sleep(1000)
    $myServiceStatus = _ServGetState("myServiceName")
Until $myServiceStatus = "Running"

MsgBox(64, "Yay!", "It's aliiiiiive!")

 

Where do I find the included service.au3?

I get an error: Can't open include file <service.au3>

Yours sincerely

Kenneth.

Link to comment
Share on other sites

Check my link above ;)

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Or:

Service (by arcker) - Build your own service with AutoIt code.
Windows Services (by engine) - Windows Services UDF.

Edited by water

My UDFs and Tutorials:

Spoiler

UDFs:
Active Directory (NEW 2024-07-28 - Version 1.6.3.0) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
OutlookEX (2021-11-16 - Version 1.7.0.0) - Download - General Help & Support - Example Scripts - Wiki
OutlookEX_GUI (2021-04-13 - Version 1.4.0.0) - Download
Outlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - Wiki
PowerPoint (2021-08-31 - Version 1.5.0.0) - Download - General Help & Support - Example Scripts - Wiki
Task Scheduler (2022-07-28 - Version 1.6.0.1) - Download - General Help & Support - Wiki

Standard UDFs:
Excel - Example Scripts - Wiki
Word - Wiki

Tutorials:
ADO - Wiki
WebDriver - Wiki

 

Link to comment
Share on other sites

Object way :

Local $sServiceName = "RemoteRegistry"
Local $oShell = ObjCreate("shell.application")

Do
    Sleep(100)
Until $oShell.IsServiceRunning($sServiceName)
MsgBox(0, "", "Service " & $sServiceName & " is running now")

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...