I have a 2004 2500hd with a 6.6 4x4. I was having a shift range inhibit issue I would crank the truck sometimes and it would do this. If I cut the truck off and tried to put it in gear it would eventually go. So I put and ignition switch in it just to see if that was my problem. After that it will still do the shift range inhibit but it’s different now. It will go in gear with a loud bang then the it goes into sift range inhibit. But if you keep turning off the truck eventually it will go in gear and once it goes as long as you don’t cut off the truck it will go in any gear you won’t to after it goes the first time. I thought maybe a nsbu switch that didn’t change anything so now I’m thinking either a bad TCM or a wiring issue any help would be appreciated. These are the codes present for the transmission. P0562, P0841, P0842, p0846, P0871, P0872