
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2019 04:06 PM
SCCM creates a serial number value for a CMDB CI that has the following format:
/12BDMQ2/CNCMK0089P011E/
It needs to be:
12BDMQ2
Using a business rule, can someone suggest a method to replace the first value with the extracted test between the first and second '/' ?
(function executeRule(current, previous /*null when async*/) {
// Select out the string between the first two slash characters and discard the rest.
// read in the value of cmdb_ci_computer.serial serial number
var u_sccm_computer_sn = user.getValue("lob").split(',');
})(current, previous);
Thanks for any suggestions.
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-13-2019 04:35 PM
YOu can try
var str = "/12BDMQ2/CNCMK0089P011E/" ;
str.split("/");
var serial_number = str[1] ;
-Harsh

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2019 05:48 AM
After evaluating the problem more carefully, it was decided that a better approach would be to modify the Discovery Pattern or Probe to solve the issue rather than using a script. The script does work but it's not the best solution. Thank you for the responses.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2019 05:50 AM
Brent and Harshtimes both had correct answers to the original post. Harshtimes code was a bit more elegant so I have to go with his response.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2019 11:41 AM
I liked Harshtimes clever use of split to create an array too. A simple and elegant way to extract the required data.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-07-2019 07:13 AM
I wrote up the fix in a document, here's an updated version of it.
In the case of some Dell computers, the Serial Number populating the Serial Number attribute for of a Computer CI Base class contains the following format:
The “/” characters and the extraneous string that follows the 7 character serial number is causing the CI to improperly coalesce with the Asset Spreadsheet data import. This is resulting in duplicates and incorrect information. The format above is retrieved directly from Win32_BaseBoard via a WMI query of Windows Operating systems running on a Dell personal Computers. The Windows - Hardware probe and the pattern Windows - Hardware Information. retrieved the value for the Baseboard Chassis.
The following procedures provide a method to block this attribute from populating with the Baseboard Chassis. There are several other alternate sources that may be used for the Serial Number including BIOS and a different WMI query. The absence of the Baseboard Serial Number will result in one of the alternate Serial Numbers populating.
Once the correction is implemented, the serial number will self-correct on the next discovery cycle.
There are two methods for executing Discovery in Kingston: By Probes and By Patterns. In the case of [customer], we are using Patterns. The following provides procedures for adjusting the Discovery for both methods.
Discovery Patterns Method - Stopping the probe from retrieving or recognizing Baseboard Chassis
Locate the Discovery Pattern Windows Identity - Hardware Information and modify it to block discovery of the Baseboard Chassis Serial Number.
- Navigate to Pattern Designer --> Discovery Patterns.
- Filter on Name “Windows Identity - Hardware”
- Open the Pattern and select the Pattern tab
- Locate and remove the following Code:
step {
name = "Serial number from Win32_BaseBoard"
comment = "Serial number from Win32_BaseBoard"
run_wmi_query_to_var {
namespace = "root\\CIMV2"
query = "SELECT SerialNumber FROM Win32_BaseBoard"
var_names = table {
name = "Win32_BaseBoard"
}
if_not_found_do = nop {}
cache_flag = 0
}
} - After removing the code, Save the pattern
- Select Synchronize with MID Servers.