Skip to main content
infervour.com

Back to all posts

How to Get Only the Uptime Of the Server on Powershell?

Published on
2 min read
How to Get Only the Uptime Of the Server on Powershell? image

Best Server Monitoring Tools to Buy in October 2025

1 Linux Server Hacks, Volume Two: Tips & Tools for Connecting, Monitoring, and Troubleshooting

Linux Server Hacks, Volume Two: Tips & Tools for Connecting, Monitoring, and Troubleshooting

BUY & SAVE
$24.00 $39.99
Save 40%
Linux Server Hacks, Volume Two: Tips & Tools for Connecting, Monitoring, and Troubleshooting
2 ServerConnect Pro Portable Server Management Tool: USB Crash Cart Adapter – 1920 x 1200 – Portable Laptop USB 2.0 to KVM Console - Datacenter Server Monitor Mouse and Keyboard to USB

ServerConnect Pro Portable Server Management Tool: USB Crash Cart Adapter – 1920 x 1200 – Portable Laptop USB 2.0 to KVM Console - Datacenter Server Monitor Mouse and Keyboard to USB

  • TRANSFORM YOUR LAPTOP: TURN ANY LAPTOP INTO A POWERFUL SERVER TOOL.

  • HASSLE-FREE SETUP: CONNECT EFFORTLESSLY WITHOUT DRIVER INSTALLATIONS.

  • COMPREHENSIVE CONTROL: ACCESS BIOS AND MANAGE VIDEO OUTPUTS EFFICIENTLY.

BUY & SAVE
$199.00
ServerConnect Pro Portable Server Management Tool: USB Crash Cart Adapter – 1920 x 1200 – Portable Laptop USB 2.0 to KVM Console - Datacenter Server Monitor Mouse and Keyboard to USB
3 Cloud Observability with Azure Monitor: A practical guide to monitoring your Azure infrastructure and applications using industry best practices

Cloud Observability with Azure Monitor: A practical guide to monitoring your Azure infrastructure and applications using industry best practices

BUY & SAVE
$44.99
Cloud Observability with Azure Monitor: A practical guide to monitoring your Azure infrastructure and applications using industry best practices
4 Windows Security Monitoring: Scenarios and Patterns

Windows Security Monitoring: Scenarios and Patterns

BUY & SAVE
$26.98 $50.00
Save 46%
Windows Security Monitoring: Scenarios and Patterns
5 Sipeed NanoKVM-USB Operations Maintenance Server Tool Kit, Multi-Device Collaboration, Finger-Sized 4K USB KVM for Server SBCs, Mini 1080P Video Switcher Capturer, 4K HDMI in/Loop Out (KVM Kit2)

Sipeed NanoKVM-USB Operations Maintenance Server Tool Kit, Multi-Device Collaboration, Finger-Sized 4K USB KVM for Server SBCs, Mini 1080P Video Switcher Capturer, 4K HDMI in/Loop Out (KVM Kit2)

  • ELIMINATE HARDWARE CLUTTER: CONTROL MULTIPLE DEVICES VIA A SINGLE PC.
  • 1080P VIDEO CAPTURE: CAPTURE AND TRANSFER HDMI IMAGES SEAMLESSLY.
  • USER-FRIENDLY SWITCHING: EASILY TOGGLE DATA BETWEEN TWO COMPUTERS.
BUY & SAVE
$59.99
Sipeed NanoKVM-USB Operations Maintenance Server Tool Kit, Multi-Device Collaboration, Finger-Sized 4K USB KVM for Server SBCs, Mini 1080P Video Switcher Capturer, 4K HDMI in/Loop Out (KVM Kit2)
6 Complete Introduction to Icinga All About Server and Network Monitoring: Thorough explanation of monitoring tools that have evolved from Nagios from basics to applications (Japanese Edition)

Complete Introduction to Icinga All About Server and Network Monitoring: Thorough explanation of monitoring tools that have evolved from Nagios from basics to applications (Japanese Edition)

BUY & SAVE
$6.80
Complete Introduction to Icinga All About Server and Network Monitoring: Thorough explanation of monitoring tools that have evolved from Nagios from basics to applications (Japanese Edition)
7 Necto RV Pet Temperature Monitor - No WiFi Required - Remote Power Outage & Temp Sensor with App Alerts. Cellular Monitoring System for Car, Home Safety & Server Room (Subscription Required)

