naveen_kumarhr
ServiceNow Employee
ServiceNow Employee

Extending Patterns Method #2

  1. in the application Search bar type 'Discovery Patterns' then select the discovery patterns module under pattern designer application

 

 

  1. Search then select for the pattern named 'Windows OS - Servers'

 

 

  1. Here we want to "comment out" our first method so click the Uptime Extension

 

 

  1. Check the pre-condition box
  • Set value of 1 contains 2
  • Save the pattern

 

 

  1. Go back to the pattern entry

 

 

  1. Create a new Extension Section
  • Name it Uptime2

 

 

  1. Click 'Debug'

 

 

  1. Choose your windows midserver and enter the IP of YOUR Midserver, select 'Connect'

 

 

  1. Set initial information
  • Name the pattern Step
  • Choose WMI Query Operation

 

 

  1. Set the Name Space query
  • Namespace = "\root\CIMV2"
  • Get Full Statement = "SELECT SystemUpTime FROM Win32_PerfFormattedData_PerfOS_System"
  • Target Table = $wmi_uptime

 

 

  1. Test the query

 

 

  1. Validate return, note the value is in seconds

 

 

  1. Add a 'new step below' on the pattern designer

 

 

  1. Edit the step
  • Rename the step to 'Set Start Date
  • Choose Set Parameter Value

 

 

  1. Set the Values, consider using auto complete
  • Value = $wmi_uptime[1].SystemUpTime
  • Name = $cmdb_ci_win_server[*].start_date

 

 

  1. Test to validate return

 

 

  1. Save the pattern, exit out of debug and retun out of the pattern designer

  2. In the application search bar type pre post processing

  • Select pre post processing module
  • Select the 'Fix Start Date on Windows server' record

 

 

  1. Since our WMI return comes back in seconds we need to convert it to an actual time date field by using a glide query. This script does that for us in Pre-sensor mode (befoe the IRE gets involved).
  • Check the active box and save the record.

 

 

  1. Run a discovery against your Midserver as you have done in previous steps

 

 

  1. After the discovery completes see the new value

 

 

Version history
Last update:
‎07-05-2021 05:06 AM
Updated by: