Storing entire script inside a variable

My problem is I want to store an entire script inside a variable so that I can use invoke-command.

https://gist.github.com/anonymous/f1298a5ac9752ab59db9

Posted what I’ve used in the past from a post on windows it pro. In your GIST

Yep the simple way is to enclose your block of script inside curly braces then you can assign that to a variable and use that variable. If you’ve already got a .ps1 script file you could use the -File parameter of Invoke-Command.