SoftTree Technologies SoftTree Technologies
Technical Support Forums
RegisterSearchFAQMemberlistUsergroupsLog in
Running an executable remotely

 
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite View previous topic
View next topic
Running an executable remotely
Author Message
Shaikh Haque



Joined: 04 Oct 2005
Posts: 6

Post Running an executable remotely Reply with quote

Hi,
I am completly new in this environment. I need run an executable remotely on a server, in order to load some data on the database. Also this exectable will run with a particular user's credential. If anybody out there can shade any light on this, then I could resolve this issue very quickly.
Thanks.
Shaikh

Tue Oct 04, 2005 12:17 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7842

Post Re: Running an executable remotely Reply with quote

You need to 3 things:
1. (1-time thing) Install 24x7 scheduler or agent on remote computer
2. (1-time thing) On the main scheduler computer create new agent profile describing how to connect to remote agent
3. On the main scheduler computer create a job and in the job properties specify proper domain/user/password for the job and also select agent's profile name in the host drop-down list. The rest is the same as creating any other job.

: Hi,
: I am completly new in this environment. I need run an executable remotely on
: a server, in order to load some data on the database. Also this exectable
: will run with a particular user's credential. If anybody out there can
: shade any light on this, then I could resolve this issue very quickly.
: Thanks.
: Shaikh

Tue Oct 04, 2005 2:42 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7842

Post Re: Running an executable remotely Reply with quote

Please take a look at http://www.softtreetech.com/24x7/archive/agent.htm. This may help you to set agent connection.

: You need to 3 things: 1. (1-time thing) Install 24x7 scheduler or agent on
: remote computer
: 2. (1-time thing) On the main scheduler computer create new agent profile
: describing how to connect to remote agent
: 3. On the main scheduler computer create a job and in the job properties
: specify proper domain/user/password for the job and also select agent's
: profile name in the host drop-down list. The rest is the same as creating
: any other job.

Tue Oct 04, 2005 2:50 pm View user's profile Send private message
Shaikh Haque



Joined: 04 Oct 2005
Posts: 6

Post Re: Running an executable remotely Reply with quote

: You need to 3 things: 1. (1-time thing) Install 24x7 scheduler or agent on
: remote computer
: 2. (1-time thing) On the main scheduler computer create new agent profile
: describing how to connect to remote agent
: 3. On the main scheduler computer create a job and in the job properties
: specify proper domain/user/password for the job and also select agent's
: profile name in the host drop-down list. The rest is the same as creating
: any other job.

I tried this and it only works, when I keep the server console in logged in state. I soon as I log off the job file with the following message:
Failed to execute remote job. Agent not found. Requested server not active.
Please help.
Shaikh Haque

Tue Oct 04, 2005 3:13 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7842

Post Re: Running an executable remotely Reply with quote

If you don't run the agent as a service under LocalSystem or domain admin account and log off from the system, the system will automatically shutdown all running applications and services, extept these that I mentioned. If you prefer to run the agent in standalone server mode consider locking the Desktop WinFlag+L instead of logging off.

: I tried this and it only works, when I keep the server console in logged in
: state. I soon as I log off the job file with the following message: Failed
: to execute remote job. Agent not found. Requested server not active.
: Please help.
: Shaikh Haque

Tue Oct 04, 2005 4:37 pm View user's profile Send private message
Shaikh Haque



Joined: 04 Oct 2005
Posts: 6

Post Re: Running an executable remotely Reply with quote

: If you don't run the agent as a service under LocalSystem or domain admin
: account and log off from the system, the system will automatically
: shutdown all running applications and services, extept these that I
: mentioned. If you prefer to run the agent in standalone server mode
: consider locking the Desktop WinFlag+L instead of logging off.

As a matter of fact,
I would like to run the following on a remote machine:
______________________________________________________________
MySysInfo.vbs:

Const HKEY_LOCAL_MACHINE = &H80000002
strComputer = "."

Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\" & _

