banner



How To Check Windows Server 2012 Uptime

Windows uptime is a measurement that many server administrators use to troubleshoot day-to-24-hour interval issues that may arise in the environment. In this commodity, yous're going to larn how to cheque boot time in Windows 10 and Windows Server. Yous're free to apply whichever mode is easiest for you. Use this article every bit a future reference.

The article will be broken up into two principal parts; checking server uptime and finding historical Windows uptime. The first part will focus on finding how much fourth dimension the computer has been up since its last reboot. This is called "current" uptime in this article.

The second part of the article will focus on finding "historical" uptime significant a reboot on how long a Windows system was up between multiple reboots. Using PowerShell, you'll acquire how to parse the Windows event log to pull historical uptime numbers.

How to Check Boot Time in Windows x and Windows Server

To get started, let's now jump into a few different means to find the electric current Windows uptime.

You'll be seeing a sit-in of how to check boot time in Windows 10 by running commands locally on a Windows system through this section. But know that by using PowerShell Remoting, yous can also perform these checks remotely (excluding task manager).

Chore Manager

One of the most simple and straightforward means to observe uptime is to simply open up Task Manager.

To cheque Windows uptime with Chore Managing director, right-click the Windows taskbar and select Task Manager or press CtrlShiftEsc. One time Chore Director is open, click on the Performance tab. Under the Performance tab, yous will come across a label of Up Time.

Finding Windows uptime with task manager
Finding Windows uptime with job manager

Result Viewer

Event Viewer is very normally used past about sysadmins on a regular basis, which makes it a great selection for a non-control line-related method of retrieving uptime. Event ID 6005 and 6006 tin be used to identify when the event log service starts or stops, which occurs during kicking/shut downtimes. Follow these steps to identify uptime via Issue Viewer:

  • Bring upwardly the Start Menu and simply search for Event Viewer, yous can also become to it via Computer Management.
  • On the left, aggrandize the Windows Logs section and select Arrangement
  • Now that we are querying only System related events, click "Filter Electric current Log…" on the right hand side of your window
  • In the Event ID field (by default this volition be prefilled with text stating "All Issue IDs") nosotros need to search for our applicable Outcome IDs, type "6005, 6006" then click OK

You can so compare the 2 times to create a total uptime. Also, since many instances of these events are stored, we can query the history of uptimes!

You now take filtered Event Logs that will prove you not only the last time but all known times in which in that location has been a bootup/shut down.

PowerShell

PowerShell has a few dissimilar ways you can retrieve uptime. Yous tin can either query WMI or apply the Windows consequence log.

When querying WMI, you tin query the Win32_OperatingSystem class and select the LastBootUpTime property as shown below.

            PS51> Get-CimInstance Win32_OperatingSystem | Select-Object LastBootUpTime  LastBootUpTime       --------------       ix/25/2019 nine:37:37 PM          

To query the Consequence Log via PowerShell, employ the Get-WinEvent cmdlet. You'll need to search for result IDs 6005 or 6006 that indicate the final fourth dimension the automobile was started.

            PS51> Become-WinEvent -ProviderName EventLog | Where-Object {$_.Id -eq 6005 -or $_.Id -eq 6006} | Select-Object -First 1 TimeCreated  TimeCreated          -----------          9/25/2019 9:37:52 PM          

WMIC

WMIC provides a control-line interface for WMI and is a tried and truthful method that has been used for many years. To query via uptime via WMIC you lot query the Win32_OperatingSystem WMI grade once again although a chip under the covers. You can meet below you lot tin can employ the WMIC syntax os get lastbootuptime to return the last time the server was started.

            > wmic os get lastbootuptime  LastBootUpTime               20190925213737.500000-240          

You do non accept to download anything to leverage WMIC, equally it comes pre-installed with Windows.

Organisation Data Utility

The systeminfo command displays detailed configuration info about a calculator and can be used to query system uptime. By using the built-in notice command line tool you lot tin parse the text to retrieve the data you demand.

Simply open either Command Prompt or PowerShell and type systeminfo | find.

            > systeminfo | find "System Kicking Fourth dimension:"  System Boot Time:          9/25/2019, 9:37:37 PM          

You lot do not have to download annihilation to leverage systeminfo, as information technology comes pre-installed with Windows.

Internet Statistics Command

You can likewise rapidly query uptime via Internet Statistics or more normally known every bit net stats. The cyberspace stats command returns general information about your session. Yous can see below the Statistics since… line. This date indicates when the machine was started.

            > cyberspace stats srv  Workstation Statistics for \\NATES-PC   Statistics since 9/25/2019 9:37:52 PM  --SNIP--  The command completed successfully.          

Uptime Command

If yous need a pocket-sized, portable utility to discover Windows uptime, look no further than NeoSmart Technologies' Uptime command for Windows. This utility is perfect for speedily querying uptime on any Windows version. The major do good of this tool is the convenience gene. If you lot detect yourself using this many times per day you may want to consider this method.

