Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Running a remote script from a sheduled trigger.

Status
Not open for further replies.
Jan 22, 2002
10
US
We have recently decided to place a server box (Windows 2003) offsite in a neighboring building to provide a little bit of disaster recovery. The box is connected directly to our network and participates in our AD domain as a member server. The machine is connected via single mode fiber running at 100Mbps. It looks and feels just like it is in the data center, but it is about a mile away.

This box has been configured as a data repository box that will hold Oracle redo logs. The process of copying the logs runs every 15 minutes, and moves a fair amount of data.

We also use a seperate scheduling machine that takes care of the automated tasks required on our network.

I need to be able to have the scheduler machine trigger an event that happens betwwen the offsite server and local database servers. The process will use basic robocopy type utlities to move data around. What I DON'T want is for the traffic to actually move throught the scheduler machine at all. I just want it to be able to trigger the events, and notify me if they were not able to execute.

I had thought about just putting a scheduled task on the offsite machine, but that casues two problems: 1) Another place to manage scheduled tasks, and 2) If for some reason the link to the offsite area goes down, there is no method of notification unless I use another system to watch the line.

Anyways, I have looked at RSH abd RCMD but both seem to be limited as far as being able to reach out to the shares on the other servers while execting a remote command. I am unexperienced with VBScript, but am very willing to learn if any one has any suggestions.

Any and all help is really appreciated!

Thanks

Bryan
 
can you please clarify what kind of action you want to take from one machine to the other. Your comment about not wanting the traffic to flow through the scheduler is throwing me. Use real or fictitions computer names, just help me to understand what you are trying to do and I will see if I can help you.



I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Okay.

Server A is an offsite server.
Server B is a local database server
Scheduler C is a local server runnin an automated scheduling process that can execute batch jobs, etc.

I want Scheduler C to start a task at a specific time or interval of time that tells Server A to perform a robocopy of data that resides on a Server B share. The data is copied from Server B to Server A.

I want Scheduler C to be able to tell me if the process was successfully started on Server A.

I hope that helps.

Thanks!

Bryan
 
OK, I see what you are looking for now.

If you have a script that already runs the RoboCopy, then you are in great shape. Just have your Scheduler C call the AT Command to run a local script that does the RoboCopy. You can have that same script report back to Scheduler to let it know if it was successful or not.

Another option you have is to launch a remote process from Scheduler C, have C execute the remote process on Server B.

Some sample code for launching a remote process:

strComputer = "webserver"
Set objWMIService = GetObject("winmgmts:" _
& "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2:Win32_Process")

Error = objWMIService.Create("notepad.exe", null, null, intProcessID)
If Error = 0 Then
Wscript.Echo "Notepad was started with a process ID of " _
& intProcessID & "."
Else
Wscript.Echo "Notepad could not be started due to error " & _
Error & "."
End If


I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Mark,

Thanks for this info!. A couple of questions for clarification. In option one that you mention, will the Robocopy actually run on Server B, or on Scheduler C. If it runs on scheduler C then that means (I believe) that it also touches each packet, which I don't want. I would like to keep it out of the "copy" loop since it resides on a slower connection and a hop away.

On the code, which I REALLY appreciate, can that be used to execute a .CMD script? Are there any particular things to be aware of in that case? I am assuming that the "impersonate" portion is how to deal with the proper levels of authority, rights, etc.

Thanks again for your time and the in fo.
I REALLY appreciate it!

Bryan
 
Bryan, yes, you can have this code open a CMD process remotely. You should probably take a look at PSEXEC fron SysInternals. I think that may actually be the easiest way for you to do what you are looking for.

I hope you find this post helpful. Please let me know if it was.

Regards,

Mark
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top