{"id":14031,"date":"2020-02-09T16:55:37","date_gmt":"2020-02-09T16:55:37","guid":{"rendered":"http:\/\/shivaprogramming.com\/blog\/?p=14031"},"modified":"2022-12-21T22:38:29","modified_gmt":"2022-12-21T22:38:29","slug":"change-registry-using-params","status":"publish","type":"post","link":"http:\/\/shivaprogramming.com\/blog\/change-registry-using-params\/","title":{"rendered":"Change Registry Using Params in powershell"},"content":{"rendered":"\n<pre class=\"wp-block-code\"><code>param (\n   \n   &#91;string]  $userName = \"UserName\",\n   &#91;Parameter(Mandatory=$true)] &#91;string] $value = \"SecretPassword\"\n   \n)\n\n$registryPath = \"HKLM:\\SOFTWARE\\WOW6432Node\\TESTAPP\"\nIF(!(Test-Path $registryPath))\n\n  {\n\n    New-Item -Path $registryPath -Force | Out-Null\n    New-ItemProperty -Path $registryPath -Name $userName -PropertyType 'String' -value $value\n\n}\n\n ELSE {\n    New-ItemProperty -Path $registryPath -Name $userName -Value $value -PropertyType 'String' -Force | Out-Null\n\n }<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":true,"template":"","format":"standard","meta":{"footnotes":""},"categories":[38],"tags":[],"class_list":["post-14031","post","type-post","status-publish","format-standard","hentry","category-powershell"],"_links":{"self":[{"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/posts\/14031","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/comments?post=14031"}],"version-history":[{"count":3,"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/posts\/14031\/revisions"}],"predecessor-version":[{"id":14915,"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/posts\/14031\/revisions\/14915"}],"wp:attachment":[{"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/media?parent=14031"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/categories?post=14031"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/shivaprogramming.com\/blog\/wp-json\/wp\/v2\/tags?post=14031"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}