79770338

Date: 2025-09-20 13:58:23
Score: 1.5
Natty:
Report link

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.

Reasons:
  • Blacklisted phrase (0.5): I need
  • Whitelisted phrase (-1): Hope this helps
  • RegEx Blacklisted phrase (1): I want
  • Long answer (-0.5):
  • No code block (0.5):
  • Low reputation (1):
Posted by: Hadrins