title: Why does adding URL to IE Compatibility View fix PowerShell 'Cannot find an overload for getElementByName' error?
body: <p>I had a similar issue compared to the following SO threads:</p>
  
  <p><a href="https://stackoverflow.com/questions/12733143/powershell-system-comobject-document-property-no-longer-works-under-ie-9">Powershell System.__ComObject.document property no longer works under IE 9</a></p>
  
  <p><a href="https://stackoverflow.com/questions/13869518/powershell-ie9-comobject-has-all-null-properties-after-navigating-to-webpage/14996243#14996243">PowerShell IE9 ComObject has all null properties after navigating to webpage</a></p>
  
  <p><a href="https://stackoverflow.com/questions/24660691/cannot-find-an-overload-for-getelementbyid-and-the-argument-count-1">Cannot find an overload for &quot;getElementById&quot; and the argument count: &quot;1&quot;</a></p>
  
  <p>My error was something to the effect of:</p>
  
  <blockquote>
    <p>Cannot find an overload for "getElementsByName" and the argument count: "1"...</p>
  </blockquote>
  
  <p>So I looked at each of these threads to help determine the why and the solutions to this problem.</p>
  
  <p>I'm running <code>PowerShell 4.0</code> on <code>Windows Server 2012 R2</code>. The script runs with <code>Execution Policy Bypass</code> and I am also running PowerShell as an Administrator (i..e. Administrator: Windows PowerShell ISE) AND my user account is part of the Administrator group. The URL the script is accessing is on the <code>Intranet</code> (one would think <code>Internet Explorer</code> isolates it to the proper zone, namely the <code>Intranet Zone</code>).</p>
  
  <p>The script worked fine on my local machine but not on this server.</p>
  
  <p>Here are the list of things I tried--one at at time, never in combination--that failed to yield a successful outcome:</p>
  
  <ul>
  <li>Disabled Protected Mode in the Internet Zone.</li>
  <li>Added URL to Trusted Zone Sites. Note that Protected Mode was already disabled. Only change I made here was adding the URL to the Trusted Sites list.</li>
  <li>Disabled IE Enhanced Security Configuration completely. <em>Administrators</em> was already set to <em>Off</em>, but <em>Users</em> was set to <em>On</em>. I set <em>Users</em> to <em>Off</em>, which had no effect.</li>
  <li>Ensured PowerShell ISE was running in Administrator mode (elevated privileges). It didn't seem to matter what mode PowerShell ISE was running in, likely because Execution Policy is set to Bypass.</li>
  <li>Added URL to Intranet Zone Site List. Note that Protected Mode was set to disabled, prior to. Only change I made in this zone was adding the URL to its Site List. Initially worked but then I tried again and same problem. May have been a fluke that it worked.</li>
  </ul>
  
  <p>Here are the list of things that I tried--again, one at a time--that solved the problem:</p>
  
  <ul>
  <li>Added URL to <em>Compatibility View with Display intranet sites in Compatibility View</em> <strong>unchecked</strong>.</li>
  <li>Added URL to <em>Compatibility View with Display intranet sites in Compatibility View</em> <strong>checked</strong>.</li>
  </ul>
  
  <p>So the question is why does employing Compatibility View resolve the problem? What's different about this that the other things I tried didn't work?</p>
  
  <p>One would think Trusted Zone Site List should do the trick. Security Level for Trusted Zone is set to <em>Medium</em>. For Intranet Zone, it's <em>Medium-low</em>. And for Internet Zone, it's set to <em>Custom</em>.</p>
  
  <p>Is it related to one or more of the individual properties that you can set in a Security Level? Is it something under the covers with Registry, COM, IE?</p>
  
  <p>Good thing is I found 2 solutions which worked. Bad thing is I don't quite understand why. Obviously, it works because of some relaxed security permissions. Maybe it's also tied to Group Policy settings. I'm not sure.</p>
  
  <p>Anyone have any ideas here? Thank you.</p>