| View previous topic :: View next topic |
| Author |
Message |
Rajat
Joined: 28 Mar 2004 Posts: 1718
|
Posted: Fri Sep 10, 2004 6:55 am Post subject: |
|
|
posting the relevant sections from that script would help!  _________________
 |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Fri Sep 10, 2004 7:28 am Post subject: |
|
|
From my vpn connecting script?
Here is the basis of it:
| Code: | Loop
{
Loop, HKEY_LOCAL_MACHINE, SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\Interfaces, 1, 1
{
RegRead, value
if a_LoopRegName = DhcpDomain
{
domain = %value%
}
}
if domain <> workdomain.com
{
IfNotExist, \\computeratoffice\c\
{
RunWait, VPNClient.exe
}
}
Sleep, 100
} |
The full script is over 380 lines long. With tooltips, traytips, changing icon in the system tray for when I am connected vs. not connected, etc...
thanks,
beardboy |
|
| Back to top |
|
 |
Rajat
Joined: 28 Mar 2004 Posts: 1718
|
Posted: Fri Sep 10, 2004 12:11 pm Post subject: |
|
|
i thought maybe u've converted the service creation procedure to ahk script... but its ok. _________________
 |
|
| Back to top |
|
 |
Atomhrt
Joined: 02 Sep 2004 Posts: 128 Location: Sunnyvale
|
Posted: Fri Sep 10, 2004 5:52 pm Post subject: |
|
|
| beardboy wrote: | Sorry I never posted a tutorial on how to get this setup correctly.
First I copy srvany.exe into the system32 folder.
|
I did not have to do this, it ran fine straight from my Program files\Resource Kit directory. Using XP SP1. As long as the full path to srvany is in the ImagePath registry key, it should work. _________________ I am he of whom he speaks! |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Sat Sep 11, 2004 6:46 am Post subject: |
|
|
| Atomhrt wrote: | | I did not have to do this, it ran fine straight from my Program files\Resource Kit directory. Using XP SP1. As long as the full path to srvany is in the ImagePath registry key, it should work. |
Correct, I just put that on there for people that might download it off of the web and not install it with Resource Kit, it just needs to be in a folder that is specified in the path. Or a direct path needs to be specified.
| Rajat wrote: | | i thought maybe u've converted the service creation procedure to ahk script... but its ok. |
Nope sorry, it was just easier to use sc.exe and reg.exe to quickly add a service.
thanks,
beardboy |
|
| Back to top |
|
 |
arabinow
Joined: 09 Feb 2006 Posts: 19
|
Posted: Thu Feb 09, 2006 10:23 pm Post subject: How do I use your srvany.exe utility? |
|
|
| How do I use your srvany.exe utility? When I open srvany.exe the dos window just quickly flashes. I need to use that utility to turn an application into a service. |
|
| Back to top |
|
 |
BoBo Guest
|
Posted: Thu Feb 09, 2006 11:36 pm Post subject: |
|
|
| Check its outcome. |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Fri Feb 10, 2006 1:00 am Post subject: |
|
|
First you need to create a service using SC.exe
| Code: | | sc.exe create MyService binPath= c:\windows\system32\srvany.exe type= own type= interact start= auto |
Then after you create the service you need to modify the program you want srvany to start and stop for you using REG.exe
| Code: | | reg.exe add HKLM\system\currentcontrolset\services\MyService\Parameters\Application=notepad.exe |
The only things you need to change are the service name if you want it different "MyService", the program you want to run "notepad.exe", and the location of srvany.exe if you have it located somewhere else.
Let me know if you have any more questions.
thanks,
beardboy |
|
| Back to top |
|
 |
