Server Management Suite

 View Only
  • 1.  How to create a report to show the last time a client computer was restarted

    Posted Mar 25, 2013 12:17 PM

    I'm running Altiris 7.1 with patch management in my enterprise environment. We've been having issues with the MS 497 day bug, so I would like to create a report that will list my managed servers by the last time they restarted.

    I did find the built in report for system uptime, although it doesn't return any results, it also seems to give time as a percentage, and I would really like to see, ideally a date for the last restart, but failing that, the number of days since the last restart.

    Thanks,
    Erica



  • 2.  RE: How to create a report to show the last time a client computer was restarted

    Broadcom Employee
    Posted Mar 27, 2013 04:42 AM

    Hello Erica,

    I'm not sure how the system uptime data is collected, but worse case scenario you can get it from WMI or using POwerSDhell:

     http://gallery.technet.microsoft.com/scriptcenter/Get-Server-Uptime-Using-WMI-15aaa8ac



  • 3.  RE: How to create a report to show the last time a client computer was restarted

    Posted Mar 27, 2013 11:46 AM
    Hi When i try to run system uptime report (% uptime over a period of time), it's showing "no results found". Got any idea of what's going wrong in this? Thanks in advance.


  • 4.  RE: How to create a report to show the last time a client computer was restarted

    Posted May 20, 2013 10:30 PM
    If i remember correctly the system uptime % report is based off a monitor. If you dont use the uptime monitor you wont get any results in that report.


  • 5.  RE: How to create a report to show the last time a client computer was restarted

    Posted May 21, 2013 08:28 AM

    Does this mean that Uptime.exe needs to be installed on each client or just on the notification server?



  • 6.  RE: How to create a report to show the last time a client computer was restarted

    Posted May 21, 2013 09:15 AM

    As long as your getting inventory you can use the "last boot up time" from the operating system inventory table to see when the last time it rebooted.  Getting the down swing of the reboot even is a little more difficult as in my experence the reboot event table mainly catches reboots from patch managment. 



  • 7.  RE: How to create a report to show the last time a client computer was restarted

    Posted May 21, 2013 10:08 AM

    In my experience the "last boot up time" in OS inventory table wasn't very reliable as you had to initiate an inventory collection in order to get that populated into the database.  Being a managed services company with very, very tight patch windows and complex application, we found it clunky to patch, and constantly run inventory after inventory to actually know when the computer rebooted.

     

    This is my setup using an uptime monitor, (which isn't by any means a great solution...but gets the job done...):

    1.Monitor Policy

    • Monitor Policy-agent based Name:  Uptime
    • Type:  Metric Collect

    2.Rule

    • Rule Name:  System Uptime (seconds)
    • Rule Metric:  System - System Uptime (seconds) 

    3. Metric

    • Metric Name:  System - System Uptime (seconds)
    • Type:  Perfmon Counter
    • Poll:  600 seconds
    • Performance Counter Builder:
    • Performance object:  \system
    • Counter:  System Uptime
       

    After this is applied, in the uptime % report if you set the report to today's date only, it will show 100% uptime for all computers in your filter (if htey have not been rebooted that day).  When the computer reboots that will drop down to 87-90% uptime for the day. If the computers still show 100% during the patch window, it has not yet rebooted.

    If anyone has a better solution i'm all for it.  I would love to see a realtime uptime report showing the last reboot time, not %.  I've been looking at a custom script to populate a custom dataclass with the wmi last reboot data that executes as a Managed Software Delivery on computer startup whether a user is logged in or not...

    Thoughts?



  • 8.  RE: How to create a report to show the last time a client computer was restarted

    Trusted Advisor
    Posted May 30, 2013 03:55 PM

    We use a custom inventory:

    '********************************************************************************
    ' NS7 Custinv to return OS install date from the win32_operatingsystem wmi class
    '********************************************************************************

    'Create instance of Wbem service object, connect to namespace and run wmi query
    strComputer = "."
    Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

    'Create instance of DateTime object
    Set objSWbemDateTime = CreateObject("WbemScripting.SWbemDateTime")


    '===================================================================================================================

    'Create instance of Altiris NSE component
    dim nse
    set nse = WScript.CreateObject ("Altiris.AeXNSEvent")

    ' Set the header data of the NSE
    ' Please don't modify this GUID
    nse.To = "{1592B913-72F3-4C36-91D2-D4EDA21D2F96}"
    nse.Priority = 1

    'Create Inventory data block. Here assumption is that the data class with below guid is already configured on server
    dim objDCInstance
    set objDCInstance = nse.AddDataClass ("{22c12ff5-4166-4c33-9ab7-f630cb949878}")


    dim objDataClass
    set objDataClass = nse.AddDataBlock (objDCInstance)
    cnt=0
      
    Set objWMIObj = objWMIService.ExecQuery("SELECT * FROM win32_operatingsystem")
    For each objInfo in objWMIObj

                                                  
     'Add a new row
     dim objDataRow
     set objDataRow = objDataClass.AddRow

     'Set columns
             LastBootUpTime = FormatFileDate(objInfo.LastBootUpTime)
     Wscript.echo LastBootUpTime
     objDataRow.SetField 0, LastBootUpTime


    ' objDataRow.SetField 5, FormatFileDate(objInfo.LastBootUpTime)

    ' WScript.echo "Parsed LastBootUpTime: "  & objInfo.LastBootUpTime  & " ---> " & ParseWMIDate(objInfo.LastBootUpTime)
    ' WScript.echo "Object LastBootUpTime: "  & objInfo.LastBootUpTime  & " ---> " & FormatFileDate(objInfo.LastBootUpTime)
    Next

    ' Send the NSE data to the NS server
    nse.SendQueued

    ' Method 1: Manually parse out date & time in correct order & build CDate object
    Function ParseWMIDate(dtmLastBootUpTime)
        ParseWMIDate = _
            CStr(Mid(dtmLastBootUpTime, 5, 2) &_
            "/" &_
            Mid(dtmLastBootUpTime, 7, 2) &_
            "/" &_
            Left(dtmLastBootUpTime, 4) &_
            " " &_
            Mid (dtmLastBootUpTime, 9, 2) &_
            ":" &_
            Mid(dtmLastBootUpTime, 11, 2) &_
            ":" &_
            Mid(dtmLastBootUpTime, 13, 2))
    End Function

    ' Method 2: Use wbem objects to get wbem-formatted date
    Function FormatFileDate (strDate)
     objSWbemDateTime.Value = strDate
     FormatFileDate = CStr(objSWbemDateTime.GetVarDate(False))
    End Function

    I didn't write this from scratch.  I think that there was another forum posting on Connect that I lifted this from.

    I have the custom inventory running daily and at system startup.



  • 9.  RE: How to create a report to show the last time a client computer was restarted

    Posted May 31, 2013 10:35 PM

    This query isn't limited to servers but will give you the last boot time for all clients:

     

    select c.Guid as _ItemGuid, c.Name, os.[Last Boot Up Time] from vcomputer c
    left join Inv_OS_Operating_System os on c.Guid = os._ResourceGuid
    order by os.[Last Boot Up Time]