2

enter image description hereI have folder in my D drive containing a notepad file, I want to checked the (Encrypt Contents to Secure data) which is in properties->Advance option using Powershell code. I tried a lot but didn't find any solution. Thanks

4
  • Hi, SO is not a scriptwriting service. Please provide at least an example of your work (btw, what you want to achieve is possible and actually very easy using Powershell) Commented Nov 21, 2018 at 10:11
  • I upload the image, what I want is that only get checked the "Encrypt Content to Secure Data" option of file using powershell Commented Nov 21, 2018 at 10:24
  • Please provide a code sample of your own work so far. Using the default Windows encryption is very easy using Powershell, but before I will post an answer I need to see what you have written so far (SO is not a script writing function). As a hint : try doing Get-Item on a file (stick it in a variable) and then call the Encrypt() function... Commented Nov 21, 2018 at 11:35
  • I even don't know what command is used for encryption in powershell. Commented Nov 21, 2018 at 15:03

1 Answer 1

1

For Encryption and Decryption the Encrypt() and Decrypt() functions use as the Following line

(get-Item -path "c:\Users\UserName\Desktop\file.txt").Encrypt()
(get-Item -path "c:\Users\UserName\Desktop\file.txt").Decrypt()
Sign up to request clarification or add additional context in comments.

1 Comment

How do you do this for directories?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.