Logo
CAR REVIEW
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
PREGNANCY
 
 
Windows Server

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

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
- Windows Server 2012 : Enabling and disabling the graphical interface in Hyper-V
- Windows Server 2012 : Managing a Server Core installation using sconfig
- SQL Server 2012 : Running SQL Server in A Virtual Environment - EXTENDED FEATURES OF VIRTUALIZATION
- SQL Server 2012 : Running SQL Server in A Virtual Environment - VIRTUALIZATION CONCEPTS
- SQL Server 2012 : Running SQL Server in A Virtual Environment - COMMON VIRTUALIZATION PRODUCTS
- What's new and improved in SharePoint 2013 : Creating an asset library
- What's new and improved in SharePoint 2013 : Using the Office Store
- What's new and improved in SharePoint 2013 : Customizing the interface
- What's new and improved in SharePoint 2013 : Creating a new site
- System Center Configuration Manager 2007 : Configuring Desired Configuration Management
 
 
Most view of day
- Sharepoint 2013 : Backup and Restore (part 3) - Unattached Content Database Data Recovery
- Configuring Startup and Troubleshooting Startup Issues : Understanding the Startup Process
- Maintaining Desktop Health : Using Task Scheduler (part 3) - Creating New Tasks
- Adobe Illustrator CS5 : Organizing Your Drawing - Enhancing Appearances with Live Effects
- Protecting Windows from Viruses and Spyware : Antimalware Strategy: Defense in Depth (part 4) - User Account Control Options
- Microsoft Exchange Server 2010 : Completing Transport Server Setup (part 2) - Configuring the Transport Dumpster , Configuring Shadow Redundancy
- Windows Server 2003 on HP ProLiant Servers : The Physical Design and Developing the Pilot - Network Services
- Microsoft PowerPoint 2010 : Creating New Slides (part 2) - Creating a Slide from a Layout, Copying Slides
- Windows Phone 8 : Scheduled Tasks - To-Do List Scheduled Task Sample (part 2) - TodoService, TodoItemViewModel
- Microsoft SharePoint 2013 : Working with Visio Services - Designing dashboards - Data linking (part 4) - Adding data graphics , Web part connections
Top 10
- Windows Phone 8 : Scheduled Tasks - Scheduled Task API Limitations
- Windows Phone 8 : Scheduled Tasks - Updating Tiles Using a Scheduled Task Agent
- Windows Phone 8 : Scheduled Tasks - To-Do List Scheduled Task Sample (part 5) - Editing an Existing To-Do Item
- Windows Phone 8 : Scheduled Tasks - To-Do List Scheduled Task Sample (part 4) - Creating the To-Do Item Shell Tile, Saving a To-Do Item
- Windows Phone 8 : Scheduled Tasks - To-Do List Scheduled Task Sample (part 3) - Debugging Scheduled Tasks
- Windows Phone 8 : Scheduled Tasks - To-Do List Scheduled Task Sample (part 2) - TodoService, TodoItemViewModel
- Windows Phone 8 : Scheduled Tasks - To-Do List Scheduled Task Sample (part 1) - TodoItem,TodoDataContext
- Windows Phone 8 : Scheduled Tasks - Using Scheduled Tasks
- Windows Phone 8 : Scheduled Tasks - Background Agent Types
- Windows Phone 8 : Windows Phone Toolkit Animated Page Transitions - Reusing the Transition Attached Properties
 
 
Windows XP
Windows Vista
Windows 7
Windows Azure
Windows Server
Windows Phone
2015 Camaro