autoscript metasploit

Im trying to run the following autoscript

use exploit/multi/handler set payload … set lhost set lport set exitonsession false exploit -j shell powershell command 

it happens that when it opens a session it runs shell but after that it doesn’t run the powershell commands

there are post modules that allow run powershell scripts but I would like to know how to automate run powershell commands through a shell or other way without using scripts

Thanks