473,625 Members | 3,330 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Retrieving the date/time when any user last turned on the Computer

I would like to know if there is function in VB.NET that returns the date and
time someone last turned on/off the computer? I'm more interested in knowing
this on a non-networked computer. Maybe there is already an .exe in the
windows operating system that performs this task.

How can I get the above requested info?

--
Sincerely,

Keith
Nov 21 '05 #1
2 1287
Hi Keith,

A while back I wrote a small uptime app which allowed me to enter the name
of a computer on my network and request it's uptime. It did this by
enumerating the processes on the target machine until it found the SYSTEM
process, and then using it's StartTime property to determine how long the
system had been running. Take a look at the Process object for more
details, as it's even simpler if all you want is the local system's uptime.

Cheers,
Alex Clark
Nov 21 '05 #2
Keith,
The "System Up Time" performance counter has the "time elapsed since the
computer was started", you can use something like to retrieve its value:

Dim counter As New PerformanceCoun ter("System", "System Up Time")
Dim seconds As Double = counter.NextVal ue()
seconds = counter.NextVal ue()

Dim startTime As DateTime = DateTime.Now.Ad dSeconds(-seconds)

Note the two calls to NextValue are needed, due to the way
PerformanceCoun ter works.

I was thinking Environment.Tic kCount would be an alternative, however its
value is limited to 24.9 hours...

I'm not sure if there is a "better" Win32 API, as the GetTickCount API
references the "System Up Time" counter...

Not sure if the above would be supported on Windows 98.

Hope this helps
Jay
"GTDriver" <GT******@discu ssions.microsof t.com> wrote in message
news:56******** *************** ***********@mic rosoft.com...
I would like to know if there is function in VB.NET that returns the date
and
time someone last turned on/off the computer? I'm more interested in
knowing
this on a non-networked computer. Maybe there is already an .exe in the
windows operating system that performs this task.

How can I get the above requested info?

--
Sincerely,

Keith

Nov 21 '05 #3

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

Similar topics

6
4840
by: MickG | last post by:
Hi, I am trying to validate these values, this seems to work fine for the phone number and name but I am trying to get the program to fail to submit and set the focus on the date when 2006 is selected and submitted. Thanks in advance for any help.
3
1245
by: Manny Chohan | last post by:
Guys, I have intranet application which our users use in offices all over the world. How can i retrieve the date and time on their pc and display it on the screen no matter what country they are in? Is this possible in .Net? Thanks
9
3218
by: Bob Achgill | last post by:
I would like to use the timestamp on files to manage the currency of support files for my VB windows application. In this case I would only put the timestamp of the file in the management database and not the file itself. To do this I will need to have a File class property for Create time and date that will let me "set" the Create time and date of the file to my own chooseing. The VB file class does not appear to have the ability
12
2589
by: Rob Meade | last post by:
Hi all, Ok - I've come from a 1.1 background - and previously I've never had any problem with doing this: Response.Write (Session("MyDate").ToString("dd/MM/yyyy")) So, I might get this for example: 21/05/2006
23
3216
by: mosesdinakaran | last post by:
Hi All, I need a small clarification in submitting the forms, Ur suggestions please. In a page I have two form and also two submit butons. (ie)
9
1718
by: Mo | last post by:
After a little PHP education, my first project (to get my feet wet) is making an employee time-tracking program for our small business. *** ANY SUGGESTION, THOUGHTS, OR ADVICE WOULD BE WARMLY WELCOMED *** I'm in my planning stage, and here's my hurdle: On the time report, we want to see EVERY date under each employee, and the string "Absent" for the dates on which the user has no punch times. (It would also be nice to include day-names...
1
2084
by: 6afraidbecause789 | last post by:
Hi - I am using a Date/Time Picker popup form for users to choose a a date and time for use on a separate entry form. The date/time on the entry form is actually entered automatically as a date/time stamp when a user enters a record. So, the popup form is only necessary when a user needs to change the date/time. To make this more user-friendly...there will be times when a user will be away from the computer, and therefore, will have to...
16
4446
by: W. eWatson | last post by:
Are there some date and time comparison functions that would compare, say, Is 10/05/05 later than 09/22/02? (or 02/09/22 format, yy/mm/dd) Is 02/11/07 the same as 02/11/07? Is 14:05:18 after 22:02:51? (24 hour day is fine) How about the date after 02/28/04 is 02/29/04, or the date after 09/30/08 is 10/01/08?
0
8256
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8694
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8356
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 most users, this new feature is actually very convenient. If you want to control the update process,...
1
6118
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5570
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4089
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4193
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1803
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1500
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.