windows batch file wont start.
-
- Posts: 32
- Joined: Tue Dec 17, 2002 6:00 pm
windows batch file wont start.
Hello,
i've made a batchfile to get the appropriate strings from a logfile. The batch works fine when run manually. It also runs fine when hostmonitor is in gui mode, but when it runs as a service i get an "unable to start script" error.
It can't be an authentication problem, since in gui mode and as service it uses the same account (service account).
is there any more detailed information of why the script is unable to start?
i've made a batchfile to get the appropriate strings from a logfile. The batch works fine when run manually. It also runs fine when hostmonitor is in gui mode, but when it runs as a service i get an "unable to start script" error.
It can't be an authentication problem, since in gui mode and as service it uses the same account (service account).
is there any more detailed information of why the script is unable to start?
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Re: windows batch file wont start.
What command do you use to lauch script? cmd /c cscript /B /E:VBScript %Script% %Params%?
Could you try to specify full patch to cmd and cscript modules (in case environ variable does not contain path...)?
Is script located on network (mapped drive)? If yes, I would recommend to change mapped letter to UNC path, e.g. \\server\folder\script.
Regards,
Max
Could you try to specify full patch to cmd and cscript modules (in case environ variable does not contain path...)?
Is script located on network (mapped drive)? If yes, I would recommend to change mapped letter to UNC path, e.g. \\server\folder\script.
Regards,
Max
-
- Posts: 32
- Joined: Tue Dec 17, 2002 6:00 pm
i'm using the cmd /c %Script% %Params% command and just copied the script in the shell command script field. i have no reference to a script located somewhere on a disk (made a copy of the file compare example script and replaced that code with my code; it's a cmd batch).
besides, that wouldn't explain why it does run in gui mode.
edit: all references in the script to logfiles etc are on the localdisk.
besides, that wouldn't explain why it does run in gui mode.
edit: all references in the script to logfiles etc are on the localdisk.
Last edited by iis5_rulez on Fri Jul 28, 2006 5:49 am, edited 1 time in total.
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Sorry, could not reproduce such problem. Could you export that certain test into file, using File > Export To Text File menu and export script into file, using Script Manager > Export button, and send import file to support@ks-soft.net?
BTW. What account you have specified on Options >Service page?
Quote from the manual:
Max
BTW. What account you have specified on Options >Service page?
Quote from the manual:
Regards,Log on as
Specify user account (login and password) to impersonate the security context of the user.
When HostMonitor starts as a service, it uses the system account (as all interactive services). But this account may not have all the necessary permissions, so some tests will not work correctly (UNC test, "disk free space" test for shared drives, "CPU Usage" test for remote machines, etc). If you need these tests, you will need to assign a special user account. In this case HostMonitor will impersonate the security context of the user.
Note: Do not change the account using the system utility "Services". If you do so, HostMonitor will not be able to interact with the desktop.
Max
-
- Posts: 32
- Joined: Tue Dec 17, 2002 6:00 pm
on options > startup > service is the same account as the serviceaccount used to startup the service in services.msc. the hostmonitor service is not started by local system.KS-Soft Europe wrote:Sorry, could not reproduce such problem. Could you export that certain test into file, using File > Export To Text File menu and export script into file, using Script Manager > Export button, and send import file to support@ks-soft.net?
BTW. What account you have specified on Options >Service page?
Quote from the manual:Regards,Log on as
Specify user account (login and password) to impersonate the security context of the user.
When HostMonitor starts as a service, it uses the system account (as all interactive services). But this account may not have all the necessary permissions, so some tests will not work correctly (UNC test, "disk free space" test for shared drives, "CPU Usage" test for remote machines, etc). If you need these tests, you will need to assign a special user account. In this case HostMonitor will impersonate the security context of the user.
Note: Do not change the account using the system utility "Services". If you do so, HostMonitor will not be able to interact with the desktop.
Max
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
It is recommended to leave "Logon as: Local system account" and check "Allow service interract with desktop" option in services.msc > Log On tab. Account to start service you should specify in Options > Startup > Service. In other case service will not be able to interact with the desktop (you will not see HostMonitor icon in system tray). Might be, you have two instances of HostMonitor, one as service and another as application? You may verify it using Task Manager > Processes tab.iis5_rulez wrote:on options > startup > service is the same account as the serviceaccount used to startup the service in services.msc. the hostmonitor service is not started by local system.
Regards,
Max
-
- Posts: 32
- Joined: Tue Dec 17, 2002 6:00 pm
we cant do that. simply because we do tests to other machines using that account. I think we set it up like this, because the impersonate function didn't work correctly in the 5.30 version, or maybe the previous one (4.xx was the first we used i think).
when we want to edit tests, we stop the service and startup the gui (in a stopped state, since we're performing so many tests, leaving hostmonitor running makes editing very annoying
). This is done by a batch, which also starts up the service when the gui is closed.
the privilege "logon as a batch job" didnt help either.
when we want to edit tests, we stop the service and startup the gui (in a stopped state, since we're performing so many tests, leaving hostmonitor running makes editing very annoying

the privilege "logon as a batch job" didnt help either.
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
I think you have selected "Autosave TestList after any changes" option on Options > Preferences tab, Autosave options dropdown. With this option enabled it really takes a lot of time to edit test, especially if you have set many tests up.iis5_rulez wrote:when we want to edit tests, we stop the service and startup the gui (in a stopped state, since we're performing so many tests, leaving hostmonitor running makes editing very annoying).

Not bad solution.iis5_rulez wrote:This is done by a batch, which also starts up the service when the gui is closed.
It's a pity. What about "cmd.exe" permissions? I was able to reproduce "unable to start script" error when I restricted access for HostMonitor user to file "cmd.exe". Could you verify permissions on cmd.exe and \windows\system32 folder for HostMonitor user?iis5_rulez wrote:the privilege "logon as a batch job" didnt help either.
Regards,
Max
-
- Posts: 32
- Joined: Tue Dec 17, 2002 6:00 pm
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Could you specify full path to cmd.exe here? E.g. C:\windows\system32\cmd.exe /c %Script% %Params%. Some environment variables might not be initialized in service session.iis5_rulez wrote:i'm using the cmd /c %Script% %Params% command and just copied the script in the shell command script field.
Regards,
Max
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact:
Have you tried the newest version of HostMonitor? The service related code has been changed a bit since version 5.30. I would suggest you to try version 6.10 http://www.ks-soft.net/hostmon.eng/downpage.htm
Regards,
Max
Regards,
Max
-
- Posts: 32
- Joined: Tue Dec 17, 2002 6:00 pm
the full path doesnt seem to work.
I was wondering if the reason of the "unable to start script" error is logged somewhere.
restricted access to the cmd file would give the w32 error access denied (0x80070005). if i have a similar error i'd would have more of a direction to look for problems.
We'll be upgrading to 6.10 but not today
I was wondering if the reason of the "unable to start script" error is logged somewhere.
restricted access to the cmd file would give the w32 error access denied (0x80070005). if i have a similar error i'd would have more of a direction to look for problems.
We'll be upgrading to 6.10 but not today

-
- Posts: 32
- Joined: Tue Dec 17, 2002 6:00 pm
i've been able to reproduce the error with v6.10.
I've installed hostmonitor and service. Then i've set in hostmonitor startup > service > log on as "my username".
In services.msc i've set "my username" as startup account as well.
I'd made a simple shell script:
@echo off
IF "%1"=="" echo ScriptRes:Bad:0
if not "%1"=="" echo ScriptRes:Ok:1
exit
When i run this in gui mode, all works ok. When i run this in service mode, i get the "unable to start script"
edit:
when i made a typing error in the hostmonitor startup > service it did run properly... (not sure which account it uses then, the service account or does it fall back to local system account?)
I've installed hostmonitor and service. Then i've set in hostmonitor startup > service > log on as "my username".
In services.msc i've set "my username" as startup account as well.
I'd made a simple shell script:
@echo off
IF "%1"=="" echo ScriptRes:Bad:0
if not "%1"=="" echo ScriptRes:Ok:1
exit
When i run this in gui mode, all works ok. When i run this in service mode, i get the "unable to start script"
edit:
when i made a typing error in the hostmonitor startup > service it did run properly... (not sure which account it uses then, the service account or does it fall back to local system account?)
-
- Posts: 2832
- Joined: Tue May 16, 2006 4:41 am
- Contact: