I have a PowerShell script which installs a patch (contains set of files to be added) on a customer machine. For this, I have created a batch file which executes this PowerS
I tried the solution proposed by @TrevorSullivan, but it gave me error
The term '????' is not recognized as the name of a cmdlet, function,
script file or operable program...
As I found out later there was a problem with bad encoding. I found somewhere another approach and when I combined those two, I got working PS command:
$Base64 = [System.Convert]::ToBase64String([System.Text.Encoding]::Unicode.GetBytes([System.IO.File]::ReadAllText("script.ps1")))
Then I can redirect the result to file:
$Base64 > base64Script.txt
from where I just copy the encoded command and paste it here instead of :
powershell.exe -EncodedCommand
and it works without any problem.