title: Windows Network adaptor disable enable via Powershell
body: <p>My network card is rubbish and until I get a new one I need a quickfix. My idea was to have a program ping my router and when the ping failed 3 or 4 times, it would reset the network adaptor for my wifi card, however I do not know the command line commands to do this!</p>
  
  <p>I found the following in a stackoverflow question:</p>
  
  <pre><code>$adaptor = Get-WmiObject -Class Win32_NetworkAdapter | Where-Object {$_.Name -like "*Wireless*"}
  $adaptor.Disable()
  $adaptor.Enable()
  </code></pre>
  
  <p>However to run this the script needs to be running under admin privileges and I do not know how to fix that without manually launchign powershell to execute the script</p>