Major Upgrade to CSI_IsAdmin (.vbs, .cmd, .ps1) Print E-mail
Written by Darwin Sanoy   
Thursday, October 6, 2011 2:05pm

The CSI_IsAdmin script kit provides a quick and passive (doesn't try to change anything) way to check for admin rights on XP through Windows 7.  It includes code for VBScript (VBS), PowerShell (PS1) and Shell Scripting (.CMD/.BAT).  The previous version could report incorrect results under specific circumstances.

 

Our previous version of this script checked if files could be seen in the system profile (usually at %Windir%\System32\Config\systemprofile).  If a protected admin visits this folder, windows immediately prompts as to whether they would like to be given full permissions to the folder to see it - if they answer yes, then version 1.1 of CSI_IsAdmin would report that a protected admin on that machine has admin rights because it can see the files in the folder.

The new version uses a query to a registry key which is much less likely to have non-default permissions since regedit elevates when administrators use it (so they will never be prompted to change permissions to view the key).

Version 1.31 is the first version to include a PowerShell script that uses the same method.

Thanks go out to Scott Waters who submitted a sample script that revealed the need to move to a registry based solution and to Mike Diack who found a problem with XP.

Check it out in the toolkit.