Scripting for automated device management