A PowerShell module to perform symmetric AES based file encryption and decryption using a key derived from a user-provided password
The module is designed to work in Constrained PowerShell Language environments where native methods of .NET objects is forbidden. The module is therefore written in C# code and compiled
It is possible to build the module locally using the provided build.ps1 file. The script will compile the single code file into DLL and will attempt to place that in the user's PowerShell module folder within their profile, so no system-level access is required to install the module.
To build the module
-
From GitHub, download the source code as a .zip file.
-
Right Click the downloaded zip file and select Properties.
-
On the General tab check Unblock and click OK.
-
Right Click the .zip file and select Extract All....
-
Open a Windows DOS command prompt and change directory to the directory containing the downloaded code
-
Run the following command
powershell -nologo -noprofile -executionPolicy bypass -file build.ps1
-
The module will be built and copied into a folder within the user's
$PSModulePath
-
Open a PowerShell window and type
Get-Module -ListAvailable
. The FileEncryption module should be listed.
Import-Module FileEncryption $Password = Read-Host -AsSecureString Encrypt-File -InputFile infile -OutputFile outfile -Password $Password Decrypt-File -InputFile infile -OutputFile outfile -Password $Password