Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Some Utilities


  • Please log in to reply
34 replies to this topic
beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004
Here are some dos utilities I use: Download by right-click / Save Target As... (93 KB)

Included in utilities.zip are:

addusers.exe
Can be used to Add, Update, or Delete Windows NT/2000/XP users on local computer or domain.

blat.exe
Can be used to send out emails via SMTP

elogdmp.exe
Windows NT/2000/XP Event Log Query Tool for local and remote PC's. Can export Event Logs to a text file for parsing.

reg.exe
Registry utility that lets you almost do anything to local and remote PC Registries.

rkill.exe & rkillsrv.exe
Remotely Kill processes by name, or PID.

sc.exe
Utility to Add, Update, Delete, Configure, Start, Stop, and Pause Windows Services.

srvany.exe
Utility to run any application as a service. This doesn't have a built in help, but if anyone is interested on how to use this let me know.

thanks,
beardboy

Beastmaster
  • Guests
  • Last active:
  • Joined: --
If you use Blat (Thx beardboy :D ) here's his perfect partner

GetMail
Easily download mail to your harddrive from the command line!

JonTheNiceGuy
  • Members
  • 22 posts
  • Last active: Oct 03 2013 01:33 PM
  • Joined: 22 Apr 2004
I've had a few problems running a script as a scheduled task in Windows 2k, (I'm guessing it's because it can't activate and de-activate the tasks) however, will this get around this problem?

Jon

beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004
Are you going to want to the script running all the time? Or are you going to want it to run at certain times?

thanks,
beardboy

JonTheNiceGuy
  • Members
  • 22 posts
  • Last active: Oct 03 2013 01:33 PM
  • Joined: 22 Apr 2004
Probably at a regular time each week.

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
AHK definitely isn't designed to be run as a service, or by any scheduler that runs things in the absence of a desktop. I'd be interested to know if anyone gets such a thing working or can explain how application windows can even exist when there is no desktop.

JonTheNiceGuy
  • Members
  • 22 posts
  • Last active: Oct 03 2013 01:33 PM
  • Joined: 22 Apr 2004
I'd made the assumption (probably wrongly) that you can "force" a service to interact with the desktop?

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
Now that you mention it, I do seem to remember an option like that. If there are any server admins here, maybe they can confirm.

beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004
You can setup services to interact with the desktop. I had an AHK application that I had run as a service, and everything was running fine. Except for a Clipper application that I ran from the AHK service sometimes had some problems.

If you want your application to only run at a regular time each week, you could have it always running and just write in your script to kick off and do stuff at the designated time.

Here are two simple lines to add any program as a service. AHKService is the name you choice for your service, make sure to change that on both lines if you change the name. Srvany.exe can be placed anywhere I just put it in the winnt\system32 folder. And your Program which I named as AHKProgram of course can have any name and be in any folder.
sc create AHKService binPath= c:\winnt\system32\srvany.exe type= own type= interact start= auto

reg add HKLM\system\currentcontrolset\services\AHKService\Parameters\Application=c:\winnt\AHKProgram.exe
After you run both those commands you will have a service that will be startable. You can go into Services and change who the service logs in as, if you want it to start automaticlly, manually, etc...

If you have any questions let me know.

thanks,
beardboy

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
an addition to ur list beardboy:

a small (25k) command line utility to view, kill, suspend/resume or set the priority and affinity of processes. (free)

http://www.beyondlog...processutil.htm

btw there r some more nice utils for networks on this site.

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
i tried srvany. i made sure that both cmds gave success messages. i tried it with with a compiled ahk script... it just had this:

