Solved

Windows Server 2008 Event Trigger - Remote execution

Posted on 2010-11-19
6
899 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
  • 4
  • 2
6 Comments
 
LVL 2

Expert Comment

by:meradz
Comment Utility
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
Comment Utility
The second.  I want to basically run a portquery command on Server2... from Server1
0
 

Author Comment

by:KLCrow
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 
LVL 2

Accepted Solution

by:
meradz earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
Used the following article for further information:
http://www.windowsnetworking.com/articles_tutorials/How-Windows-Server-2008-WinRM-WinRS.html

Thanks!
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

The password reset disk is often mentioned as the best solution to deal with the lost Windows password problem. In Windows 2008, 7, Vista and XP, a password reset disk can be easily created. But besides Windows 7/Vista/XP, Windows Server 2008 and ot…
The recent Microsoft changes on update philosophy for Windows pre-10 and their impact on existing WSUS implementations.
This tutorial will walk an individual through the steps necessary to join and promote the first Windows Server 2012 domain controller into an Active Directory environment running on Windows Server 2008. Determine the location of the FSMO roles by lo…
This tutorial will walk an individual through setting the global and backup job media overwrite and protection periods in Backup Exec 2012. Log onto the Backup Exec Central Administration Server. Examine the services. If all or most of them are stop…

763 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now