Necto RV Pet Temperature Monitor - No WiFi Required - Remote Power Outage & Temp Sensor with App Alerts. Cellular Monitoring System for Car, Home Safety & Server Room (Subscription Required)

  • 24/7 MONITORING ANYWHERE: CELLULAR TECH ENSURES CONSTANT COVERAGE, NO WIFI NEEDED.

  • HASSLE-FREE ALERTS: INSTANT NOTIFICATIONS FOR TEMP CHANGES & LOW BATTERY.

  • USER-FRIENDLY APP: EASY SETUP & REMOTE ACCESS; CUSTOMIZE ALERTS IN MINUTES.

BUY & SAVE
$99.00 $119.90
Save 17%
Necto RV Pet Temperature Monitor - No WiFi Required - Remote Power Outage & Temp Sensor with App Alerts. Cellular Monitoring System for Car, Home Safety & Server Room (Subscription Required)
8 Windows Server 2016 Administration Cookbook: Core infrastructure, IIS, Remote Desktop Services, Monitoring, and Group Policy

Windows Server 2016 Administration Cookbook: Core infrastructure, IIS, Remote Desktop Services, Monitoring, and Group Policy

BUY & SAVE
$29.99 $32.99
Save 9%
Windows Server 2016 Administration Cookbook: Core infrastructure, IIS, Remote Desktop Services, Monitoring, and Group Policy
9 Cellular Leak Temperature Humidity & Power Monitor - 24/7 Monitoring for Home, Server Room Basement Off Grid Greenhouse Data Center with Instant Alerts. Protect Against Water Leaks & Pipe Freeze

Cellular Leak Temperature Humidity & Power Monitor - 24/7 Monitoring for Home, Server Room Basement Off Grid Greenhouse Data Center with Instant Alerts. Protect Against Water Leaks & Pipe Freeze

  • INSTANT CONNECTIVITY: NO WIFI NEEDED, SETUP IN MINUTES!

  • CUSTOM ALERTS: IMMEDIATE NOTIFICATIONS VIA TEXT OR EMAIL!

  • 4-IN-1 MONITORING: TRACK TEMP, HUMIDITY, POWER, & LEAKS!

BUY & SAVE
$149.00 $170.00
Save 12%
Cellular Leak Temperature Humidity & Power Monitor - 24/7 Monitoring for Home, Server Room Basement Off Grid Greenhouse Data Center with Instant Alerts. Protect Against Water Leaks & Pipe Freeze
10 Professional Microsoft SQL Server 2008 Administration

Professional Microsoft SQL Server 2008 Administration

BUY & SAVE
$60.31 $65.00
Save 7%
Professional Microsoft SQL Server 2008 Administration
+
ONE MORE?

To get only the uptime of the server in PowerShell, you can use the following command:

(Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime

This command retrieves the last time the operating system was booted up, which can be used to calculate the current uptime of the server.

What PowerShell command can I use to fetch the server's uptime duration?

You can use the following PowerShell command to fetch the server's uptime duration:

(Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime

How to extract only the uptime data from a server's status report in PowerShell?

To extract only the uptime data from a server's status report in PowerShell, you can use the following commands:

  1. First, save the server's status report in a text file. Let's say the file is named "server_status_report.txt".
  2. Use the Get-Content cmdlet to read the contents of the text file and store it in a variable:

$serverStatusReport = Get-Content server_status_report.txt

  1. Use the Select-String cmdlet to search for the uptime pattern in the server's status report. You can use a regular expression to match the uptime data. For example, if the uptime data is in the format "Uptime: XX days XX hours XX minutes", you can use the following command:

$uptimeData = $serverStatusReport | Select-String "Uptime: (\d+ days \d+ hours \d+ minutes)" -AllMatches | Foreach-Object { $_.Matches.Value }

  1. Print the extracted uptime data:

$uptimeData

This will extract and display only the uptime data from the server's status report using PowerShell. Make sure to adjust the regular expression in step 3 to match the specific format of the uptime data in your server's status report.

What is the most efficient PowerShell command for getting only the uptime of a server?

One of the most efficient PowerShell commands for getting only the uptime of a server is:

(Get-WmiObject -Class Win32_OperatingSystem).LastBootUpTime

This command uses the Get-WmiObject cmdlet to retrieve the LastBootUpTime property of the Win32_OperatingSystem class, which represents the date and time when the server was last booted. This information can then be used to calculate the server's uptime.

What is the quickest way to access the server's uptime on PowerShell?

To quickly access the server's uptime on PowerShell, you can use the following command:

systeminfo | Select-String "System Boot Time"

This command will display the system boot time, which can be used to calculate the server's uptime.