Accidental Hyper-V Administrator
asked on
How might I determine if the currently logged on user had Admin privilidges ?
For this question, I have a pc in a workgroup.
Three user id's have been defined.
Administrator
Adminmember
Standarduser
This is a virgin Windows 7 X64 machine.
No policies modified. Ever.
All possible updates applied.
What I am try to do is: Determine if the currently logged account has Admin right or privileges.
I have seen several examples on the web of thing that might work.
I IE: Running "OPENFILES" and monitor the result.
Running "Net Session" and monitoring the result code.
Or even trying to read HKEY_USERS\S-1-5-19\Enviro nment\TEMP registry value. (Just attempt to read it.)
All three result in fallers (a good thing) if the account in use at the time (Standarduser) is a standard user
And all three result is the positive, if the account in use at the time ((Administrator) is THE local Administrator account.
But all three fail, if the account in use at the time (Adminmember), is a member of the local Administrators group.
This really confuses me.
My goal is to identify if the currently logged on user account has Administrative rights or privileges or not.
Thanks for any ideas.
Three user id's have been defined.
Administrator
Adminmember
Standarduser
This is a virgin Windows 7 X64 machine.
No policies modified. Ever.
All possible updates applied.
What I am try to do is: Determine if the currently logged account has Admin right or privileges.
I have seen several examples on the web of thing that might work.
I IE: Running "OPENFILES" and monitor the result.
Running "Net Session" and monitoring the result code.
Or even trying to read HKEY_USERS\S-1-5-19\Enviro
All three result in fallers (a good thing) if the account in use at the time (Standarduser) is a standard user
And all three result is the positive, if the account in use at the time ((Administrator) is THE local Administrator account.
But all three fail, if the account in use at the time (Adminmember), is a member of the local Administrators group.
This really confuses me.
My goal is to identify if the currently logged on user account has Administrative rights or privileges or not.
Thanks for any ideas.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks.
I do appreciate your efforts.
Unfortunately (for me), I don’t know anything about C#.
I have an existing VBScript that I was hoping to add lines of code to, in order to check for Admin rights.
And then execute various functions based on the currently logged on rights level.
I'm not smart enough to figure out how to add the C# code into my script
I do appreciate your efforts.
Unfortunately (for me), I don’t know anything about C#.
I have an existing VBScript that I was hoping to add lines of code to, in order to check for Admin rights.
And then execute various functions based on the currently logged on rights level.
I'm not smart enough to figure out how to add the C# code into my script
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks to all.
You’re the greatest !
You’re the greatest !
Using some c# code you can do that, try this :
Open in new window