If you can find an old motor with field coils, remove the rotor, and as long as the bore is large enough, it can be used a a demagnetiser.
Supplied with the correct AC voltage, tghe item to be demagnetised is passed through the bore.
The alternating magnetic field will decrease as the object leaves the device, so that the magnetism induced in the object also reduces to zero.
If you want to magnetise something, supplying a DC voltage to the field coils will magnetise the item.
BUT, since thedre will be no inductance with DC, the supply voltage should be lower.
For reasons of safety, I would not advocate using mains level DC voltage, for this.
To my mind, 48 volts would be as high as I would want to go
Howard