{"id":5396,"date":"2017-01-23T11:44:39","date_gmt":"2017-01-23T16:44:39","guid":{"rendered":"http:\/\/jdhitsolutions.com\/blog\/?p=5396"},"modified":"2017-01-23T11:44:39","modified_gmt":"2017-01-23T16:44:39","slug":"storing-powershell-credentials-in-json","status":"publish","type":"post","link":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/","title":{"rendered":"Storing PowerShell Credentials in JSON"},"content":{"rendered":"<p>Sometimes I do things in PowerShell just to see what happens. This is a great way to learn about new cmdlets and techniques. Sometimes these experiments lead to useful results. Other times they may end up as teaching devices. Of\u00a0 course the result could serve both purposes and you may have to decide that today as I look at storing credentials in a JSON file.<\/p>\n<p><!--more--><\/p>\n<p>Since the early days of PowerShell we've preached the perils of hard-coding credentials in your scripts. If you need a password you should prompt for it, or write your PowerShell tool to accept a credential object. But there may be situations where you need to automate a process AND use an alternate or specific credential. One approach is to use the cliXML cmdlets to securely store a credential.<\/p>\n<pre class=\"lang:ps mark:0 decode:true \">$secure = ConvertTo-SecureString -String 'P@$$w0rd' -AsPlainText -Force\r\n$cred = New-Object -typename PSCredential -ArgumentList @('company\\admin',$secure)\r\n$cred | Export-clixml c:\\work\\admin.xml\r\n<\/pre>\n<p>I manually created a credential so you could see the password. When you use <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkId=821767\" target=\"_blank\">Export-Clixml<\/a> PowerShell automatically converts the secure string password.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image-9.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-9.png\" alt=\"image\" width=\"644\" height=\"205\" border=\"0\" \/><\/a><\/p>\n<p>The password is encrypted using native crypto APIs. You can only reverse the process on the same computer.<\/p>\n<pre class=\"lang:ps mark:0 decode:true \">$in = Import-clixml C:\\work\\admin.xml\r\n<\/pre>\n<p>If I copy the file to another computer and try the process I'll get an error.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image-10.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-10.png\" alt=\"image\" width=\"644\" height=\"75\" border=\"0\" \/><\/a><\/p>\n<p>Oh, and to prove the import worked locally:<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image-11.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-11.png\" alt=\"image\" width=\"612\" height=\"95\" border=\"0\" \/><\/a><\/p>\n<p>But what if, for some reason, you wanted to use a JSON file for the stored credential? How would you do it?<\/p>\n<p>PowerShell won't automatically insert the conversion steps, but they aren't that difficult to implement yourself. First, you have to\u00a0 select the username and convert the password back from a secure string.<\/p>\n<pre class=\"lang:ps mark:0 decode:true \">$cred | Select Username,@{Name=\"Password\";Expression = { $_.password | ConvertFrom-SecureString }}\r\n<\/pre>\n<p>This object can now be piped to <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=217032\" target=\"_blank\">Convertto-Json<\/a>:<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image-12.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-12.png\" alt=\"image\" width=\"644\" height=\"128\" border=\"0\" \/><\/a><\/p>\n<p>This cmdlet doesn't create a file so you will need to pipe to <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113363\" target=\"_blank\">Out-File<\/a> or <a title=\"Read online help for this command\" href=\"http:\/\/go.microsoft.com\/fwlink\/?LinkID=113392\" target=\"_blank\">Set-Content<\/a>.<\/p>\n<p>One slight advantage of json over XML is that the file overhead is smaller.<\/p>\n<p align=\"right\"><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image-13.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-13.png\" alt=\"image\" width=\"644\" height=\"220\" border=\"0\" \/><\/a><\/p>\n<p>But now let's see about brining it back to life. First, convert the content from JSON.<\/p>\n<pre class=\"lang:ps mark:0 decode:true \">$in = Get-Content -Path c:\\work\\admin.json | ConvertFrom-Json\r\n<\/pre>\n<p>Next, convert the password value back to a secure string.<\/p>\n<pre class=\"lang:ps mark:0 decode:true \">$secure = ConvertTo-SecureString $in.Password -ErrorAction Stop\r\n<\/pre>\n<p>Finally, create a credential object.<\/p>\n<pre class=\"lang:ps mark:0 decode:true \">$newcred = New-Object -TypeName PSCredential $in.username,$secure\r\n<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image-14.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-14.png\" alt=\"image\" width=\"644\" height=\"90\" border=\"0\" \/><\/a><\/p>\n<p>The whole process is really not that cumbersome, but I went ahead and created a PowerShell module called PSJsonCredential.<\/p>\n<p>The module has commands for exporting, importing and reporting.<\/p>\n<pre class=\"lang:ps mark:0 decode:true \">Export-PSCredentialToJson -Path c:\\work\\admin.json -Credential $cred\r\n<\/pre>\n<p>This command also has a -NoClobber parameter to avoid overwriting an existing file. I also added a metadata property to indicate who, where and when. You can get this data with Get-PSCredentialFromJson:<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image-15.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-15.png\" alt=\"image\" width=\"644\" height=\"178\" border=\"0\" \/><\/a><\/p>\n<p>The import command can ignore the metadata.<\/p>\n<pre class=\"lang:ps mark:0 decode:true \">$admin = Import-PSCredentialFromJson -Path C:\\work\\admin.json\r\n<\/pre>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image-16.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-16.png\" alt=\"image\" width=\"644\" height=\"90\" border=\"0\" \/><\/a><\/p>\n<p>I've published the module to the PowerShell gallery if you would like to try it out or look more closely at the code.<\/p>\n<p><a href=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image-17.png\"><img loading=\"lazy\" decoding=\"async\" style=\"background-image: none; padding-top: 0px; padding-left: 0px; margin: 0px; display: inline; padding-right: 0px; border-width: 0px;\" title=\"image\" src=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-17.png\" alt=\"image\" width=\"644\" height=\"112\" border=\"0\" \/><\/a><\/p>\n<p>As I mentioned at the beginning, this module is hardly groundbreaking and may have no practical use. But at the very least it might offer some insights into working with credentials and JSON files.<\/p>\n<p><span style=\"color: #ff0000;\">Note that storing a credential in *any* form to disk is a potential security risk and may not be allowed in some organizations. It is up to you to determine how suitable these techniques are in your company.<\/span><\/p>\n<p>I hope you'll let me know what you think and especially if you find a practical application.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Sometimes I do things in PowerShell just to see what happens. This is a great way to learn about new cmdlets and techniques. Sometimes these experiments lead to useful results. Other times they may end up as teaching devices. Of\u00a0 course the result could serve both purposes and you may have to decide that today&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"New from the blog today: Storing #PowerShell Credentials in JSON","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":true,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[4,8],"tags":[411,534,105],"class_list":["post-5396","post","type-post","status-publish","format-standard","hentry","category-powershell","category-scripting","tag-json","tag-powershell","tag-pscredential"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Storing PowerShell Credentials in JSON &#8226; The Lonely Administrator<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Storing PowerShell Credentials in JSON &#8226; The Lonely Administrator\" \/>\n<meta property=\"og:description\" content=\"Sometimes I do things in PowerShell just to see what happens. This is a great way to learn about new cmdlets and techniques. Sometimes these experiments lead to useful results. Other times they may end up as teaching devices. Of\u00a0 course the result could serve both purposes and you may have to decide that today...\" \/>\n<meta property=\"og:url\" content=\"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/\" \/>\n<meta property=\"og:site_name\" content=\"The Lonely Administrator\" \/>\n<meta property=\"article:published_time\" content=\"2017-01-23T16:44:39+00:00\" \/>\n<meta property=\"og:image\" content=\"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-9.png\" \/>\n<meta name=\"author\" content=\"Jeffery Hicks\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:site\" content=\"@JeffHicks\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Jeffery Hicks\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5396\\\/storing-powershell-credentials-in-json\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5396\\\/storing-powershell-credentials-in-json\\\/\"},\"author\":{\"name\":\"Jeffery Hicks\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"headline\":\"Storing PowerShell Credentials in JSON\",\"datePublished\":\"2017-01-23T16:44:39+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5396\\\/storing-powershell-credentials-in-json\\\/\"},\"wordCount\":511,\"commentCount\":7,\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5396\\\/storing-powershell-credentials-in-json\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/01\\\/image_thumb-9.png\",\"keywords\":[\"JSON\",\"PowerShell\",\"PSCredential\"],\"articleSection\":[\"PowerShell\",\"Scripting\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5396\\\/storing-powershell-credentials-in-json\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5396\\\/storing-powershell-credentials-in-json\\\/\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5396\\\/storing-powershell-credentials-in-json\\\/\",\"name\":\"Storing PowerShell Credentials in JSON &#8226; The Lonely Administrator\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5396\\\/storing-powershell-credentials-in-json\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5396\\\/storing-powershell-credentials-in-json\\\/#primaryimage\"},\"thumbnailUrl\":\"http:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/01\\\/image_thumb-9.png\",\"datePublished\":\"2017-01-23T16:44:39+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5396\\\/storing-powershell-credentials-in-json\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5396\\\/storing-powershell-credentials-in-json\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5396\\\/storing-powershell-credentials-in-json\\\/#primaryimage\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/01\\\/image_thumb-9.png\",\"contentUrl\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/wp-content\\\/uploads\\\/2017\\\/01\\\/image_thumb-9.png\",\"width\":644,\"height\":205},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/powershell\\\/5396\\\/storing-powershell-credentials-in-json\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"PowerShell\",\"item\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/category\\\/powershell\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Storing PowerShell Credentials in JSON\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/\",\"name\":\"The Lonely Administrator\",\"description\":\"Practical Advice for the Automating IT Pro\",\"publisher\":{\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":[\"Person\",\"Organization\"],\"@id\":\"https:\\\/\\\/jdhitsolutions.com\\\/blog\\\/#\\\/schema\\\/person\\\/d0258030b41f07fd745f4078bdf5b6c9\",\"name\":\"Jeffery Hicks\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\",\"caption\":\"Jeffery Hicks\"},\"logo\":{\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Storing PowerShell Credentials in JSON &#8226; The Lonely Administrator","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/","og_locale":"en_US","og_type":"article","og_title":"Storing PowerShell Credentials in JSON &#8226; The Lonely Administrator","og_description":"Sometimes I do things in PowerShell just to see what happens. This is a great way to learn about new cmdlets and techniques. Sometimes these experiments lead to useful results. Other times they may end up as teaching devices. Of\u00a0 course the result could serve both purposes and you may have to decide that today...","og_url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/","og_site_name":"The Lonely Administrator","article_published_time":"2017-01-23T16:44:39+00:00","og_image":[{"url":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-9.png","type":"","width":"","height":""}],"author":"Jeffery Hicks","twitter_card":"summary_large_image","twitter_creator":"@JeffHicks","twitter_site":"@JeffHicks","twitter_misc":{"Written by":"Jeffery Hicks","Est. reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/#article","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/"},"author":{"name":"Jeffery Hicks","@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"headline":"Storing PowerShell Credentials in JSON","datePublished":"2017-01-23T16:44:39+00:00","mainEntityOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/"},"wordCount":511,"commentCount":7,"publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-9.png","keywords":["JSON","PowerShell","PSCredential"],"articleSection":["PowerShell","Scripting"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/","url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/","name":"Storing PowerShell Credentials in JSON &#8226; The Lonely Administrator","isPartOf":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/#primaryimage"},"image":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/#primaryimage"},"thumbnailUrl":"http:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-9.png","datePublished":"2017-01-23T16:44:39+00:00","breadcrumb":{"@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/#primaryimage","url":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-9.png","contentUrl":"https:\/\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2017\/01\/image_thumb-9.png","width":644,"height":205},{"@type":"BreadcrumbList","@id":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5396\/storing-powershell-credentials-in-json\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"PowerShell","item":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},{"@type":"ListItem","position":2,"name":"Storing PowerShell Credentials in JSON"}]},{"@type":"WebSite","@id":"https:\/\/jdhitsolutions.com\/blog\/#website","url":"https:\/\/jdhitsolutions.com\/blog\/","name":"The Lonely Administrator","description":"Practical Advice for the Automating IT Pro","publisher":{"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/jdhitsolutions.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":["Person","Organization"],"@id":"https:\/\/jdhitsolutions.com\/blog\/#\/schema\/person\/d0258030b41f07fd745f4078bdf5b6c9","name":"Jeffery Hicks","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","url":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg","caption":"Jeffery Hicks"},"logo":{"@id":"https:\/\/secure.gravatar.com\/avatar\/832ae5d438fdcfc1420d720cd1991307927de8a0b12f2342e81c30f773e21098?s=96&d=wavatar&r=pg"}}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_likes_enabled":true,"jetpack-related-posts":[{"id":5132,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5132\/downloading-git-tips-with-powershell\/","url_meta":{"origin":5396,"position":0},"title":"Downloading Git Tips with PowerShell","author":"Jeffery Hicks","date":"June 27, 2016","format":false,"excerpt":"So I've been sharing a number of PowerShell tools I've created for working with Git, including a few for getting tips from the Git Tips project on GitHub. My initial work was based on the fact that I had a local clone of that repository and wanted to search the\u2026","rel":"","context":"In &quot;Git&quot;","block_context":{"text":"Git","link":"https:\/\/jdhitsolutions.com\/blog\/category\/git\/"},"img":{"alt_text":"getting all online git tips with PowerShell","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-22.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-22.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-22.png?resize=525%2C300 1.5x"},"classes":[]},{"id":6612,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/6612\/more-fun-with-docker-containers-and-powershell\/","url_meta":{"origin":5396,"position":1},"title":"More Fun with Docker Containers and PowerShell","author":"Jeffery Hicks","date":"March 29, 2019","format":false,"excerpt":"A few days ago I shared some experiences of working with Docker containers and PowerShell. As I continue to learn Docker, I am also learning how to manage it with PowerShell. The Docker command line tools are fine but I think they are even better when drizzled with a nice\u2026","rel":"","context":"In &quot;Docker&quot;","block_context":{"text":"Docker","link":"https:\/\/jdhitsolutions.com\/blog\/category\/docker\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/03\/image_thumb-20.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/03\/image_thumb-20.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/03\/image_thumb-20.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2019\/03\/image_thumb-20.png?resize=700%2C400&ssl=1 2x"},"classes":[]},{"id":2591,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell-3-0\/2591\/friday-fun-testing-google-chrome-bookmarks-with-powershell\/","url_meta":{"origin":5396,"position":2},"title":"Friday Fun: Testing Google Chrome Bookmarks with PowerShell","author":"Jeffery Hicks","date":"November 23, 2012","format":false,"excerpt":"I was cleaning up and organizing bookmarks in Google Chrome today and decided to find out where they were stored on my computer. I found the Bookmarks file in a local app data folder. Opening it up in Notepad I was pleasantly surprised to discover it is in JSON. Excellent!\u2026","rel":"","context":"In &quot;Powershell 3.0&quot;","block_context":{"text":"Powershell 3.0","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell-3-0\/"},"img":{"alt_text":"","src":"","width":0,"height":0},"classes":[]},{"id":2809,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/2809\/powershell-morning-report-with-credentials\/","url_meta":{"origin":5396,"position":3},"title":"PowerShell Morning Report with Credentials","author":"Jeffery Hicks","date":"February 22, 2013","format":false,"excerpt":"I had an email about trying to use my Morning Report script to connect to machines that required alternate credentials. For example, you might have non-domain systems in a DMZ. Fair enough. Since most of the report script uses WMI, it wasn't too hard to add a Credential parameter and\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"morning report","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2013\/02\/morningreport-revised-cred-1024x654.png?resize=525%2C300 1.5x"},"classes":[]},{"id":5121,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/5121\/friday-fun-find-a-git-tip-with-powershell\/","url_meta":{"origin":5396,"position":4},"title":"Friday Fun: Find a Git Tip with PowerShell","author":"Jeffery Hicks","date":"June 24, 2016","format":false,"excerpt":"Recently I published a PowerShell function that I use to display a random Git Tip of the Day. The function relies on my clone of the Git-Tips project on GitHub. I've been keeping tabs on this project and a question was posed about creating a command line utility to search\u2026","rel":"","context":"In &quot;Friday Fun&quot;","block_context":{"text":"Friday Fun","link":"https:\/\/jdhitsolutions.com\/blog\/category\/friday-fun\/"},"img":{"alt_text":"finding a git tip with PowerShell","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-20.png?resize=350%2C200","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-20.png?resize=350%2C200 1x, https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2016\/06\/image_thumb-20.png?resize=525%2C300 1.5x"},"classes":[]},{"id":7371,"url":"https:\/\/jdhitsolutions.com\/blog\/powershell\/7371\/ps7now-ebook-available\/","url_meta":{"origin":5396,"position":5},"title":"#PS7Now Ebook Available","author":"Jeffery Hicks","date":"March 26, 2020","format":false,"excerpt":"A few weeks ago, I was part of a PowerShell community event that was designed to educate and spark interest around the general release of PowerShell 7. I organized a week of blogging\u00a0 by some of your favorite PowerShell bloggers and community activists. We release a week's worth of material\u2026","rel":"","context":"In &quot;PowerShell&quot;","block_context":{"text":"PowerShell","link":"https:\/\/jdhitsolutions.com\/blog\/category\/powershell\/"},"img":{"alt_text":"PS7Now","src":"https:\/\/i0.wp.com\/jdhitsolutions.com\/blog\/wp-content\/uploads\/2020\/03\/PS7NowBookCover-thumb.jpg?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]}],"_links":{"self":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5396","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/comments?post=5396"}],"version-history":[{"count":0,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/posts\/5396\/revisions"}],"wp:attachment":[{"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/media?parent=5396"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/categories?post=5396"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jdhitsolutions.com\/blog\/wp-json\/wp\/v2\/tags?post=5396"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}