# Secure string

**URL:** <https://forums.powershell.org/t/secure-string/6917>\
**Category:** PowerShell Help\
**Created:** [August 1, 2016, 11:25am UTC](https://forums.powershell.org/t/secure-string/6917 "2016-08-01T11:25:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![powershell-admin](https://avatars.discourse-cdn.com/v4/letter/p/8dc957/32.png) [@powershell-admin](https://forums.powershell.org/u/powershell-admin)\
**Post date:** [August 1, 2016, 11:25am UTC](https://forums.powershell.org/t/secure-string/6917/1 "2016-08-01T11:25:12Z")

</div>

Hello,  
I would like to get a key from the user and store it in registry in a secured way and i would like to retrieve it whenever required to execute a service through PS script.

$PSSecretKey=Read-host -Prompt “Enter Secret-Key” -AsSecureString  
$PSEncryptedkey = ConvertFrom-SecureString -SecureString $PSSecretKey

I am storing $PSEncryptedkey in registry and i am trying to retrieve it as a plaintext , but its not happening

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [August 8, 2016, 3:20pm UTC](https://forums.powershell.org/t/secure-string/6917/2 "2016-08-08T15:20:34Z")

</div>

So… I guess, if you’re planning to store it in clear text in the registry, why are you bothering with SecureString at all?

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:40pm UTC](https://forums.powershell.org/t/secure-string/6917/3 "2024-05-16T20:40:46Z")

</div>

Closed on May 16, 2024, 8:40pm UTC