strComputer & "\root\default:StdRegProv")

strKeyPath = "SOFTWARE\My_ System_Info"

objReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath

Dim WshShell, MachineModel

Set WshShell = WScript.CreateObject("WScript.Shell")
Set WSHShell = CreateObject("WScript.Shell")

set o = CreateObject("WScript.Shell")

RegKey = "HKLM\System\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName"

ComputerName = WSHShell.RegRead(RegKey & "")

o.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\BMO System Info\HostName:", ComputerName

__________________________________________________________________________________
It works, when I run it locally with out any error message. Also I ran this on a remote machine via Task Scheduler by typing the following in the RUN window:
CSCRIPT \\My_IP_Address\My_Share_Name\MySysInfo.vbs and runs with out any error message.
But, a task assigned to me to implement the above via 24x7.
I tried the following:
Dim Test_Job
Test_Job="MySysInfo"
@SCRIPT: \\My_IP_Address\My_Share_Name\MySysInfo.vbs
and I receive the following error message:
An error occurred while executing automation script: Line 1: Invalid datatype

Please help me out to resolve this issue.
Shaikh

Tue Oct 04, 2005 6:48 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7842

Post Re: Running an executable remotely Reply with quote

24x7 supports 2 scripting languages - JAL (Job Automation Language) and VBScript. Do not confuse them. It looks like you have tried to insert your VBSCript into a JAL script job.

There are may way how you can run your VBScript, but by far the most simple is to create a program type job and use the very same command that you used with the Windows task scheduler.

In case if you want to run it as an internal job you will need to copy/paste your script into a VBScript job between "Sub Main" and "End Sub"lines.

In case if you prefer using JAL you can convert the entire thing into a very simple one-line script (see the following example)

// Example
RegistrySetKey "HKEY_LOCAL_MACHINE\SOFTWARE\BMO System Info\HostName", "@V"computer""

That's it.

: ComputerName

: As a matter of fact,
: I would like to run the following on a remote machine:
: ______________________________________________________________
: MySysInfo.vbs: Const HKEY_LOCAL_MACHINE = &H80000002
: strComputer = "."

: Set objReg=GetObject("winmgmts:{impersonationLevel=impersonate}!\\"
: & _

: strComputer & "\root\default:StdRegProv")

: strKeyPath = "SOFTWARE\My_ System_Info"

: objReg.CreateKey HKEY_LOCAL_MACHINE,strKeyPath

: Dim WshShell, MachineModel

: Set WshShell = WScript.CreateObject("WScript.Shell")
: Set WSHShell = CreateObject("WScript.Shell")

: set o = CreateObject("WScript.Shell")

: RegKey =
: "HKLM\System\CurrentControlSet\Control\ComputerName\ComputerName\ComputerName"

: ComputerName = WSHShell.RegRead(RegKey & "")

: o.RegWrite "HKEY_LOCAL_MACHINE\SOFTWARE\BMO System Info\HostName:",
: ComputerName

:
: __________________________________________________________________________________
: It works, when I run it locally with out any error message. Also I ran this
: on a remote machine via Task Scheduler by typing the following in the RUN
: window: CSCRIPT \\My_IP_Address\My_Share_Name\MySysInfo.vbs and runs with
: out any error message.
: But, a task assigned to me to implement the above via 24x7.
: I tried the following: Dim Test_Job
: Test_Job="MySysInfo"
: @SCRIPT: \\My_IP_Address\My_Share_Name\MySysInfo.vbs
: and I receive the following error message: An error occurred while executing
: automation script: Line 1: Invalid datatype

: Please help me out to resolve this issue.
: Shaikh

Tue Oct 04, 2005 7:23 pm View user's profile Send private message
Shaikh Haque



Joined: 04 Oct 2005
Posts: 6

Post Re: Running an executable remotely Reply with quote

: 24x7 supports 2 scripting languages - JAL (Job Automation Language) and
: VBScript. Do not confuse them. It looks like you have tried to insert your
: VBSCript into a JAL script job.

