I have a small config file for a program that this code creates, the file is created by converting the $Data variable into Json format txt file and reads back from it.
I would like the file to be encrypted and still be able to decrypt and read from it.
$path = "test.txt"
$Data = @{
File = "test.exe"
Folder = "c:\temp\"
count = "4"
}
$Data | ConvertTo-Json | Add-Content -Path $path
$NewData = Get-Content -Path $path -Raw | ConvertFrom-Json
$NewData.File
$NewData.Folder
$NewData.count
Any suggestions on how to add simple encryption and decryption?
Maybe using ConvertTo-SecureString.. I tried but cant get it to work (not even close).
Export-CliXml, the file can only be read by your user and only on the computer it was exported.