Storing entire script inside a variable This topic contains 2 replies, has 3 voices, and was last updated by Peter Jurgens 2 years, 2 months ago. Author Posts December 30, 2015 at 12:04 pm #33385 konfigurationkingParticipant My problem is I want to store an entire script inside a variable so that I can use invoke-command. December 30, 2015 at 1:34 pm #33389 Thom SchumacherParticipant Posted what I've used in the past from a post on windows it pro. In your GIST December 30, 2015 at 1:38 pm #33391 Peter JurgensParticipant 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. Author Posts You must be logged in to reply to this topic.