: There are may way how you can run your VBScript, but by far the most simple
: is to create a program type job and use the very same command that you
: used with the Windows task scheduler.

: In case if you want to run it as an internal job you will need to copy/paste
: your script into a VBScript job between "Sub Main" and "End
: Sub"lines.

: In case if you prefer using JAL you can convert the entire thing into a very
: simple one-line script (see the following example)

: // Example
: RegistrySetKey "HKEY_LOCAL_MACHINE\SOFTWARE\BMO System
: Info\HostName", "@V"computer""

: That's it.

I think you missed the line:
I tried the following:
Dim Test_Job
Test_Job="MySysInfo"
@SCRIPT: \\My_IP_Address\My_Share_Name\MySysInfo.vbs

However, I followed your advice, now I am getting the following error message.
Remote Job error! job exit code: -1.

I am not sure, what I am missing and where?
Please help me out.
Shaikh

Tue Oct 04, 2005 7:49 pm View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7842

Post Re: Running an executable remotely Reply with quote

Unfortunately, it is not a case where some little piece is missed. Unfortunately, everything is incorrect there.
I would be really happy to help you; I just do not know where to start helping you.
If this is a JAL job you cannot mix it with VBScript the way you mix it, not to mention it is syntax-incorrect in every line. If this is a VBScript job you cannot use @SCRIPT tag as it is not supported in VBScript jobs, you also do not have Sub Main / End Sub and so on.

You are getting 'Remote Job error! Job exit code: -1" because the way this job is currently defined is not runable.

I suggest you first check the following topics in the on-line help
1. Getting Started / Job Types
2. Visual Basic Script Help / Scripting Conventions
3. 24x7 Job Automation Language Help / Syntax
4. Remote Agents and Remote Jobs / Overview
5. Scheduling Jobs / Managing Jobs / Using Job Templates

This will help you to get a general idea about how to do what you want to do now.

: I think you missed the line: I tried the following: Dim Test_Job
: Test_Job="MySysInfo"
: @SCRIPT: \\My_IP_Address\My_Share_Name\MySysInfo.vbs

: However, I followed your advice, now I am getting the following error
: message.
: Remote Job error! job exit code: -1.

: I am not sure, what I am missing and where?
: Please help me out.
: Shaikh

Tue Oct 04, 2005 10:44 pm View user's profile Send private message
Shaikh Haque



Joined: 04 Oct 2005
Posts: 6

Post Re: Running an executable remotely Reply with quote

: Unfortunately, it is not a case where some little piece is missed.
: Unfortunately, everything is incorrect there.
: I would be really happy to help you; I just do not know where to start
: helping you.
: If this is a JAL job you cannot mix it with VBScript the way you mix it, not
: to mention it is syntax-incorrect in every line. If this is a VBScript job
: you cannot use @SCRIPT tag as it is not supported in VBScript jobs, you
: also do not have Sub Main / End Sub and so on.

: You are getting 'Remote Job error! Job exit code: -1" because the way
: this job is currently defined is not runable.

: I suggest you first check the following topics in the on-line help
: 1. Getting Started / Job Types
: 2. Visual Basic Script Help / Scripting Conventions
: 3. 24x7 Job Automation Language Help / Syntax
: 4. Remote Agents and Remote Jobs / Overview
: 5. Scheduling Jobs / Managing Jobs / Using Job Templates

: This will help you to get a general idea about how to do what you want to do
: now.

I do not agree with you because, when I call the same script from Microsoft
Task scheduler, it works without any error.
Forget about your JAL and VB Mixup. Please tell me the
procedure in a very simple way to run or call VB scritp
via 24x7.
Or supply me a document or URL where I can find help.
Please help me out.
Shaikh

Wed Oct 05, 2005 9:57 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7842

Post Re: Running an executable remotely Reply with quote

I already did so. Please see my previous messages in this thread.

