Jump to content

Recommended Posts

Posted

I have tried a couple of the Services UDF out there and they are old and not updated. Is there any UDF's that anyone is using that are still working that work with remote or local services on current OS models? Tried a couple UDF's and they were made over 10 years ago and aren't working correctly.

 

Thank you.

Posted

You should try WMI.  Here an example :

#RequireAdmin
#include <Constants.au3>
#include <Array.au3>

; https://docs.microsoft.com/en-us/windows/win32/cimwin32prov/win32-service

Opt("MustDeclareVars", 1)

_CheckService(@ComputerName) ; replace with name of computer you can remotely access

Func _CheckService($sName)

  Local $objWMIService = ObjGet("winmgmts:\\" & $sName & "\root\CIMV2")
  Local $colItems = $objWMIService.ExecQuery('SELECT * FROM Win32_Service WHERE Caption = "Windows Update"')
  If Not IsObj($colItems) Then Exit MsgBox(0, "", "Not an object")
  If Not $colItems.count Then Exit MsgBox(0, "", "Service not found")
  Local $aService[$colItems.count][5], $i = 0
  For $sItem In $colItems
    $aService[$i][0] = $sItem.Caption
    $aService[$i][1] = $sItem.Started
    $aService[$i][2] = $sItem.StartMode
    $aService[$i][3] = $sItem.State
    $aService[$i][4] = $sItem.Status
    $i += 1
  Next
  _ArrayDisplay ($aService)
  Local $oService = $colItems.itemIndex(0)
  ;$oService.StartService ()
EndFunc   ;==>_CheckService

 

Posted
  On 6/30/2021 at 4:30 PM, slybry70 said:

I have tried a couple of the Services UDF out there and they are old and not updated. Is there any UDF's that anyone is using that are still working that work with remote or local services on current OS models? Tried a couple UDF's and they were made over 10 years ago and aren't working correctly.

Expand  

Which one you have tried so far ?
Post URL link to this UDF.

Signature beginning:
Please remember: "AutoIt"..... *  Wondering who uses AutoIt and what it can be used for ? * Forum Rules *
ADO.au3 UDF * POP3.au3 UDF * XML.au3 UDF * IE on Windows 11 * How to ask ChatGPT for AutoIt Codefor other useful stuff click the following button:

  Reveal hidden contents

Signature last update: 2023-04-24

Posted
  On 6/30/2021 at 4:30 PM, slybry70 said:

I have tried a couple of the Services UDF out there and they are old and not updated.
Tried a couple UDF's and they were made over 10 years ago and aren't working correctly.

Expand  

Just being old will probably not be the problem.
Are there any functions missing or do you get error messages ...? Please provide more information
.

My UDFs and Tutorials:

  Reveal hidden contents

 

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...