Check your PC's Uptime with PowerShell

by Eric Wyatt
(last updated November 1, 2021)

As we use our computers, we put them through a lot. There are a lot of processes that go into the computer running correctly. It has become common practice for many people to leave their PCs running all the time. Typically, this has little effect on the computer and its performance—typically, but not always.

It has become a bit of a joke with many computer users that when they run into a problem on their computer, someone says, "Have you tried turning it off and on again?" While said in a joking manner, there is a bit of truth to this statement. When your computer restarts, it performs specific processes that help the computer run smoother. Processes such as clearing certain caches, clearing memory, and resetting the CPU. The result is everything returning to its boot-up state.

If you leave your machine running, it is good practice to know how long it's been running from time to time. If it has been an extended amount of time, say several days, you should restart your system. To determine the amount of time your machine has been running, you can run a simple command within PowerShell that will display the length of time.

  1. Right-click on the Start button. Windows displays the secondary Windows Start menu.
  2. Choose Windows PowerShell (Admin). (Make sure it is the Admin option, not the Windows PowerShell option without the Admin privileges.) Windows displays the User Account Control asking if you want to allow changes.
  3. Click Yes. The dialog box disappears, and the PowerShell command prompt window is displayed. The window will say Administrator in the top-left corner.
  4. At the command prompt, type the following and then press Enter. You can also copy and paste the command directly into the PowerShell command prompt. (See Figure 1.)
  5. Figure 1. PowerShell command prompt displaying how long a machine has been running.

    (get-date) - (gcim Win32_OperatingSystem).LastBootUpTime
    
  6. Once you have determined the amount of time, you can close the PowerShell command prompt window.

If your computer has been running for a significant amount of time and you are experiencing mild or more severe performance-related issues, try restarting your machine. Running the LastBootUpTime command periodically and paying attention to the time listed can help keep your computer in better working order.

 This tip (10124) applies to Windows 10.

Author Bio

Eric Wyatt

Eric Wyatt is a swell guy (or so his friends tell him). He is a formally trained designer and branding expert, bringing a wide range of skills to his Tips.Net articles. ...

MORE FROM ERIC

Keeping Time From Around the World

Time marches on throughout the world. With different time zones it can be tricky to keep track of the time in the various ...

Discover More

Disabling USB Storage Devices

USB storage devices can be extremely helpful. They can also allow people to copy and access your information through the ...

Discover More

Using PowerShell to Find Your Wireless Signal Strength

Wi-Fi signal strength is important for faster, more consistent data transfers. You can use PowerShell to gain a more ...

Discover More
More WindowsTips

Use PowerShell to Find Your Computer Serial Number

When you need your computer's serial number you can look it up without looking on the outside of the box. Use PowerShell ...

Discover More

Counting the Number of Files or Subfolders Using PowerShell

Do you need to determine the number of files or subfolders there are in a folder? You can use PowerShell to quickly count ...

Discover More

Change your Computer's Name with PowerShell

Your computer has a name that is separate from your account name. You can use PowerShell to change the name of your computer.

Discover More
Subscribe

FREE SERVICE: Get tips like this every week in WindowsTips, a free productivity newsletter. Enter your address and click "Subscribe."

View most recent newsletter.

Comments

If you would like to add an image to your comment (not an avatar, but an image to help in making the point of your comment), include the characters [{fig}] (all 7 characters, in the sequence shown) in your comment text. You’ll be prompted to upload your image when you submit the comment. Maximum image size is 6Mpixels. Images larger than 600px wide or 1000px tall will be reduced. Up to three images may be included in a comment. All images are subject to review. Commenting privileges may be curtailed if inappropriate images are posted.

What is four more than 8?

There are currently no comments for this tip. (Be the first to leave your comment—just use the simple form above!)


Newest Tips
Subscribe

FREE SERVICE: Get tips like this every week in WindowsTips, a free productivity newsletter. Enter your address and click "Subscribe."

(Your e-mail address is not shared with anyone, ever.)

View the most recent newsletter.