4wheel drive works in 4 lo and 2 wheel drive but not 4hi or AWD , Why? on 2004 Chevrolet Trailblazer

No service 4 wd
indicator comes on ,computer reflashed because of engine light and loss of engine power light coming on . Will occasionally go into 4 hi and AWD .lights do not come on in AWD or 4 Hi when switch is changed only on occasion seems like when it feels like changing .

1 answer
sacn for codes and test switch