Here it is again:
1. Create new job of program type. DO NOT SELECT SCRIPT TYPE for this job.
2. For the job command line paste or type what you enter for the Windows Task Scheduler
3. For the Host select name of the remote agent where you want to run the job
4. Schedule this job to run as needed.

FYI. 24x7 is an advanced job scheduling and automation system that comes with tons of documentation. You would not try to program an Oracle, SQL Server or other enterprise-level system before learning how to use it, or would you? Same here. This is not a plain vanilla Windows Task Scheduler. Please read the provided documentation and start reading with Getting Started and Overview sections so you can understand how to it works because right now you are jumping both foot into a water in which you don’t yet know main swimming rules.

: I do not agree with you because, when I call the same script from Microsoft
: Task scheduler, it works without any error.
: Forget about your JAL and VB Mixup. Please tell me the
: procedure in a very simple way to run or call VB scritp
: via 24x7.
: Or supply me a document or URL where I can find help.
: Please help me out.
: Shaikh

Wed Oct 05, 2005 11:24 am View user's profile Send private message
Shaikh Haque



Joined: 04 Oct 2005
Posts: 6

Post Re: Running an executable remotely Reply with quote

: I already did so. Please see my previous messages in this thread.

: Here it is again: 1. Create new job of program type. DO NOT SELECT SCRIPT
: TYPE for this job.
: 2. For the job command line paste or type what you enter for the Windows Task
: Scheduler
: 3. For the Host select name of the remote agent where you want to run the job
: 4. Schedule this job to run as needed.

: FYI. 24x7 is an advanced job scheduling and automation system that comes with
: tons of documentation. You would not try to program an Oracle, SQL Server
: or other enterprise-level system before learning how to use it, or would
: you? Same here. This is not a plain vanilla Windows Task Scheduler. Please
: read the provided documentation and start reading with Getting Started and
: Overview sections so you can understand how to it works because right now
: you are jumping both foot into a water in which you don’t yet know main
: swimming rules.

At this point I am not going to do anything fancy. I just
want to run a VB script remotely.
I followed your instruction and now I am getting -
Job Failed. Exit code does nto satisfy exit code condition.

My script runs without any error message, while I run
it from Command Line or MS Task Scheduler.

Now you tell me where and what to read to satisfy the
exit code condition. The way it looks like your product
is little to advanced for our environment. May be we
have to look for some other product in the market.
I shall look forward to hear from you.

Wed Oct 05, 2005 11:50 am View user's profile Send private message
SysOp
Site Admin


Joined: 26 Nov 2006
Posts: 7842

Post Re: Running an executable remotely Reply with quote

You have changed the job exit code condition property from default [ANY] (which means "don't check") to something else. As a result when your script completes 24x7 checks the condition and marks the job as failed because the exit code of your process doesn’t satisfy the condition.

The solution: if you don't care about the exit code, clear the condition property and put [ANY] back or just leave it blank (this is step 3 in the job wizard).

In case if you want to learn more about this feature you can press F1 from anywhere to open up the main help file, click the Index tab and type "Exit Code Condition" without quotes. The index will then list he associated topic(s).

: At this point I am not going to do anything fancy. I just
: want to run a VB script remotely.
: I followed your instruction and now I am getting -
: Job Failed. Exit code does nto satisfy exit code condition.

: My script runs without any error message, while I run
: it from Command Line or MS Task Scheduler.

: Now you tell me where and what to read to satisfy the
: exit code condition. The way it looks like your product
: is little to advanced for our environment. May be we
: have to look for some other product in the market.
: I shall look forward to hear from you.

Wed Oct 05, 2005 12:12 pm View user's profile Send private message
Display posts from previous:    
Reply to topic    SoftTree Technologies Forum Index » 24x7 Scheduler, Event Server, Automation Suite All times are GMT - 4 Hours
Page 1 of 1

 
Jump to: 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


 

 

Powered by phpBB © 2001, 2005 phpBB Group
Design by Freestyle XL / Flowers Online.