473,545 Members | 1,884 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Detect Remote Shutdown

Hey all,

I have a small app I have developed that periodically pings a list of server
and returns their status. Given my environment I have setup the program such
that a server can be down 4 minutes before I get an alert.

My problem now is that is a server is rebooted, it will be back up before
the 4 minute window and I will not be aware that it has rebooted.

I am looking for a way (as an administrator, or not, if possible) to detect
the reboot of a remote machine. I have found code to initiate a local and
remote reboot, but not a way to detect one is happening, can anyone shed
some light here for me?

Thanks!
chrisj
Jan 17 '06 #1
4 2789
You should be able to get the server boottime using WMI.. Try :
http://msdn.microsoft.com/library/de...management.asp
(how long a computer has been running).

--
Patrice

"Chris Johnson" <ra*****@gmail. com> a écrit dans le message de
news:OK******** *****@TK2MSFTNG P15.phx.gbl...
Hey all,

I have a small app I have developed that periodically pings a list of server and returns their status. Given my environment I have setup the program such that a server can be down 4 minutes before I get an alert.

My problem now is that is a server is rebooted, it will be back up before
the 4 minute window and I will not be aware that it has rebooted.

I am looking for a way (as an administrator, or not, if possible) to detect the reboot of a remote machine. I have found code to initiate a local and
remote reboot, but not a way to detect one is happening, can anyone shed
some light here for me?

Thanks!
chrisj

Jan 17 '06 #2
Patrice,

Not a bad idea. I will try that one for now. If anyone has a way to actually
detect the shutdown even I am also still interested in that.

Thanks again Patrice for the quick response!
chrisj

"Patrice" <no****@nowhere .com> wrote in message
news:O0******** ******@tk2msftn gp13.phx.gbl...
You should be able to get the server boottime using WMI.. Try :
http://msdn.microsoft.com/library/de...management.asp
(how long a computer has been running).

--
Patrice

"Chris Johnson" <ra*****@gmail. com> a écrit dans le message de
news:OK******** *****@TK2MSFTNG P15.phx.gbl...
Hey all,

I have a small app I have developed that periodically pings a list of

server
and returns their status. Given my environment I have setup the program

such
that a server can be down 4 minutes before I get an alert.

My problem now is that is a server is rebooted, it will be back up before
the 4 minute window and I will not be aware that it has rebooted.

I am looking for a way (as an administrator, or not, if possible) to

detect
the reboot of a remote machine. I have found code to initiate a local and
remote reboot, but not a way to detect one is happening, can anyone shed
some light here for me?

Thanks!
chrisj


Jan 17 '06 #3
Just an idea, you could write a service as that has an OnStop handler, and
will be stopped when the server reboots. In the OnStop Handler you could
send a message via IP Socket to the app running to detect the shut down.

"Chris Johnson" <ra*****@gmail. com> wrote in message
news:eQ******** ******@TK2MSFTN GP15.phx.gbl...
Patrice,

Not a bad idea. I will try that one for now. If anyone has a way to
actually detect the shutdown even I am also still interested in that.

Thanks again Patrice for the quick response!
chrisj

"Patrice" <no****@nowhere .com> wrote in message
news:O0******** ******@tk2msftn gp13.phx.gbl...
You should be able to get the server boottime using WMI.. Try :
http://msdn.microsoft.com/library/de...management.asp
(how long a computer has been running).

--
Patrice

"Chris Johnson" <ra*****@gmail. com> a écrit dans le message de
news:OK******** *****@TK2MSFTNG P15.phx.gbl...
Hey all,

I have a small app I have developed that periodically pings a list of

server
and returns their status. Given my environment I have setup the program

such
that a server can be down 4 minutes before I get an alert.

My problem now is that is a server is rebooted, it will be back up
before
the 4 minute window and I will not be aware that it has rebooted.

I am looking for a way (as an administrator, or not, if possible) to

detect
the reboot of a remote machine. I have found code to initiate a local
and
remote reboot, but not a way to detect one is happening, can anyone shed
some light here for me?

Thanks!
chrisj



Jan 18 '06 #4
Thats the direction Im going with the project next. Im currently writting my
"jr." application to report into the parent. Might throw some more questions
out once I get a bit farther but thanks for the hint!

chrisj

