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

MORE FROM ERIC

Grouping Tiles in the Start Menu

Arranging tiles into groups can make finding and starting your apps quicker. Discover how easy it is to group tiles in ...

Discover More

Google Drive

If you have files that you need to access from more than one device, or give access to someone else, Google Drive is a ...

Discover More

Change the Default Appended Name for New Folders

By default in Windows 10, when a folder or file is copied or duplicated within the same folder as the original, the ...

Discover More
More WindowsTips

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

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

Passing Parameters to a PowerShell Script

Like the older batch-file processor, PowerShell can accept parameters. This allows for flexibility in your script. This ...

Discover More
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 8 - 5?

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


Newest Tips