Test-IsAdmin

This Advanced Function will look to see if the current user context running a command/script is an Administrator or not. If not, a menu is presented to the user to either continue or enter alternate credentials.

Test-IsAdmin.ps1
 
 
 
 
 
5 Star
(5)
7,359 times
Add to favorites
2/25/2012
E-mail Twitter del.icio.us Digg Facebook
  • Not Work.
    1 Posts | Last post May 15, 2014
    • When a user in a AD group and the group in local administrator group(not the user),this script didn't check out the user right.
  • Correction to usage example
    4 Posts | Last post January 09, 2012
    • Excellent script, and useful. Should the usage example be?
      
      
      $admincheck = Test-IsAdmin
       
      If ($admincheck -is [System.Management.Automation.PSCredential]) 
      
      
    • Yes.  Refer to his article:
      
      http://blogs.technet.com/b/heyscriptingguy/archive/2011/05/11/check-for-admin-credentials-in-a-powershell-script.aspx
    • Hi Richard! Sorry I am horribly behind in checking up on my notifications. You are correct in that would be the correct usage for the script. Thanks PQSC.Programmer for the answer as well.
    • amazing little script you have here thank you for sharing it