Background script to update the serial number for 225 Linux servers
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
Hi Everyone
can someone help me to get the background script to update the serial number filed for 225 Linux servers
Thanks
Ruthirakotti A
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
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.');
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
so what script did you start and where are you stuck?
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader