Tools for PowerShell
This tool allows you to convert a binary file between Base64 Text and Raw Binary; it also includes some things like MD5 Hash Checking and Length Checking, to verify the output file is going to be a binary match with the input.
This is useful for when you have access to Copy & Paste Text into a remote VM, (e.g. into Notepad) but you do not have the ability to copy files directly (e.g. Excel files, .zip files, etc.).
The only requirement is PowerShell 5 or greater.
Note: Be advised that for very large files, this may cause a temporary hang if you attempt to copy & paste the entire text file all at once. I do not recommend using this method for files over 50 MB in size, unless you have no other choice.
- Open PowerShell 5 or later on the target machine.
- Copy the following command:
& ([scriptblock]::Create((irm "https://raw.githubusercontent.com/BrainSlugs83/PowerShell-Tools/refs/heads/main/Run-FileEncodingTool.ps1")))- Paste the command into the PowerShell prompt and press Enter, and the tool should open.
- On a machine where GitHub is not blocked (e.g. your local computer where you are reading this file from 😉):
- Navigate to Run-FileEncodingTool.ps1
- Select All (CTRL+A)
- Copy (CTRL+C)
- On your target machine, where GitHub is blocked, Open PowerShell 5 or later.
- Paste (CTRL+V)
- Select "Paste Anyway" if the option is presented.
- If neccessary, press Enter, and the tool should open.
- Run the tool on the machine where the input binary file resides (e.g. your local machine).
- Select "Encode File".
- In the Open Dialog Box, select the raw binary file that you want to convert into text.
- In the Save File Dialog Box, select the text file to output to.
- Wait for the process to complete successfully.
- Once completed, navigate to the text file, and open it in your favorite text editor.
- Once the file is open in a text editor, Select All (CTRL+A).
- Copy (CTRL+C).
- In your remote VM, create a new text file using your text editor.
- Paste the text (CTRL+V) into the remote text editor.
- Save the file.
- Run the tool on the machine where the input text file resides (e.g. the foreign machine where you saved the text file to in the previous steps).
- Select "Decode File".
- In the Open File Dialog Box, select the raw text file that you want to convert back into a binary.
- In the Save File Dialog Box, select the output file that you want to recreate.
- Wait for the process to complete successfully.
- You should see some messages in the log regarding the file size ("Length") and the Hash ("MD5 Hash"). There should either be a message indicating the file was recreated successfully, or a warning that the output file does not match the intended file size ("Length") or Hash ("MD5 Hash"). -- If you get a warning, it probably means you did not select the entire file in the original text file.