loop
{
	fileappend, %A_Hour%:%A_Min%:%A_Sec%`n, c:\timer.txt
	sleep, 5000
}

nothing happened.

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004
That's a little disappointing. Maybe there's something in the code that prevents AutoHotkey from launching if it doesn't have access to the desktop or the Explorer shell. Has anyone ever gotten a script, compiled or otherwise, to launch as a service and do something useful?

Atomhrt
  • Members
  • 124 posts
  • Last active: Nov 13 2006 09:18 PM
  • Joined: 02 Sep 2004

That's a little disappointing. Maybe there's something in the code that prevents AutoHotkey from launching if it doesn't have access to the desktop or the Explorer shell. Has anyone ever gotten a script, compiled or otherwise, to launch as a service and do something useful?


It works for me! :D

Here is my registry tree:
REGEDIT4

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AHKService]
"Type"=dword:00000110
"Start"=dword:00000002
"ErrorControl"=dword:00000001
"ImagePath"=hex(2):45,3a,5c,50,72,6f,67,72,61,6d,20,46,69,6c,65,73,5c,52,65,73,\
  6f,75,72,63,65,20,4b,69,74,5c,73,72,76,61,6e,79,2e,65,78,65,00
"ObjectName"="LocalSystem"

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AHKService\Parameters]
"Application"="c:\\autokey\\test.exe"


[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AHKService\Security]
"Security"=hex:01,00,14,80,90,00,00,00,9c,00,00,00,14,00,00,00,30,00,00,00,02,\
  00,1c,00,01,00,00,00,02,80,14,00,ff,01,0f,00,01,01,00,00,00,00,00,01,00,00,\
  00,00,02,00,60,00,04,00,00,00,00,00,14,00,fd,01,02,00,01,01,00,00,00,00,00,\
  05,12,00,00,00,00,00,18,00,ff,01,0f,00,01,02,00,00,00,00,00,05,20,00,00,00,\
  20,02,00,00,00,00,14,00,8d,01,02,00,01,01,00,00,00,00,00,05,0b,00,00,00,00,\
  00,18,00,fd,01,02,00,01,02,00,00,00,00,00,05,20,00,00,00,23,02,00,00,01,01,\
  00,00,00,00,00,05,12,00,00,00,01,01,00,00,00,00,00,05,12,00,00,00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\AHKService\Enum]
"0"="Root\\LEGACY_AHKSERVICE\\0000"
"Count"=dword:00000001
"NextInstance"=dword:00000001


Note I used slightly different paths... And I did have to use different reg.exe parameters since it was obvious that beardboy was using a version that is not the same as mine. Here is the reg.exe command that I used:

reg add HKLM\system\currentcontrolset\services\AHKService\Parameters /v Application /d c:\autokey\test.exe

Output:
C:\autokey>cat \timer.txt
17:55:00
17:55:05
17:55:10
17:55:15
17:55:20
17:55:25
I am he of whom he speaks!

Rajat
  • Members
  • 1904 posts
  • Last active: Jul 17 2015 07:45 AM
  • Joined: 28 Mar 2004
thanx. i'll check it out.

MIA

CleanNews.in : Bite sized latest news headlines from India with zero bloat


beardboy
  • Members
  • 443 posts
  • Last active: May 27 2017 08:41 AM
  • Joined: 02 Mar 2004
Sorry I never posted a tutorial on how to get this setup correctly.

First I copy srvany.exe into the system32 folder.
Then using sc.exe I would create a new service. You have to point the name of the exe for the service to srvany.exe
sc create AHKService binPath= c:\winnt\system32\srvany.exe type= own type= interact start= auto
Then you have to update the registry to point to your AHK Script or EXE:
RegWrite, REG_SZ, HKLM, system\currentcontrolset\services\AHKService\Parameters, Application, c:\winnt\system32\AHKScript.exe
Once both these are done if you start the service named AHKService it will start the program srvany.exe and it will start AHKScript.exe.

After you get this all setup you can modify the service to run as an administrator user instead of it being interactive and it could run even if the computer isn't logged on, and or do system tasks that don't require desktop interaction. I have a script I wrote to auto connect me to my work's VPN, and it will have me logged in and connected to the office before I even login to windows.

Let me know if anyone else has any questions.

thanks,
beardboy