Celeb Glow
news | February 26, 2026

Powershell to encrypt text file with password or string

I'm running a shared computer with command prompt access, and I want to be able to encrypt and decrypt a text file from a powershell script, with a unique user-identified password. This way the file could not be opened without that password. I tried to use this module, however it seems to need something called a certificate. All I want is a powershell script that could be called with something like -Encrypt -File "Path\To\File" -Password -"12345" (and something similar to decrypt it). Does such a tool exist? If not, how would I go about doing this?

3

1 Answer

This script from the PS gallery might do the trick;

UPDATE: the gallery has been removed. I cant find a migrated version anywhere but the webarchive has a copy:

3

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy