{"id":6880,"date":"2023-04-28T04:23:27","date_gmt":"2023-04-28T04:23:27","guid":{"rendered":"https:\/\/pariswells.com\/blog\/?p=6880"},"modified":"2023-04-28T04:24:57","modified_gmt":"2023-04-28T04:24:57","slug":"how-to-save-secure-string-in-powershell","status":"publish","type":"post","link":"https:\/\/pariswells.com\/blog\/research\/how-to-save-secure-string-in-powershell","title":{"rendered":"How to save Secure String in Powershell"},"content":{"rendered":"\n<p>You need to do this for each user , only the user who saved the SecureString can call it<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">Write-Host \"Press Enter and Enter Secure Text and Enter Again\"\r\n$secure = read-host -asSecureString | convertfrom-securestring | out-file C:\\Scripts\\securePassword.txt\r\n<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">$credential = Get-Credential\r\n$credential.Password | ConvertFrom-SecureString | Set-Content c:\\scripts\\encrypted_password1.txt<\/code><\/pre>\n\n\n\n<p>For a Managed Service Account, I had to run CMD as Admin then run the below with psexec<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">psexec -i -u domain\\gMSA$ -p ~ powershell.exe\r<\/code><\/pre>\n\n\n\n<pre class=\"wp-block-code\"><code class=\"\">$Secure_String_Pwd = ConvertTo-SecureString 'XXXXXXXX' -AsPlainText -Force\n$Secure_String_Pwd | convertfrom-securestring | out-file C:\\Scripts\\securePassword.txt<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>You need to do this for each user , only the user who saved the SecureString can call it For a Managed Service Account, I had to [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-6880","post","type-post","status-publish","format-standard","hentry","category-research"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6880","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/comments?post=6880"}],"version-history":[{"count":2,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6880\/revisions"}],"predecessor-version":[{"id":6884,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/posts\/6880\/revisions\/6884"}],"wp:attachment":[{"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/media?parent=6880"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/categories?post=6880"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/pariswells.com\/blog\/wp-json\/wp\/v2\/tags?post=6880"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}