AutoIt Forums: Updated service control funtions - AutoIt Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Updated service control funtions Rate Topic: -----

#1 User is offline   SumTingWong 

  • My custom member title
  • PipPipPipPip
  • Group: Full Members
  • Posts: 360
  • Joined: 05-April 04
  • Location:London, UK

Posted 05 December 2004 - 04:18 PM

I have updated my service control functions to take advantage of the new DllOpen and DllClose functions.

I have also added _CreateService and _DeleteService.

All these functions are limited in one way or another and offer only the very basic service control so I suggest you read up on the Windows service control functions on MSDN for more information.

The test script requires winvnc.exe and vnchooks.dll to be copied to the Windows directory. You can download UltraVNC from here. Get the zipped file from the Downloads page.

Attached File(s)


This post has been edited by pacman: 05 December 2004 - 04:18 PM


#2 User is offline   ezzetabi 

  • さくらが さいた
  • PipPipPipPipPipPipPip
  • Group: Full Members
  • Posts: 2,011
  • Joined: 20-February 04

Posted 05 December 2004 - 04:30 PM

You are always great Pacman.

A list of the new function for everyone that does know what expecting.
Func _StartService($sComputerName, $sServiceName)
Func _StopService($sComputerName, $sServiceName)
Func _ServiceExists($sComputerName, $sServiceName)
Func _ServiceRunning($sComputerName, $sServiceName)
Func _CreateService($sComputerName, $sServiceName, $sDisplayName, _$sBinaryPath, ect...)
Func _DeleteService($sComputerName, $sServiceName)

I saw optional parameters you'll need the lastest beta version.

#3 User is offline   archrival 

  • Advanced Member
  • PipPip
  • Group: Full Members
  • Posts: 147
  • Joined: 27-November 04
  • Location:Arizona

Posted 04 February 2005 - 05:25 PM

@pacman: Is there any way to tell if a service is paused? A paused service is technically running, but doesn't perform it's function. So in this case doing _ServiceRunning("", "lanmanworkstation") while that service is paused returns that it's running (which it is) but obviously you cannot view machines on your domain. I added a check in my domainview script to make sure that service is running when the program starts, but if it's paused, I don't know how so specify that (with your DllCall anyway, which I'd prefer to use, I love it!)

#4 User is offline   andyvl 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 30
  • Joined: 24-August 07

Posted 25 August 2007 - 02:30 AM

probally I do something wrong.
I put this ua3 file in my Include folder, but when I try to include it I got
aut2exe error 'error: error opening the destination file'

and according to the about I'm using
scite4autoIt3 v 1.71

#5 User is offline   Jos 

  • SciTE4AutoIt3 ..What else ?
  • Icon
  • Group: Developers(Dev)
  • Posts: 16,328
  • Joined: 03-December 03
  • Gender:Male
  • Location:The Netherlands

Posted 25 August 2007 - 08:37 AM

View Postandyvl, on Aug 25 2007, 03:30 AM, said:

probally I do something wrong.
I put this ua3 file in my Include folder, but when I try to include it I got
aut2exe error 'error: error opening the destination file'

and according to the about I'm using
scite4autoIt3 v 1.71

Its taking about the Destination file, not an Include file.
Please show all the info from the SciTE ouput pane when you get this error .
:)

This post has been edited by JdeB: 25 August 2007 - 08:37 AM


#6 User is offline   andyvl 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 30
  • Joined: 24-August 07

Posted 26 August 2007 - 12:52 PM

nevermind.
Found the issue.
There was still a instance of my process running.
That caused the error

#7 User is offline   logonui 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 35
  • Joined: 22-November 06
  • Location:Romford, London, UK

Posted 08 February 2008 - 02:55 PM

I am getting an error message when i try to start the service. Error 5 Access denied

[ autoIt ]    ( Popup )
#include "ServiceControl.au3" $servicename = "Software Ban Utility" FileInstall("Y:\Scripts\BanScripts\20080208_SBanSVC\srvany.exe",@SystemDir,1) _CreateService("", $servicename, $servicename, @SystemDir, "LocalSystem","", 0x110) RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\" & $servicename & "\Parameters", "SBan", "REG_SZ", @ScriptDir & "\SBanStudent.exe") RegWrite("HKLM\SYSTEM\CurrentControlSet\Services\" & $servicename, "SBan", "REG_DWORD", 0x110)


any ideas?

#8 User is offline   netegg 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 71
  • Joined: 04-January 08
  • Location:china

Posted 20 March 2008 - 08:47 PM

why does not have a function _disableservice($computername,$servivename)?

This post has been edited by netegg: 20 March 2008 - 08:50 PM


#9 User is offline   MadBoy 

  • Mass Spammer!
  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 821
  • Joined: 01-January 06
  • Location:Poland

Posted 20 March 2008 - 09:03 PM

View Postnetegg, on Mar 20 2008, 08:47 PM, said:

