We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you a podcast all about Citrix Workspace, moving to the cloud, and analytics & intelligence. Episode 2 coming soon!Listen Now

x

How long ms server running without restart?

Medium Priority
75 Views
1 Endorsement
Last Modified: 2020-05-12
Running Microsoft 2016 server, how can know the during of server running since from last restart?
Comment
Watch Question

CERTIFIED EXPERT
Most Valuable Expert 2019
Most Valuable Expert 2018
Commented:
PowerShell:
[Management.ManagementDateTimeConverter]::ToDateTime((Get-WmiObject Win32_OperatingSystem).LastBootUpTime)

Open in new window

Batch:
systeminfo.exe | find /i "boot"

Open in new window

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts
CERTIFIED EXPERT
Most Valuable Expert 2019
Most Valuable Expert 2018
Commented:
Or, if you're doing this often and/or remotely, a PowerShell function I just wrote for another question (https://www.experts-exchange.com/questions/29166568/Windows-command-line-commands-that-will-list-how-long-Win-10-has-been-booted-up.html#a42997031); supports remote queries:
Function Get-BootTime {
[CmdletBinding()]
Param(
	[Parameter(Position=0, ValueFromPipeline=$true)]
	[String[]]$ComputerName
)
	Begin {
		$dcom = New-CimSessionOption -Protocol DCOM
	}
	Process {
		If (-not $PSBoundParameters.ContainsKey('ComputerName')) {$ComputerName = $ENV:ComputerName}
		$ComputerName | ForEach-Object {
			$computer = $_
			$splat = @{}
			If ($ComputerName -ne $ENV:ComputerName) {$splat['ComputerName'] = $computer}
			Try {
				$bootTime = If ($PSVersionTable.PSVersion.Major -lt 3) {
					[Management.ManagementDateTimeConverter]::ToDateTime((Get-WmiObject -ClassName Win32_OperatingSystem @splat).LastBootUpTime)
				} Else {
					If ($cimSession = New-CimSession -SessionOption $dcom @splat) {
						(Get-CimInstance -ClassName Win32_OperatingSystem -CimSession $cimSession).LastBootUpTime
					}
				}
				If ($bootTime) {
					$date = Get-Date
					Select-Object -InputObject '' -Property `
						@{n='ComputerName'; e={$computer}},
						@{n='BootTime'; e={$bootTime}},
						@{n='Uptime'; e={$date - $bootTime}},
						@{n='ReferenceTime'; e={$date}}
				}
			} Catch {
				$PSCmdlet.WriteError($_)
			}
		}
	}
}

Open in new window

ste5anSenior Developer
CERTIFIED EXPERT

Commented:
Run

wmic os get lastBootUpTime

Open in new window

on the command line.
Tom CieslikIT Engineer
CERTIFIED EXPERT
Distinguished Expert 2017
Commented:
You can simply set filter in System Event Log to 1
This is Time synchronization on server and server is doing in process of booting up so it will tell you when it happens

Capture.JPG
CERTIFIED EXPERT

Commented:
every day at 12.00 system writes uptime to eventlog too.
CERTIFIED EXPERT
Distinguished Expert 2019

Commented:
Or in task manager - performance tab, CPU section ->uptime.
Tom CieslikIT Engineer
CERTIFIED EXPERT
Distinguished Expert 2017

Commented:
Dirk Kotte - Do you see on my screenshot EVERYDAY log ?
CERTIFIED EXPERT

Commented:
Tom Cieslik - try to filter system-log for event 6013 !
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.