arabinow
Joined: 09 Feb 2006 Posts: 19
|
Posted: Fri Feb 10, 2006 4:02 pm Post subject: Configuring the newly created service to run at a particular |
|
|
Is there a way to configure the service to run at a particular time instead of running when a user logs into the Windows 2003 system? Thank you.
Let me just summarize my problem: I have programmed my scripts and compiled them into executables. I then used Windows Scheduler to schedule my execuatbales for a particualr time. Everything worked great until I tried to run my scheduled tasks while my screen was locked. I am hoping this issue will be resolved by making my scripts into services instead of appliactions. What are your thoughts on this issue? Thank you. |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Fri Feb 10, 2006 4:28 pm Post subject: |
|
|
My suggestion would be to have your compiled exe's just run your needs at a particular time. Setup a compiled exe that only runs what you want to run at specific times (within your ahk code, if time = this time run this...). Then you have that exe started as a service, it will always be running even if you aren't logged into the computer.
thanks,
beardboy |
|
| Back to top |
|
 |
arabinow
Joined: 09 Feb 2006 Posts: 19
|
Posted: Fri Feb 10, 2006 5:17 pm Post subject: I need a little more help to get this to work |
|
|
Do you have any example code for the function if Time = ?
Also, I am having trouble starting my test service. Heres what I did:
1) I created a quick test script that has the following code:
Run, Notepad.exe
WinWait, Untitled - Notepad,
IfWinNotActive, Untitled - Notepad, , WinActivate, Untitled - Notepad,
WinWaitActive, Untitled - Notepad,
Send, test
Sleep, 100
2) I compiled the script called notepad2.exe and copied it along with the sc.exe and sryan.exe into the /system32 directory
3) I ran the following commands in the command line:
sc.exe create Notepad2 binPath= c:\windows\system32\srvany.exe type= own type= interact start= auto
reg.exe add HKLM\system\currentcontrolset\services\Notepad2\Parameters\Application=notepad2.exe
4) I tried to manually start my service and I got the following error message:
The Notepad2 service on Local Computer started and then stopped. Some services stop automatically if they have no work to do, for example, Performance Lof and Alerts service.
Do you know how I can prevent the service from automatically stopping? Thank you so much for all of your help! |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Fri Feb 10, 2006 5:22 pm Post subject: |
|
|
Is your windows directory "c:\windows" or "c:\winnt"?
The other thing is if you are running XP, XP comes with a newer version of Reg, which might have setup the registry key wrong. I suggest putting the reg.exe that you downloaded here and put it in a specific folder on your computer then runing the reg.exe command you listed from that directory.
thanks,
beardboy |
|
| Back to top |
|
 |
arabinow
Joined: 09 Feb 2006 Posts: 19
|
Posted: Fri Feb 10, 2006 5:32 pm Post subject: I use Winnt |
|
|
I use Winnt put I did remember to edit that before I hit enter on the command line.
Let me make sure I understand what you are saying. Do you want me to do the following:
Step 1) Take the reg.exe that I downloaded from your Utilities.zip directory and copy it to C:\Winnt\System32
Step 2) Take the reg.exe that I downloaded from your Utilities.zip directory and copy it to a directory of my choice
Step 3) Double click and run the reg.exe from Step 2
Thank you so much for all the help. |
|
| Back to top |
|
 |
beardboy
Joined: 02 Mar 2004 Posts: 444 Location: SLC, Utah
|
Posted: Fri Feb 10, 2006 7:22 pm Post subject: |
|
|
Try this for me instead.
sc.exe start Notepad2
And let me know what it says.
thanks,
beardboy |
|
| Back to top |
|
 |
arabinow
Joined: 09 Feb 2006 Posts: 19
|
Posted: Fri Feb 10, 2006 7:26 pm Post subject: |
|
|
This is what it says:
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.
C:\>sc.exe start Notepad2
SERVICE_NAME: Notepad2
TYPE : 110 WIN32_OWN_PROCESS (interactive)
STATE : 3 STOP_PENDING
(STOPPABLE,PAUSABLE,ACCEPTS_SHUTDOWN)
WIN32_EXIT_CODE : 0 (0x0)
SERVICE_EXIT_CODE : 0 (0x0)
CHECKPOINT : 0x0
WAIT_HINT : 0x0
PID : 3492
FLAGS :
Thank you so much for all the help. |
|
| Back to top |
|
 |
|