Administrator status

  • Thread starter Thread starter Jack Russell
  • Start date Start date
J

Jack Russell

Under XP I used the following code


AppDomain.CurrentDomain.SetPrincipalPolicy(Security.Principal.PrincipalPolicy.WindowsPrincipal)
Dim MyPrincipal As
System.Security.Principal.WindowsPrincipal =
CType(System.Threading.Thread.CurrentPrincipal,
System.Security.Principal.WindowsPrincipal)
bgIsAdministrator =
MyPrincipal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator)

However under Vista this returns false unless the program is
specifically run as an administrator.

I am not interested in that but in the account type (Administrator or
standard). How can I find that out please?

Thanks

Jack Russell
 
Jack Russell said:
Under XP I used the following code


AppDomain.CurrentDomain.SetPrincipalPolicy(Security.Principal.PrincipalPolicy.WindowsPrincipal)
Dim MyPrincipal As
System.Security.Principal.WindowsPrincipal =
CType(System.Threading.Thread.CurrentPrincipal,
System.Security.Principal.WindowsPrincipal)
bgIsAdministrator =
MyPrincipal.IsInRole(System.Security.Principal.WindowsBuiltInRole.Administrator)

However under Vista this returns false unless the program is specifically
run as an administrator.

I am not interested in that but in the account type (Administrator or
standard). How can I find that out please?

I think you're going to have to start following new security principles with
Vista.

<copied out of the link>
http://www.jimmah.com/vista/Security/uac.aspx
When UAC mode is enabled, every program that you run will be given only
"standard user" access to the system, even when you are logged in as an
administrator. There are only 2 ways that a program can be "elevated" to get
full admin access to the system:

a.. If it automatically asks you for permission when it starts up, and you
click Continue
b.. If you start the program with permission by right-clicking it, then
clicking Run As Administrator
A program either starts with STANDARD rights or, if you give permission,
ADMINISTRATOR rights, and once the program is running it cannot change from
one to the other.

If a program that you have already started with admin powers starts another
program, that program will automatically be given admin powers without
needing your permission. For example, if you start the command prompt as
administrator, and then start notepad from that command prompt, notepad WILL
ALSO automatically run WITH admin powers, and will not ask for permission.

<end copy>

Vista has tossed out what was being done the previous versions of the NT
classed O/S(s), and the reason why it's doing it that is being talked about
in the link, when it comes to security.

http://blogs.zdnet.com/Ou/?p=785
 
Back
Top