14 views

Description

Windows Installed Software probe uses the registry to get the install date, but the install date does not include install time. The sensor sets this install date to the default value to midnight, however, since the timezone is not accounted for, the install time can show as something other than 00:00:00 which would be more desirable.

 

Steps to Reproduce

 

1. With SAM plugin enabled, Discover a Windows server that has installed software so that "cmdb_sam_sw_install" table is populated
2. From the CI, go to the installed software tab

See that the install time is shown which is the timezone offset from midnight. All of the installed software have the same time, although different dates.

Workaround

Modify sensor "Windows - Installed Software"

In function 

"asGlideDate: function(date)"

to include following

"glideDate.add(-glideDate.getTZOffset());"

after line:

"glideDate.setValue(formattedDate);"

ie:

BEFORE:

asGlideDate: function(date) {
        var pattern = /(\d{4})(\d{2})(\d{2})/; // yyyyMMdd
        if (JSUtil.nil(date) || !date.match(pattern))
            return;
 
        var format = "$1-$2-$3 00:00:00"; // yyyy-MM-dd 00:00:00
        var formattedDate = date.replace(pattern, format);
        var glideDate = new GlideDateTime();
        glideDate.setValue(formattedDate);
 
 
        return glideDate;
    },

 

AFTER:

asGlideDate: function(date) {
        var pattern = /(\d{4})(\d{2})(\d{2})/; // yyyyMMdd
        if (JSUtil.nil(date) || !date.match(pattern))
            return;
 
        var format = "$1-$2-$3 00:00:00"; // yyyy-MM-dd 00:00:00
        var formattedDate = date.replace(pattern, format);
        var glideDate = new GlideDateTime();
        glideDate.setValue(formattedDate);
        glideDate.add(-glideDate.getTZOffset());
 
        return glideDate;
    },

 

Time will change to 00:00:00

 


Related Problem: PRB1291261

Seen In

There is no data to report.

Intended Fix Version

Madrid

Safe Harbor Statement

This "Intended Fix Version" information is meant to outline ServiceNow's general product direction and should not be relied upon in making a purchasing decision. The information provided here is for information purposes only and may not be incorporated into any contract. It is not a commitment, promise, or legal obligation to deliver any material, code, or functionality. The development, release, and timing of any features or functionality described for our products remains at ServiceNow's sole discretion.

Associated Community Threads

There is no data to report.

Article Information

Last Updated:2018-08-05 22:37:21
Published:2018-08-03