I want to encrypt a text which I want to use in different PowerShell script without compromising its security as other user will be using scripts that will contain that text. Basically I want to conceal that text from everybody and use it without any hassle to all PowerShell scripts that are using that particular text. Text can be stored in a file so that it will be used in different scripts. I have tried basic things like :
$text = Read-Host "Enter the text" -AsSecureString
$BSTR = [System.Runtime.InteropServices.Marshal]::SecureStringToBSTR($text)
$Plaintext = [System.Runtime.InteropServices.Marshal]::PtrToStringAuto($BSTR)
Write-Host "Text is: " $PlainText
But the thing is it can easily be found if you are in same computer. I need some foolproof method if any.This is my first question so please ignore my mistakes, if any.