var gaDupCheck = new GlideAggregate('alm_asset');
gaDupCheck.addAggregate('COUNT', 'serial_number');
gaDupCheck.addNotNullQuery('serial_number');
gaDupCheck.groupBy('serial_number');
gaDupCheck.addHaving('COUNT', '>', 1);
gaDupCheck.query();
while (gaDupCheck.next()) {
var gr = new GlideRecord('alm_asset');
gr.addQuery('serial_number',gaDupCheck.serial_number);
gr.query();
gs.info('Duplicate serial number: ' + gaDupCheck.serial_number);
}