Script needed to encrypt a zip file

I would like to run a script, which will look at a specific folder in a path (ie C:\users\user1\desktop\, and encrypt that zip file with a password.
is this possible, please let me know.
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

I would use something like the following :

#Create Key
$key = New-CryptographyKey -Algorithm AES
#Encrypt the file
Protect-File '.\secrets.txt' -Algorithm AES -Key $key -RemoveSource
#Decrypt the file
Unprotect-File '.\secrets.txt.AES' -Algorithm AES -Key $key -RemoveSource
Did that work for you?

Probably worth noting that you can encrpyt a zip file when it is created, so you don't need to do it separately.

7-Zip (for example) allows AES-256 encrpytion, with a password based key.

Virus Depot: Cyber Crime Becomes Big Business

The rising threat of malware-as-a-service is not one to be overlooked. Malware-as-a-service is growing and easily purchased from a full-service cyber-criminal store in a “Virus Depot” fashion. View our webinar recording to learn how to best defend against these attacks!


Did you get a chance to test?
Gerwin Jansen, EE MVETopic Advisor Commented:
Already suggested by Alan, a command you can use for 7zip command line:

<path to executable>\7z a C:\users\user1\desktop\desktop_protected.7z C:\users\user1\desktop\ -pSECRET

SECRET is your password

You can add the optional -sdel parameter at the end to remove the .zip file once the .7z file has been created.

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
Good options provided.
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.