Later downloading the tool, extract uptime.exe to %WinDir%\System32. Then open up up a command prompt and only type uptime.

Uptime tool
Uptime tool

To run this tool remotely, you lot'd first need to re-create the tool to the Windows systems you're checking uptime on.

Introducing the Go-ServerUptimeReport script

So you don't have to write the PowerShell yourself, download a customs script called Get-ServerUptimeReport.ps1.

            PS51> Install-Script -Proper noun Get-ServerUptimeReport          

This script allows y'all to provide a computer name as a parameter. It volition then parse the Organisation event log of the computer and notice both a start and stop event to compare the two. It will and then render the total fourth dimension the server was online until the consequence log has rolled.

Below is an case of using this script on a server. Information technology will return the full uptime for all of the events the server has in the effect log, including the current uptime.

            PS51> ./Get-ServerUptimeReport.ps1 -ComputerName sqlsrv1  Startup Shutdown Uptime (Days) Uptime (Min) ------- -------- ------------- ------------ 9/16/2017 12:twoscore:00 PM 9/22/2017 4:20:xi PM 6.15 8860.18 9/sixteen/2017 10:22:49 AM nine/sixteen/2017 12:22:36 PM 0.08 119.79 ix/16/2017 three:22:12 PM 9/22/2017 iv:20:11 PM 6.04 8697.98          

Finding Windows Uptime Beyond Many Servers

This script is a quick way to find the uptime of a single server across many days. But what if you need this information for lots of servers at once? To do this, you tin can get together up a list of servers and then pass each computer name, 1 at a time, to this script.

As an case, ascertain all your servers in an array in the PowerShell console. In this example, the variable array will be called $servers.

In reality, though, you might be pulling server names from Active Directory, Hyper-V, or a text file. As long as you can build an array of server names, you're fine.

Ascertain all the server names so iterate over each one with a loop, as shown below.

            $servers = 'WEBSRV1','SQLSRV1' foreach ($server in $servers) { 	Become-ServerUptimeReport.ps1 -ComputerName $server }  Startup Shutdown Uptime (Days) Uptime (Min) ------- -------- ------------- ------------ 9/16/2017 12:45:48 PM ix/22/2017 4:25:39 PM six.15 8859.86 9/16/2017 10:42:52 AM nine/xvi/2017 12:42:34 PM 0.08 119.seven ix/16/2017 2:42:17 PM nine/22/2017 iv:25:39 PM half-dozen.07 8743.38 9/16/2017 12:40:00 PM nine/22/2017 four:25:39 PM 6.16 8865.65 ix/16/2017 10:22:49 AM 9/16/2017 12:22:36 PM 0.08 119.79 9/16/2017 3:22:12 PM 9/22/2017 4:25:39 PM vi.04 8703.46          

This code works, but you lot can't decide which server each row references. Add a server name to the output like beneath using a calculated belongings.

            $servers = 'WEBSRV1','SQLSRV1' foreach ($server in $servers) { 	Get-ServerUptimeReport.ps1 -ComputerName $server | Select-Object -Belongings *,@{n='ServerName';e={$server}} }  Startup Shutdown Uptime (Days) Uptime (Min) ServerName ------- -------- ------------- ------------ ---------- nine/xvi/2017 12:45:48 PM 9/22/2017 four:34:59 PM 6.xvi 8869.19 WEBSRV1 nine/xvi/2017 ten:42:52 AM 9/16/2017 12:42:34 PM 0.08 119.vii WEBSRV1 ix/16/2017 2:42:17 PM 9/22/2017 4:34:59 PM 6.08 8752.71 WEBSRV1  Startup Shutdown Uptime (Days) Uptime (Min) ServerName ------- -------- ------------- ------------ ---------- 9/16/2017 12:forty:00 PM 9/22/2017 4:35:01 PM 6.sixteen 8875.01 SQLSRV1 9/16/2017 x:22:49 AM 9/16/2017 12:22:36 PM 0.08 119.79 SQLSRV1 9/16/2017 3:22:12 PM 9/22/2017 4:35:01 PM six.05 8712.81 SQLSRV1          

We now have an excellent piffling tool that tin provide us a quick report on uptime for our servers over time!

Summary

You've now seen many different ways to observe Windows uptime. Regardless of which pick you cull, yous'll receive the same information. Cull the best one for your ain context.

And recall if yous need a historical written report of uptime history, don't forget about the Become-ServerUptimeReport PowerShell script!

Source: https://adamtheautomator.com/windows-uptime/

Posted by: wakefieldthedis1939.blogspot.com

0 Response to "How To Check Windows Server 2012 Uptime"

Post a Comment

Iklan Atas Artikel

Iklan Tengah Artikel 1

Iklan Tengah Artikel 2

Iklan Bawah Artikel