title: How to stop windows service as administrator in python?
body: <p>I already tried a few ways but none of them worked.</p>
  <pre><code>os.system('net stop service_name')
  </code></pre>
  <p>which returns &quot;System error 5 has occurred. Access denied.</p>
  <pre><code>os.system('runas /user:Administrator net stop service_name')
  </code></pre>
  <p>no errors, but nothing happened</p>
  <pre><code>subprocess.Popen(
      ['runas', '/user:Administrator', 'net stop service_name'],
      stdin=subprocess.PIPE
  )
  process.stdin.write(b'admin_password_here')
  </code></pre>
  <p>again nothing happened</p>
  <pre><code>win32serviceutil.StopService(service_name)
  </code></pre>
  <p>and few more ways</p>