This has been killing me, and that is how I ended up looking at this question. I know it is old. And I have a use case much like yours in my work. I don't want to leave my scripts on random client systems. I need to do more testing, but I just found that this works for a store Script in a Variable. Sorry, I don't know how to do the code formatting here. Hope this helps.
$myScript = (get-content .\Helloworld.ps1)
$myScript | out-string | invoke-expression
In my case, I want to get $myScript, which will be a catted file from a remote server through SSH.