title: How do I set a checkbox to True using Powershell when processing a form?
body: <p>I need to automate a couple of steps in in a remote website using Powershell.</p>
  
  <p>I am using Invoke-WebRequest to fetch everything into $response which contains the element e.g. "checkboxelement"</p>
  
  <pre><code>$response = Invoke-WebRequest 'www.site.com' -SessionVariable session
  $form = $response.Forms[0]
  $action = $form.Action
  $mycheckbox = $response.ParsedHtml.getElementsByName("checkboxelement")
  </code></pre>
  
  <p>If I do</p>
  
  <pre><code>@($mycheckbox).checked
  </code></pre>
  
  <p>This returns</p>
  
  <pre><code>False
  </code></pre>
  
  <p>But I don't know how to set it to True so I can submit the form using another Invoke-WebRequest to the www.site.com/$form.Action</p>
  
  <p>I have tried</p>
  
  <pre><code>$mycheckbox.checked = $true
  </code></pre>
  
  <p>But I get this error</p>
  
  <pre><code>The property 'checked' cannot be found on this object. Verify that the property exists and can be set.
  At line:1 char:1
  + $mycheckbox.checked = $true
  + ~~~~~~~~~~~~~~~~~~~~~~~~~~
  + CategoryInfo          : InvalidOperation: (:) [], RuntimeException
  + FullyQualifiedErrorId : PropertyAssignmentException
  </code></pre>
  
  <p>So all I want to do is change the element checked status to True. Any help?</p>