Monday, March 18, 2013

Powershell Script : Create An Encrypted Folder using Powershell.

Hi,

Windows Encryption is one of the best inbuilt security tool in windows7. My and my friends use windows encrypted file systems (EFS) a lot and may be you are using EFS in your windows environment.

Rather that create a whole DISK, My Documents, Desktop encrypted, I always prefer to create an encrypted folder somewhere on the disk and then put the files which you want to be encrypted in that encrypted folder.

I have written a small Powershell Script which created a encryption enabled folder on your desktop with folder name “Encrypted-Folder”.

You can download the script from this link http://gallery.technet.microsoft.com/scriptcenter/Create-Encrypted-Folder-6f0fe0c9

Script Logic
I have created a small flow charts on how this script works.
Encryption Script Sample
How it works.
  1. This script check for folder name “Encrypted-Folder” on your Desktop.
  2. If the Folder Exists.
    1. then it check if the attributes of the “Encrypted-Folder” is contains encrypted.
      1. If the Folder Attributes on “Encrypted-Folder”  contains “Encrypted”
      2. Then it won’t do anything.
      3. but
      4. If the Folder attributes doesn’t contains “Encrypted-Folder” 
      5. then
      6. it runs “cipher /e” command to make folder encrypted
  3. If the folder Does not exists,
    1. then this create a new folder “Encrypted-Folder”  on your desktop
    2. and encrypt it.
In this script i am using “cipher /e” to enable encryption. I have tested this script on windows7 and windows8 and it is working fine for me.
Screenshots.
18-03-2013 15-55-02
18-03-2013 16-15-19
18-03-2013 16-16-04

You can download the script from this link http://gallery.technet.microsoft.com/scriptcenter/Create-Encrypted-Folder-6f0fe0c9

That’s all for now.
Thanks
Aman Dhally
clip_image001 clip_image002 clip_image003 clip_image005clip_image007

1 comment:

  1. the script is great... thank you... But what I would like to be able to do is to have a script that can go though a users profile and encrypt the contents of the %USERPROFILE% is there a way to do this?

    ReplyDelete