ni.com is currently undergoing scheduled maintenance.

Some services may be unavailable at this time. Please contact us for help or try again later.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Monitor computer power events

Is there a way to monitor if a computer shuts down, restarts, hibernates, sleeps or logs off?

I need to do something if either of these events occur.

If this is possible, please tell me how to do this, and if you could give me some code I will appreciate it.

Thanks.

0 Kudos
Message 1 of 5
(3,567 Views)

searching for LabVIEW Help

Here's an example.

 

The System Exec.vi is located on the Functions Palette under Connectivity >> Libraries & Executables.

Untitled.png

 

 



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 2 of 5
(3,520 Views)

correction just type "shutdown -s" in command line



Thank you & Best regards
syrpimp

=======================================================
“You must continue to gain expertise, but avoid thinking like an expert." -Denis Waitley
0 Kudos
Message 3 of 5
(3,507 Views)

@syrpimp wrote:

correction just type "shutdown -s" in command line


That causes a shutdown.  The OP is looking for a way to check if the computer is shutting down.



There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 4 of 5
(3,499 Views)

The following link may help you:

 

Ending LabVIEW Program Before Windows Shuts Down:

http://digital.ni.com/public.nsf/allkb/66659ACE17C686418625736000606A64?OpenDocument

David P.
National Instruments
Applications Engineer
www.ni.com/soporte
0 Kudos
Message 5 of 5
(3,449 Views)