Encrypting and Decrypting Files with EFS

by Nov 10, 2014

All PowerShell versions

Provided EFS (Encrypting File System) is enabled on your system, and you are saving files to a NTFS location, then this is how you can encrypt any file and make sure only you can read it:

(Get-Item -Path 'C:\path..to..some..file.txt').Encrypt() 

If encryption succeeds, the file will now be displayed with green instead of black labels in explorer.exe. Use Decrypt() instead of Encrypt() to undo the encryption.

Note that EFS may have to be set up first, and that your company may require a centrally stored backup key for encryption.

Twitter This Tip! ReTweet this Tip!