title: Check if the script has elevated permissions
body: <p>I would like to check whether the context in which my VBscript runs allows me to perform administrative tasks.</p>
  
  <p><b>Requirements:</b></p>
  
  <ul>
  <li>The solution should work on all Windows operating systems starting with Server 2003. (<b>This rules out solutions which just check for membership in the Administrators group</b> -- remember that there's UAC in Vista and Windows 7!)</li>
  <li>The solution should be <b>simple</b>. A 50 LOC solution that checks the Windows group memberships (recursively, of course, since the user might be member of a groups which is member of a group ... which is member of the Administrators group) and then does some extra checks for Vista UAC is <b>not simple</b>.</li>
  <li>The solution may be a bit dirty, so something along the lines of <a href="https://serverfault.com/questions/76642">this solution</a> would be ok.</li>
  <li>It should not be too dirty. Writing a file to C:\Windows or writing a registry key is too dirty in my opinion, since it modifies the system. (EDIT: Which might not work anyway: for example, when using VBScript in a HTA, UAC redirection kicks in.)</li>
  </ul>
  
  <p>Related question: <a href="https://stackoverflow.com/questions/301860/">https://stackoverflow.com/questions/301860</a> (all of the answers I found there (a) ignore the UAC issue and (b) are faulty because they ignore the possibility of a user having administrative permissions although not being direct member in the Administrators group)</p>