Jump to content

Windows Services UDF


engine
 Share

Recommended Posts

Current functions:

_Service_Change

_Service_Create

_Service_Delete

_Service_Enum

_Service_EnumDependent

_Service_Exists

_Service_Pause

_Service_Resume

_Service_QueryAccount

_Service_QueryBinaryPath

_Service_QueryConfig

_Service_QueryDependencies

_Service_QueryDesc

_Service_QueryDisplayName

_Service_QueryErrorControl

_Service_QueryFailureActions

_Service_QueryGroup

_Service_QueryStartType

_Service_QueryStatus

_Service_QueryType

_Service_SetAccount

_Service_SetBinaryPath

_Service_SetDependencies

_Service_SetDesc

_Service_SetDisplayName

_Service_SetErrorControl

_Service_SetFailureActions

_Service_SetGroup

_Service_SetStartType

_Service_SetType

_Service_Start

_Service_Stop

All functions are Windows API based.

Download here -> Services.au3

Requires -> SecurityEx.au3

Edited by engine

My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]

Link to comment
Share on other sites

Current functions:

_Service_Change

_Service_Create

_Service_Delete

_Service_Enum

_Service_EnumDependent

_Service_Exists

_Service_Pause

_Service_Resume

_Service_QueryStatus

_Service_SetAccount

_Service_SetDependencies

_Service_SetDesc

_Service_SetFailureActions

_Service_SetGroup

_Service_SetStartType

_Service_SetType

_Service_Start

_Service_Stop

All functions are Windows API based.

Download here ->

Requires -> Privilege.au3

Enjoy!

Ahh! This has been done so many times! But good work! Edited by SwiftBurns
Link to comment
Share on other sites

That first one is for making your scripts work as service, doesn't seem like a general service UDF.

This second one is using WMI :P

Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

Thanks.

Already knew about them.

This UDF is more close to the first. It was my intention to do a complete Service Manager for AutoIt. As you might see, you can do more with the UDF published on this topic!

About the second. That was the one I was using on my scripts before doing my own. I encountered some disadvantages with it. Since it uses WMI, it can't be used on an earlier stage of Windows XP unattended setup, where the SYSTEM account is running and WMI isn't completely installed yet. Also using DllCalls is a lot faster!

Regards.

My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]

Link to comment
Share on other sites

Could add..

_Service_Enable

_Service_Disable

Off the top of my head, They are implemented in the service examples from MSDN. (which is basically just using ControlService().. )

I don't know what you mean. As I understand you can do that with _Service_SetStartType

If I am wrong, please show me those examples.

Also some UDFs to get the current configuration of a service are missing. I plan to add those in the near future.

Regards.

My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]

Link to comment
Share on other sites

You are right..

(untested)

_Service_SetStartType("service name", $SERVICE_DISABLED, "")

I mean't 'ChangeServiceConfig' :P

Here's the code I was talking about, it's in 'SvcConfig.cpp', called DoDisableSvc() and DoDisableSvc()

http://msdn.microsoft.com/en-us/library/bb540476(VS.85).aspx

I suppose it would be something like this..

Func _Service_Enable($sServiceName, $sComputerName = "")
    Local $iSSM = _Service_SetStartType($sServiceName, $SERVICE_DEMAND_START, $sComputerName)
    Return SetError(@error, 0, $iSSM)
EndFunc ;==> _Service_Enable

Func _Service_Disable($sServiceName, $sComputerName = "")
    Local $iSSM = _Service_SetStartType($sServiceName, $SERVICE_DISABLED, $sComputerName)
    Return SetError(@error, 0, $iSSM)
EndFunc ;==> _Service_Disable
Edited by mrRevoked
Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

Updated!

Changes:

_Service_Change and _Service_Create now with all parameters.

_Service_Enum and _Service_EnumDependent fixed an infinite loop when 0 services are retuned.

_Service_QueryStatus removed the flag. Now returns an array.

_Service_SetFailureActions reviewed.

Old _Service_SetType split into a new version of _Service_SetType and a new function _Service_SetErrorControl

Added the following functions:

_Service_QueryConfig

_Service_QueryDependencies

_Service_QueryDesc

_Service_QueryDisplayName

_Service_QueryFailureActions

_Service_SetBinaryPath

_Service_SetDisplayName

Regards.

My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]

Link to comment
Share on other sites

I don't plan to add anything new to this UDF. Unless there are suggestions. Any comments are welcome.

Regards.

Some examples would be nice.

Combine "Privilege.au3" into one file.

.. and get this submitted to as a UDF. :P

Don't bother, It's inside your monitor!------GUISetOnEvent should behave more like HotKeySet()
Link to comment
Share on other sites

I don't plan to merge "Privilege.au3" with "Services.au3"

I need to include "Privilege.au3" on other UDFs. So it's better this way.

I did some modifications of my own to AutoIt's "Security.au3" include file. I suggested them to the main author PaulIA, and also to Jon and GaryFrost. This was before I published the UDF on this topic. I haven't received any answer from any of them yet.

Regards.

Edited by engine

My contributions:Local account UDF Registry UDFs DriverSigning UDF Windows Services UDF [url="http://www.autoitscript.com/forum/index.php?showtopic=81880"][/url]

Link to comment
Share on other sites

  • 2 weeks later...

Many thank for this excellent UDF

My Scripts[topic="73325"]_ReverseDNS()[/topic]Favourite scripts by other members[topic="81687"]SNMP udf[/topic][topic="70759"]Using SNMP - MIB protocol[/topic][topic="39050"]_SplitMon:Section off your monitor!, split your monitor into sections for easy management[/topic][topic="73425"]ZIP.au3 UDF in pure AutoIt[/topic][topic="10534"]WMI ScriptOMatic tool for AutoIt[/topic][topic="51103"]Resources UDF embed/use any data/files into/from AutoIt compiled EXE files[/topic]
Link to comment
Share on other sites

  • 2 weeks later...

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

  • Recently Browsing   0 members

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