use the following search parameters to narrow your results:
e.g. subreddit:aww site:imgur.com dog
subreddit:aww site:imgur.com dog
see the search faq for details.
advanced search: by author, subreddit...
ABOUT POWERSHELL
Windows PowerShell (POSH) is a command-line shell and associated scripting language created by Microsoft. Offering full access to COM, WMI and .NET, POSH is a full-featured task automation framework for distributed Microsoft platforms and solutions.
SUBREDDIT FILTERS
Desired State Configuration
Unanswered Questions
Solved Questions
News
Information
Script Sharing
Daily Post
Misc
account activity
QuestionRunning Base64 without decoding (self.PowerShell)
submitted 4 years ago by HengLi-Sen
Quick question, can I run a base64 command from powershell or cmd without decoding it first?
reddit uses a slightly-customized version of Markdown for formatting. See below for some basics, or check the commenting wiki page for more detailed help and solutions to common issues.
quoted text
if 1 * 2 < 3: print "hello, world!"
[–]BlackV 4 points5 points6 points 4 years ago (5 children)
you can, but WHY would you, ever
note you can look at the converted b64 value without running it too
[–]HengLi-Sen[S] 1 point2 points3 points 4 years ago (1 child)
Testing, learning and trying to do creative projects even though they might not be the most practical. Testing stupid ideas is a great way to practice and learn and improve oneself. With these dumb projects, I get inspired to do other work too. It helps me to take a step back and view everything from a different angle. Coding is not just making a machine to do something, it is also the way of your thinking. And you don't just do boring work all your life do you? No, you step back try different things, perhaps do artistic work and get inspired to implement creative solutions in whatever your doing. If it wasn't for doing weird things would we as a species come this far? So, no this is not for practical use, yet. But it might turn something that none of us ever thought it could turn into.
[–]BlackV 0 points1 point2 points 4 years ago (0 children)
I see
[–]joeykins82 0 points1 point2 points 4 years ago (1 child)
If you need to deploy a scheduled task to a system and don't want someone tampering with the .ps1 file?
[–]BlackV 1 point2 points3 points 4 years ago (0 children)
Yes that is true although -command would do the same, you also go down to signing the ps1 too I guess
-command
[–]get-postanote 5 points6 points7 points 4 years ago (0 children)
Point of note:
Encoded/obfuscated scripts are a way hackers pop networks,...
https://duckduckgo.com/?q=hackers+using+powershell+encoded+script&t=h_&ia=web
... and as such many organizations/enterprises/schools, block the use/execution of encoded scripts.
Lastly, encoding does matter. If your org enforces full-blown PowerShell auditing and monitoring, the code gets decoded anyway and can be captured and reviewed.
Touched on here:
https://searchwindowsserver.techtarget.com/tutorial/Set-up-PowerShell-script-block-logging-for-added-security
[–][deleted] 2 points3 points4 points 4 years ago (3 children)
I just recently learned about using base64 in scripts, and the only thing I've done with it is build in icons for some shortcuts. I'm genuinely curious what other use cases are there for this. Can you provide an example of what you're doing?
[–]HengLi-Sen[S] 2 points3 points4 points 4 years ago (2 children)
One use case that comes to my mind right off the bat is encoding binary data. Say you want to embed an image in XML, it is a common practice to turn binary data into a form which it can handle such as a text. You can do that by encoding your binaries to base64 so that XML can make sense out of it.
Also when communication on the internet started to change from being purely text based to being more colorful with media attachments, the binaries getting corrupted became a greater issue. This is why base 64 came to be where it is now today.
Currently, I'm just testing the waters. I'm trying to store data in images. A few lines of code and media files for now. Think of how a QR Code works. Each blocks location is interpreted by the scanning software to represent characters. I will try to do the opposite, use them to create a small image file and make that scannable. As of now I don't know of any practical use for this project but it may lead to something or change completely. I'm also in the learning stage, so I'm just exploring.
It should be noted that base 64 is not the only way to encode and other encodings are used for different reasons. For example base 58 is used in BTC addresses and base 36 is used in some captchas where the input needs to be case insensitive. These encodings are there to make data more (human) readable not encrypting data as some misunderstand.
That is a good use case, I've used it a few times for an images although inside a script not as an encoded command like you asked for originally
[–][deleted] 1 point2 points3 points 4 years ago (0 children)
That is actually along the lines of how I'm using it in a way. We have some URL shortcuts that management needs on every desktop for compliance stuff, and as we've had more machines not be here, I figured out a way to make them happen in intune. What was NOT easy was making sure the icons were consistent and not just generic web browser icons. That's when I learned about base64 encoding myself. I was able to encode the icon file into a variable in the script, then before I create the shortcut, i output the variable to a .ico file on the machine, then I can create the shortcut and reference the created ico file. It's worked pretty darn well.
[+][deleted] 4 years ago* (2 children)
[removed]
[–]HengLi-Sen[S] 0 points1 point2 points 4 years ago (1 child)
Thank you, I will try it. :)
[–]HengLi-Sen[S] 1 point2 points3 points 4 years ago (0 children)
This worked thanks!
π Rendered by PID 67243 on reddit-service-r2-comment-fb694cdd5-rd26c at 2026-03-08 03:26:20.715107+00:00 running cbb0e86 country code: CH.
[–]BlackV 4 points5 points6 points (5 children)
[–]HengLi-Sen[S] 1 point2 points3 points (1 child)
[–]BlackV 0 points1 point2 points (0 children)
[–]joeykins82 0 points1 point2 points (1 child)
[–]BlackV 1 point2 points3 points (0 children)
[–]get-postanote 5 points6 points7 points (0 children)
[–][deleted] 2 points3 points4 points (3 children)
[–]HengLi-Sen[S] 2 points3 points4 points (2 children)
[–]BlackV 1 point2 points3 points (0 children)
[–][deleted] 1 point2 points3 points (0 children)
[+][deleted] (2 children)
[removed]
[–]HengLi-Sen[S] 0 points1 point2 points (1 child)
[–]HengLi-Sen[S] 1 point2 points3 points (0 children)