I\'ve searched around a bit for similar questions, but other than running one command or perhaps a few command with items such as:
ssh user@host -t sudo su -
Take a look at Expect (man expect)
man expect
I've accomplished similar tasks in the past using Expect.