$IsAdmin Variable

Topics: Archive - General
Nov 27, 2014 at 2:30 AM
Hi,
  1. What exactly is suppose doing that variable? Finding the local admin account Guid or if I am a local admin?
[boolean]$IsAdmin = [boolean]($CurrentProcessToken.Groups -contains [System.Security.Principal.SecurityIdentifier]'S-1-5-32-544')

I am actually looking to your code and I believe it is truly wonderful. You did a great job.
  1. Is it possible to specify a .ico and a .png from the xml file? If I would like using my organisation logo, it would be interesting without the need of modify each time the main file.
Thanks,

François
Developer
Nov 27, 2014 at 3:15 AM
That variable determines if the current process is running with admin privileges. You can replace the .ico and banner file with your own. Just keep the name the same and your company branding will be applied.
Nov 27, 2014 at 11:55 AM
Hi,

If I am member of the local admin group, would it return a true or false value?

On Vista 32 and Windows 7 64 bit, I get false but I a local admin member for both machines.
[boolean]($CurrentProcessToken.Groups -contains [System.Security.Principal.SecurityIdentifier]'S-1-5-32-544')

Thanks,

François
Developer
Nov 27, 2014 at 7:29 PM
It will only return true if you run the code in an elevated command prompt. It is not checking for membership in the local admin group. It checks if the current process has the Admin SID on its access token. We want to check if the current process is elevated and thus has Admin permissions.