Logo
programming4us
programming4us
programming4us
programming4us
Home
programming4us
XP
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server
programming4us
Windows Phone
 
Windows Server

Windows Home Server 2011 : Maintaining Windows Home Server - Checking System Uptime

- Free product key for windows 10
- Free Product Key for Microsoft office 365
- Malwarebytes Premium 3.7.1 Serial Keys (LifeTime) 2019
7/25/2013 6:05:11 PM
In networking parlance, uptime refers to the amount of time that some system has been running continuously since the last time the system was started. From the standpoint of Windows Home Server, the longer the uptime the better, because that means the server has been available for clients longer, which means that shared folders, media streaming, and remote access have all been available. Checking the system uptime isn’t a crucial system maintenance skill, but it does give you some indication of how the system is running overall. These next few sections take you through various methods for checking the current uptime value.

Displaying Uptime with the Task Manager

Probably the easiest way to get the current system uptime is to use Task Manager. Log in to the Windows Home Server desktop, right-click the taskbar, and then click Start Task Manager. Display the Performance tab, and look for the Up Time value in the System section .

Displaying Uptime with the SYSTEMINFO Command

The SYSTEMINFO command-line utility gives you a tremendous amount of information about your computer, including data about the manufacturer, processor, and memory, what hotfixes are installed, and what network devices are installed. It also tells you the date and time when the system was last booted:

System Boot Time:     9/23/2011, 7:26:41 AM

Unfortunately, the output of the SYSTEMINFO command is quite long, so locating that one line can take some time. To make things faster, pipe the output of SYSTEMINFO through a case-insensitive FIND command, like so:

systeminfo | FIND  /i "boot time"

This forces Windows Home Server to display just the System Boot Time line.

Displaying Uptime with Performance Monitor

One of those counters also tells you the current system uptime. Follow these steps to add it:

1.
Select Start, Run, type perf, and press Enter. The Performance Monitor appears.

2.
Select Monitoring Tools, Performance Monitor.

3.
Right-click the Performance Monitor graph, and then click Add Counters. (Alternatively, press Ctrl+I or click the Add button in the toolbar.) The Add Counters dialog box appears.

4.
In the Available Counters list, double-click System.

5.
Select the System Up Time counter.

6.
Click Add.

7.
Click OK.

Tip

The System Up Time counter displays the uptime in seconds. To convert this value to days, divide it by 86,400 (the number of seconds in a day).


If you prefer a command-line solution, you can use the TYPEPERF utility to display performance counters in a Command Prompt window. Here’s the command to run:

typeperf "\system\system up time" -sc 1

The -sc switch specifies the number of samples that you want TYPEPERF to collect and display. We need just one sample in this case.

Displaying Uptime with a Script

The problem with the System Up Time counter (whether you display it in Performance Monitor or at the command line) is that it displays the uptime in seconds, so you have to convert the value (to, say, days) to get a meaningful number. To avoid that, either use Task Manager, instead (which shows the uptime in days, hours, minutes, and seconds) or you can use the script in Listing 1, which does the conversion for you.

Listing 1. A Script That Displays the System Uptime in Days, Hours, and Minutes
Option Explicit
     Dim objOS, dateLastBoot, nSystemUptime
     Dim nDays, nHours, nMinutes
     '
     ' Get the Windows Home Server OS object
     '
     For Each objOS in GetObject( _
         "winmgmts:").InstancesOf ("Win32_OperatingSystem")
         '
         ' Return the last boot up time and
         ' convert it to a Date object
         '
         dateLastBoot = ConvertToDate(objOS.LastBootUpTime)
         '
         ' Calculate the number of minutes between then and now
         '
         nSystemUptime = DateDiff("n", dateLastBoot, Now)
         '
         ' Convert the total minutes into hours, days, and minutes
         '
         nDays = Int(nSystemUptime / 1440)
         nHours = Int (((nSystemUptime / 1440) - nDays) * 24)
         nMinutes = nSystemUptime Mod 60
         '
         ' Display the result
         '
         Wscript.Echo "Last Boot: " & dateLastBoot & vbCrLf & _
                      "System Uptime: " & _
                      nDays & " days and " & _
                      nHours & " hours and " & _
                      nMinutes & " minutes"
     Next
     '
     ' This function takes a datetime string and converts
     ' it to a real date and time object
     '
     Function ConvertToDate(strDate)
         Dim strYear, strMonth, strDay
         Dim strHour, strMinute, strSecond
         strYear = Left(strDate, 4)
         strMonth = Mid(strDate, 5, 2)
         strDay = Mid(strDate, 7, 2)
         strHour = Mid(strDate, 9, 2)
         strMinute = Mid(strDate, 11, 2)
         strSecond = Mid(strDate, 13, 2)
         ConvertToDate = DateSerial(strYear, strMonth, strDay) & " " & _
                    TimeSerial(strHour, strMinute, strSecond)
End Function

					  

This script references the Win32_OperatingSystem class, which has just one member object: the Windows Home Server operating system, represented in the For Each...Next loop by objOS. The script gets the LastBootUpTime property and converts the resulting string to a Date object using the ConvertToDate function. DateDiff returns the number of minutes between the last boot and Now. (This difference is the raw value for the system uptime.) Then the script converts the total minutes into the corresponding number of days, hours, and minutes and displays the result. Figure 1 shows sample output.

Figure 1. Sample output from the script in Listing 1.

Other -----------------
- HP ProLiant Servers AIS : How Memory Works
- HP ProLiant Servers AIS : Memory and Cache
- SQL Server 2008 R2 : A Performance Monitoring Approach (part 3) - Monitoring Memory, Monitoring the Disk System
- SQL Server 2008 R2 : A Performance Monitoring Approach (part 2) - Monitoring the Processors
- SQL Server 2008 R2 : A Performance Monitoring Approach (part 1)
- Microsoft Systems Management Server 2003 : The Four-Phase Patch Management Process (part 2) - The Evaluate & Plan Phase, The Deploy Phase
- Microsoft Systems Management Server 2003 : The Four-Phase Patch Management Process (part 1) - The Assess Phase, The Identify Phase
- Microsoft Systems Management Server 2003 : Patch Management - Preparing for Patch Management
- Microsoft Systems Management Server 2003 : Patch Management - The Need for Effective Patch Management, Introduction to the Patch Management Process
- Windows Server 2012 : Configuring post-installation settings
 
 
Top 10
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 2) - Wireframes,Legends
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Finding containers and lists in Visio (part 1) - Swimlanes
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Formatting and sizing lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Adding shapes to lists
- Microsoft Visio 2013 : Adding Structure to Your Diagrams - Sizing containers
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 3) - The Other Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 2) - The Data Properties of a Control
- Microsoft Access 2010 : Control Properties and Why to Use Them (part 1) - The Format Properties of a Control
- Microsoft Access 2010 : Form Properties and Why Should You Use Them - Working with the Properties Window
- Microsoft Visio 2013 : Using the Organization Chart Wizard with new data
 
programming4us
Windows Vista
programming4us
Windows 7
programming4us
Windows Azure
programming4us
Windows Server