{"id":165,"date":"2017-10-28T23:11:01","date_gmt":"2017-10-28T23:11:01","guid":{"rendered":"http:\/\/zewwy.ca\/?p=165"},"modified":"2018-01-14T04:13:12","modified_gmt":"2018-01-14T04:13:12","slug":"arrays-gone-astray","status":"publish","type":"post","link":"https:\/\/zewwy.ca\/index.php\/2017\/10\/28\/arrays-gone-astray\/","title":{"rendered":"Arrays Gone Astray"},"content":{"rendered":"<div class=\"blogbody\">\n<p>I love powershell, and as one figures you&#8217;ll have to deal with arrays. and when you learn them, they become a handy tool for any dev\/scripters toolkit.<br \/>\n<a href=\"http:\/\/www.jonathanmedd.net\/2014\/01\/adding-and-removing-items-from-a-powershell-array.html\">This guy covers it well.<\/a> in short do this<\/p>\n<pre>PS C:\\Scripts&gt; $Fruit = @(\"Apple\",\"Banna\",\"Orange\")\r\nPS C:\\Scripts&gt; $Fruit.Add(\"Kiwi\")\r\nException calling \"Add\" with \"1\" argument(s): \"Collection was of a fixed size.\"\r\nAt line:1 char:1\r\n+ $Fruit.Add(\"Kiwi\")\r\n+ ~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException\r\n    + FullyQualifiedErrorId : NotSupportedException\r\n\r\nPS C:\\Scripts&gt; $Fruit = $Fruit + \"Kiwi\"\r\nPS C:\\Scripts&gt; $Fruit\r\nApple\r\nBanna\r\nOrange\r\nKiwi\r\nPS C:\\Scripts&gt; $Fruit.GetType()\r\n\r\nIsPublic IsSerial Name                                     BaseType\r\n-------- -------- ----                                     --------\r\nTrue     True     Object[]                                 System.Array\r\n\r\n\r\nPS C:\\Scripts&gt; $Fruit = $Fruit - \"Kiwi\"\r\nMethod invocation failed because [System.Object[]] does not contain a method named 'op_Subtraction'.\r\nAt line:1 char:1\r\n+ $Fruit = $Fruit - \"Kiwi\"\r\n+ ~~~~~~~~~~~~~~~~~~~~~~~~\r\n    + CategoryInfo          : InvalidOperation: (op_Subtraction:String) [], RuntimeException\r\n    + FullyQualifiedErrorId : MethodNotFound\r\nPS C:\\Scripts&gt; $Fruit = $Fruit -ne \"Kiwi\"\r\nPS C:\\Scripts&gt; $Fruit\r\nApple\r\nBanna\r\nOrange\r\nPS C:\\Scripts&gt; $FruitIsFixedSize\r\nPS C:\\Scripts&gt; $Fruit.IsFixedSize\r\nTrue\r\n<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>I love powershell, and as one figures you&#8217;ll have to deal with arrays. and when you learn them, they become a handy tool for any dev\/scripters toolkit. This guy covers it well. in short do this PS C:\\Scripts&gt; $Fruit = @(&#8220;Apple&#8221;,&#8221;Banna&#8221;,&#8221;Orange&#8221;) PS C:\\Scripts&gt; $Fruit.Add(&#8220;Kiwi&#8221;) Exception calling &#8220;Add&#8221; with &#8220;1&#8221; argument(s): &#8220;Collection was of a fixed &hellip; <\/p>\n<p class=\"link-more\"><a href=\"https:\/\/zewwy.ca\/index.php\/2017\/10\/28\/arrays-gone-astray\/\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Arrays Gone Astray&#8221;<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"sfsi_plus_gutenberg_text_before_share":"","sfsi_plus_gutenberg_show_text_before_share":"","sfsi_plus_gutenberg_icon_type":"","sfsi_plus_gutenberg_icon_alignemt":"","sfsi_plus_gutenburg_max_per_row":"","footnotes":""},"categories":[11,12,8],"tags":[],"class_list":["post-165","post","type-post","status-publish","format-standard","hentry","category-scripting","category-powershell","category-server-administration"],"_links":{"self":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/165","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/comments?post=165"}],"version-history":[{"count":1,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/165\/revisions"}],"predecessor-version":[{"id":166,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/posts\/165\/revisions\/166"}],"wp:attachment":[{"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/media?parent=165"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/categories?post=165"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/zewwy.ca\/index.php\/wp-json\/wp\/v2\/tags?post=165"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}