From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

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
(2,888 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
(2,841 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
(2,828 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.


GCentral
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
(2,820 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
(2,770 Views)