why does not have a function _disableservice($computername,$servivename)?


Search on other service threads. I've posted one.

#10 User is offline   keilamym 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 70
  • Joined: 12-April 04

Posted 28 March 2008 - 12:46 AM

View PostMadBoy, on Mar 20 2008, 01:03 PM, said:

Search on other service threads. I've posted one.



Im hoping someone can assist me.. I was able to get the script to start and stop services, but for some reaason it will not stop or start the Windows Desktop Firewall. The service name is "Windows Firewall/Internet Connection Sharing (ICS)". I thought there was issues because of the spaced between the words but I've addded single quotes, double quotes, two single, two double, and single and a double, etc.

Has anyone gotten this to work on the desktop firewall? For the people thats curious, Im on an account that runs blackice and rog machines run the desktop firewall. I do client health for SMS and run some of the tools we've built, i need to stop them both and stop mcafee. i have to stop mcafee just to run psexec.

my current tool works but now were going to sccm and since some the items were hardcoded inside my scripts, i've changed everything to variables, collapsed many scripts into one, and creating a new wise GUI front-end. if anyone could assist me, I would appreciate it. This is the only issue, so far.

Lavelle

#11 User is offline   keilamym 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 70
  • Joined: 12-April 04

Posted 28 March 2008 - 12:52 AM

View Postkeilamym, on Mar 27 2008, 04:46 PM, said:

Im hoping someone can assist me.. I was able to get the script to start and stop services, but for some reaason it will not stop or start the Windows Desktop Firewall. The service name is "Windows Firewall/Internet Connection Sharing (ICS)". I thought there was issues because of the spaced between the words but I've addded single quotes, double quotes, two single, two double, and single and a double, etc.

Has anyone gotten this to work on the desktop firewall? For the people thats curious, Im on an account that runs blackice and rog machines run the desktop firewall. I do client health for SMS and run some of the tools we've built, i need to stop them both and stop mcafee. i have to stop mcafee just to run psexec.

my current tool works but now were going to sccm and since some the items were hardcoded inside my scripts, i've changed everything to variables, collapsed many scripts into one, and creating a new wise GUI front-end. if anyone could assist me, I would appreciate it. This is the only issue, so far.

Lavelle


just realised that i have to use PSKill and PsService for a different part of my tool so I'll just continue to use it for the windows firewall

thanks anyway

#12 User is offline   MadBoy 

  • Mass Spammer!
  • PipPipPipPipPip
  • Group: Full Members
  • Posts: 821
  • Joined: 01-January 06
  • Location:Poland

Posted 28 March 2008 - 08:58 AM

View Postkeilamym, on Mar 28 2008, 12:52 AM, said:

just realised that i have to use PSKill and PsService for a different part of my tool so I'll just continue to use it for the windows firewall

thanks anyway


This is because you are using it wrong :) The service name that you have to work with is actually SharedAccess and not the long name you just posted.
[ autoIt ]    ( Popup )
#Include <C:\Projects\Project.Au3\Includes\Service.au3> #Include <Array.au3> _ArrayDisplay(_ServGetDetails("SharedAccess")) $test = _ServStart("SharedAccess") MsgBox(0,"test", $test)


This works for me :)

#13 User is offline   redrider81 

  • Newbie
  • Group: Members
  • Posts: 4
  • Joined: 01-August 08

Posted 01 August 2008 - 08:12 AM

View PostSumTingWong, on Dec 5 2004, 11:18 AM, said:

I have updated my service control functions to take advantage of the new DllOpen and DllClose functions.

I have also added _CreateService and _DeleteService.

All these functions are limited in one way or another and offer only the very basic service control so I suggest you read up on the Windows service control functions on MSDN for more information.

The test script requires winvnc.exe and vnchooks.dll to be copied to the Windows directory. You can download UltraVNC from here. Get the zipped file from the Downloads page.


What an AWESOME UDF!!!


I searched all over for this functionality in a UDF and couldn't find it, so I wrote my own. Now I'm about to post my code and I find this which is way more complete.

Why don't you call it a UDF?
Why isn't it in example scripts?
Why isn't it a UDF included in AutoIT?

Why did I find these dog crap threads before instead of this perfect solution?!?!

http://www.autoitscript.com/forum/lofivers...php?t15251.html
http://www.autoitscript.com/forum/index.php?showtopic=17581

Damn Damn Damn....

Sighs... Oh kay, im over it now. but jeeze man, somebody put this somewhere easy to find.

Alright, somebody just needs to build a GUI for this.

Guess I'll do that.

#14 User is offline   DanielC 

  • Member
  • Pip
  • Group: Full Members
  • Posts: 48
  • Joined: 06-August 08
  • Location:New South Wales, Australia

Posted 20 August 2008 - 02:19 AM

Great stuff, exactly what I needed and it worked like a charm. Well done!

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users

  1. MSN/Bing