Posts in 'Powershell'


Converting commands to Powershell compatible encoded strings for dummies

This is basically a reminder for me but could be useful for anyone. I keep forgetting how to convert commands to a Powershell compatible encoded string:

From the command line:

echo "iex(command)" | iconv --to-code UTF-16LE | base64 -w 0

For Python:

from base64 import b64encode
b64encode('iex(command)'.encode('UTF-16LE …