I think my favorite Scotty scene is where part of the crew had been on leave at some space station and they had all gotten into a fight.
Kirk went down the line asking each man why they had fought. Each one gave some variation of the other side talking trash about Kirk.
When he got to Scotty he said (paraphrasing here) “Captain, I took all that and held the lads back. But when they called the Enterprise a garbage scow it was more than I could take!”
The Trouble With Tribbles I think was the episode.
They had his character portrayed as a completely competent commander when Kirk and Spock were unavailable.