This paper develops reliability and maintenance models for a single‐unit system subject to hard failures under random environment of external shocks. Motivated by the observations of shot‐noise process in practice, the impact of shock damage on system failure behavior is characterized by random hazard rate increments. To remove such negative impact, imperfect preventive repair is performed periodically, and preventive replacement is performed after several repairs. Considering the joint effects of both random shocks and imperfect repair on the system hazard rate, we derive recursive equations for the system reliability function. Furthermore, we investigate the optimal maintenance policy that minimizes the expected cost per unit time of the system. The applicability of the reliability and maintenance model is validated by a case study on a wind turbine system.