title: Check if logged on user is an administrator when non-elevated
body: <p>I needed to check whether the currently logged on user is an administrator however found that just using 'net localgroup administrators' was insufficient when it came to AD groups being a member of the administrators group. </p>
  
  <p>[Edit:] It is easy to confuse administrator privilege in general with elevated privileges of a specific instance and I just want to highlight that this question/answer does not deal with process elevation status checking.  The requirement is to generally ascertain whether or not a logged on user is an administrators group member.  Much more common is the need to determine whether or not your script is running with administrator privileges.  If this is what you require then please look here instead: <a href="https://stackoverflow.com/questions/18674801/administrative-privileges">Administrative privileges</a>  </p>
  
  <p>In this particular case, there is a policy disabling the admin shares (ruling out a previous technique I used with Windows XP of testing for the existence of the admin share using \127.0.0.1\admin$ to determine if the current user is an administrator). 
  [/Edit]</p>
  
  <p>Below is the code I gathered and wrote see if the logged on user is an administrator.</p>
  
  <p>I hope this helps someone else who requires the same thing that I did.</p>
  
  <p>If anyone can provide a more elegant solution it would be appreciated!</p>