"Richy" <su**********@c rosskeysonline. co.uk> wrote in message
news:11******** *******@ernani. logica.co.uk...
Just an idea, you could write a service as that has an OnStop handler, and
will be stopped when the server reboots. In the OnStop Handler you could
send a message via IP Socket to the app running to detect the shut down.

"Chris Johnson" <ra*****@gmail. com> wrote in message
news:eQ******** ******@TK2MSFTN GP15.phx.gbl...
Patrice,

Not a bad idea. I will try that one for now. If anyone has a way to
actually detect the shutdown even I am also still interested in that.

Thanks again Patrice for the quick response!
chrisj

"Patrice" <no****@nowhere .com> wrote in message
news:O0******** ******@tk2msftn gp13.phx.gbl...
You should be able to get the server boottime using WMI.. Try :
http://msdn.microsoft.com/library/de...management.asp
(how long a computer has been running).

--
Patrice

"Chris Johnson" <ra*****@gmail. com> a écrit dans le message de
news:OK******** *****@TK2MSFTNG P15.phx.gbl...
Hey all,

I have a small app I have developed that periodically pings a list of
server
and returns their status. Given my environment I have setup the program
such
that a server can be down 4 minutes before I get an alert.

My problem now is that is a server is rebooted, it will be back up
before
the 4 minute window and I will not be aware that it has rebooted.

I am looking for a way (as an administrator, or not, if possible) to
detect
the reboot of a remote machine. I have found code to initiate a local
and
remote reboot, but not a way to detect one is happening, can anyone
shed
some light here for me?

Thanks!
chrisj



Jan 18 '06 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
7568
by: Tim Gosselin | last post by:
I am writing a tcp tunnel but cannot find a way of detecting when a socket shuts down its read end without writing to the socket. For testing the write end of the remote endpoint I just do a: if not sock.recv(buffsize) I cannot write to the socket and check if send returns 0 though, because that involves sending data out of the which may...
2
4595
by: Austin | last post by:
I wrote a program running on windows. I put the link of the program in "Start up" folder and let it executed minimized. Every time when I open the computer, my program will be running in system tray. But if the user would like to shutdown the computer, the OS will show an error about exception. At first, I think windows will terminate...
2
3774
by: Austin | last post by:
My program is running on windows and it is wrritten by Python and wxPython, built by py2exe. If my program is executed minimized, and the user want to shutdown or reboot. Meanwhile, my program is running and it has several threads running, too. The shutdown or reboot will cause a error of my program. Is there any way to dectect windows...
0
1787
by: Hansi | last post by:
How can i start a winforms application on remote workstation, no matter who or if there is somebody logged in? My problems: 1) I need to shutdown computers in the evening that have not been shutdown by the (roaming) users, no matter if there is somebody logged in or not. If there is somebody logged in and sitting in front of the PC, he...
6
9412
by: Adnan Hebibovic | last post by:
Hello developers How can I detect Windows shutdown from .NET and I mean clean .NET not catching the events with Win32 API ... Thanks
1
1926
by: Jerry Camel | last post by:
How do you detect when a system is being logged off or shutdown? In VB 6 there was a QueryUnload event that would work if you had a form, but I'm running in a Sub Main scenario... I can't find any events to code for... Is there a way to register with the system to be notified of the logoff/shutdown? Thanks. Jerry
13
2402
by: Shailesh Humbad | last post by:
Here is an advanced PHP question. Can anyone think of a way to detect the number of bytes written to output when a script is aborted? I am sending a large file to the client, and I want to record how many bytes are actually sent. I can detect abort of the script using a shutdown handler. In the shutdown handler, I tried ob_get_length, but...
0
1703
by: Christian Jacob | last post by:
Hi there, I've got a serious problem with getting a remote shutdown functionality working with VB.NET. I am using WMI to query the target PC and invoke the Win32Shutdown method like this: Dim aoInParams() As Object = {8} For Each mngObj As ManagementObject In mngColl mngObj.Scope.Options.EnablePrivileges = True
3
26988
by: joja15 | last post by:
I am working on a Python script to perform as a remote computer manager. So far I have a WOL function working and I would like to add the ability to show if a machine is on or off (I figured I would do so by pinging the machine and seeing if I get a response). I would also like to add the ability to remotely shutdown a computer from the...
0
7478
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7410
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7923
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7437
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
5984
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
4960
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
0
3466
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3448
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1025
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.