{"id":51,"date":"2021-03-18T21:37:04","date_gmt":"2021-03-18T20:37:04","guid":{"rendered":"https:\/\/www.hitziger-solutions.de\/?p=51"},"modified":"2021-03-18T21:37:04","modified_gmt":"2021-03-18T20:37:04","slug":"variabel-read-only","status":"publish","type":"post","link":"https:\/\/www.hitziger-solutions.de\/en\/variabel-read-only\/","title":{"rendered":"Variabel read-only?"},"content":{"rendered":"<p class=\"wp-block-paragraph\">Today I stumbled upon the error \"Variable $ False cannot be changed because it is readonly\" in Powershell. The faulty code is hidden here:<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>param($neuerBenutzer, $verzeichnis, $zugriffsrechte, $testModus=$False, $behalteStandard=$True)<\/code><\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The problem wasn't the code, but the order. In this case, Param belongs to the whole script. So it has to be at the beginning of the code.<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">The error appears if you have cls in front of param, for example, or maybe an add-in is loaded. Just change the order and it'll work again.<\/p>","protected":false},"excerpt":{"rendered":"<p>Ich bin heute in Powershell \u00fcber den Fehler &#8222;Variabel $False kann nicht ge\u00e4ndert werden, da sie readonly ist.&#8220; gestolpert. Der fehlerhafte Code versteckt sich hier: param($neuerBenutzer, $verzeichnis, $zugriffsrechte, $testModus=$False, $behalteStandard=$True) Das Problem war nicht der Code, sondern die Reihenfolge. Param geh\u00f6rt in dem Fall zum ganzen Skript. Somit muss es am Anfang vom Code stehen. [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[39],"tags":[44,40,42,41,45,43],"class_list":["post-51","post","type-post","status-publish","format-standard","hentry","category-powershell","tag-param","tag-powershell","tag-read-only","tag-readonly","tag-reihenfolge","tag-variabel"],"_links":{"self":[{"href":"https:\/\/www.hitziger-solutions.de\/en\/wp-json\/wp\/v2\/posts\/51","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.hitziger-solutions.de\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.hitziger-solutions.de\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.hitziger-solutions.de\/en\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.hitziger-solutions.de\/en\/wp-json\/wp\/v2\/comments?post=51"}],"version-history":[{"count":2,"href":"https:\/\/www.hitziger-solutions.de\/en\/wp-json\/wp\/v2\/posts\/51\/revisions"}],"predecessor-version":[{"id":53,"href":"https:\/\/www.hitziger-solutions.de\/en\/wp-json\/wp\/v2\/posts\/51\/revisions\/53"}],"wp:attachment":[{"href":"https:\/\/www.hitziger-solutions.de\/en\/wp-json\/wp\/v2\/media?parent=51"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.hitziger-solutions.de\/en\/wp-json\/wp\/v2\/categories?post=51"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.hitziger-solutions.de\/en\/wp-json\/wp\/v2\/tags?post=51"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}