Utilities scrambled to shut off power and gas, while cities deployed sandbags to protect homes and businesses.