Solved

Windows Server 2008 Event Trigger - Remote execution

Posted on 2010-11-19
6
903 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
Space-Age Communications Transitions to DevOps

ViaSat, a global provider of satellite and wireless communications, securely connects businesses, governments, and organizations to the Internet. Learn how ViaSat’s Network Solutions Engineer, drove the transition from a traditional network support to a DevOps-centric model.

 
LVL 2

Accepted Solution

by:
meradz earned 500 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

Edgartown IT Case Study

Learn about Edgartown's quest to ensure the safety and security of the entire town's employee and citizen data. Read the case study!

Question has a verified solution.

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

Suggested Solutions

Citrix XenApp, Internet Explorer 11 set to Enterprise Mode and using central hosted sites.xml file.
You might have come across a situation when you have Exchange 2013 server in two different sites (Production and DR). After adding the Database copy in ECP console it displays Database copy status unknown for the DR exchange server. Issue is strange…
This tutorial will walk an individual through locating and launching the BEUtility application to properly change the service account username and\or password in situation where it may be necessary or where the password has been inadvertently change…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

726 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