Background script to update the serial number for 225 Linux servers

RuthirakottA
Giga Contributor

Hi Everyone 

 

can someone help me to get the background script to update the serial number filed for 225 Linux servers

 

Thanks

Ruthirakotti A

2 REPLIES 2

Tanushree Maiti
Tera Patron

Hi @RuthirakottA 

 

try this :

 

var count = 0;
var grLinux = new GlideRecord('cmdb_ci_linux_server');
grLinux.addEncodedQuery('install_status=1^manufacturer=HardwareManufacturer^serial_number='); //Replace the encoded query below with the exact filter for your 225 servers
grLinux.setLimit(5); // Change to gr.setLimit(225) after validating your test run
grLinux.query();
while(grLinux.next()) {
grLinux.serial_number = 'YOUR_NEW_SERIAL_NUMBER'; //Set your serial no
grLinux.setWorkflow(false);
grLinux.update();
count++;
}
gs.info('Successfully updated ' + count + ' Linux server records.');

Please Accept the solution if it assisted you with your question & Mark this response as Helpful.
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti

Ankur Bawiskar
Tera Patron

@RuthirakottA 

so what script did you start and where are you stuck?

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader