Assume I have a custom PowerShell Cmdlet that exports data and encrypts it using a password.
[Cmdlet(VerbsData.Export, "SampleData")] public class ExportSampleData : PSCmdlet { [Parameter(Mandatory = true)] public string Password { get; set; } /* additional parameters */ } How does one appropriately handle the passwords securely? For example, I'd like to prevent the value from being displayed when the administrator types it in the console. Other options include reading a file that contains an encrypted password.
I'm aware of PSCredential but that requires a user name which makes no sense in this scenario.