It depends on the scanner and the method of dust and scratch removal. Dedicated film scanners tend to use Digital ICE or a similar technology with chromogenic films (negatives or reversal transparencies). The detection of dust is done in hardware using infrared to map dust and damage, and correction is done in software.
Infrared correction only works with chromogenic films; traditional black and white will not work with the technology (although chromogenic black and white negatives, such as Ilford's XP2 400 or Kodak's BW400CN will work), nor will it work with Kodachrome slides. For those films, and for scans of reflective media, a software solution is generally used.