Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Windows Server 2008 Event Trigger - Remote execution

Posted on 2010-11-19
6
Medium Priority
?
908 Views
Last Modified: 2012-05-10
I have two servers.  On the first server I have an event trigger that is configured to run a simple batch file when a specified error appears in the application event log.  For this example we'll say that our script performs a port query on TCP 1433 from Server1 our SQL server and prints the output to a text file.  That part works well.  In fact, we have this part working fine from both Server1 and Server2.  

The issue that we're having that is making us perform this test is very intermittent.  The issue might appear on Server1 and Server2 continues to function.  We found out tonight that when this error occurred on Server1 it did not have connectivity on port 1433 to the SQL server.  However, we weren't able to confirm if Server2 had connectivity to the SQL server.  We can assume that it did from looking in its event logs but we need to be able to know for sure.  

So, the question is - is there a way to have script on Server1 call and run a script (or batch file - or an event trigger) on Server2?  Here is the flow that we'd like to achieve.

The event appears in the Server1 event logs which kicks off the event trigger.  The event trigger on Server1 starts a portquery from Server1 to the SQL server (this part is accomplished).  It also runs another script that will initiate the event trigger that is configured on Server2 - or it can call the batch file on Server2 directly so that it will run a portquery from Server2 to the SQL server.

I hope that I've made this clear... difficult to explain.

Thanks,
Lee
0
Comment
Question by:KLCrow
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 4
  • 2
6 Comments
 
LVL 2

Expert Comment

by:meradz
ID: 34177509
Just for clarification, are you looking to forward events from Server1 to Server2, or just looking to execute a remote command from Server1 so that it executes on Server2?

Both are possible.
0
 

Author Comment

by:KLCrow
ID: 34177541
The second.  I want to basically run a portquery command on Server2... from Server1
0
 

Author Comment

by:KLCrow
ID: 34177680
That is - the command should be run on server2 but initiated from server1.  Geesh this stuff isn't difficult but it sure isn't easy to explain it in writing.  :)
0
Migrating Your Company's PCs

To keep pace with competitors, businesses must keep employees productive, and that means providing them with the latest technology. This document provides the tips and tricks you need to help you migrate an outdated PC fleet to new desktops, laptops, and tablets.

 
LVL 2

Accepted Solution

by:
meradz earned 2000 total points
ID: 34178820
I understand. You will need to use winrs and winrm. It has been a while since I had to use them, but here goes:

On the system that you wish to execute commands received remotely, execute this command:
winrm quickconfig

Use winrs command from machine to initiate the remote command:
winrs -r:target command

Microsoft has changed the default ports used in one of their updates, so you may or may not run into issues.
0
 

Author Comment

by:KLCrow
ID: 34180268
Thanks for the help!  I'm in the process of switching from nights to days.  This is a high priority for us but I need a couple of days to adjust to the schedule.  It's nice - I'm switching shifts twice in 3 days this week to support folks.  I'll let you know as soon as I get a chance to work on it.
0
 

Author Closing Comment

by:KLCrow
ID: 34194675
Used the following article for further information:
http://www.windowsnetworking.com/articles_tutorials/How-Windows-Server-2008-WinRM-WinRS.html

Thanks!
0

Featured Post

Does Your Cloud Backup Use Blockchain Technology?

Blockchain technology has already revolutionized finance thanks to Bitcoin. Now it's disrupting other areas, including the realm of data protection. Learn how blockchain is now being used to authenticate backup files and keep them safe from hackers.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Know what services you can and cannot, should and should not combine on your server.
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will give a an overview on how to deploy remote agents in Backup Exec 2012 to new servers. Click on the Backup Exec button in the upper left corner. From here, are global settings for the application such as connecting to a remote Back…
This tutorial will walk an individual through configuring a drive on a Windows Server 2008 to perform shadow copies in order to quickly recover deleted files and folders. Click on Start and then select Computer to view the available drives on the se…
Suggested Courses

721 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question