I've made several form objects with powershell and I want to have one of its textboxes containt the password data so I can then place it to the registry key. The thing is I would like to keep it there as secure text.
$Pass = (Read-Host 'specify password' -asSecureString | ConvertFrom-SecureString) $RegPath = 'HKCU:\Software\MyApp' New-Item -Path $RegPath -Name "Password" -Value "Default Value" -Force New-ItemProperty $RegPath -Name "Password"-PropertyType "String" -Value $CreatePass -Force $PassPath = (Get-ItemProperty -Path $Registry -Name Password).Password $LocAdmCred = domain\user $CredentialsSet = New-Object System.Management.Automation.PSCredential -ArgumentList @($LocAdmCred,(ConvertTo-SecureString -String $PassPath))What I want to set my $Pass variable to textbox.text value as secure string.