Check your PC's Uptime with PowerShell

Written 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. ...


Quickly Deactivate Apps that Impact Startup

Windows will load apps at startup, which can impact performance. Quickly deactivate startup items that can affect the ...

Discover More

Opening Apps with a Keystroke

Opening Windows apps is typically easy with your mouse, but for the apps you use more often there is a way to do this ...

Discover More

Customize Edge's Kids Mode

Microsoft Edge Chromium's Kids Mode allows for restricted viewing for child safety. See how to customize Kids Mode to ...

Discover More
More WindowsTips

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

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

PowerShell Input and Output

When dealing with a scripting language like PowerShell, one of the first things you need to learn is how to get data into ...

Discover More

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 5 - 0?

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

Newest Tips