|
ndaniels -> Determining Admin Access via the CLI (5/9/2008 9:20:04 AM)
|
I'm looking for ideas on an easy way to determine if the user running my batch file is a local administrator (in a domain environment). For a non-domain environment, I figured I could probably just do something like this... net localgroup administrators|find /i "%USERNAME%" ...And then check for the error level. The problem I have is that, in a domain environment, the "Administrators" local group may also consist of global groups (like "Domain Admins") and, therefore, the user ID would not actually appear in the "Administrators" local group. I'd also like to do this without making changes to the file system, if possible. For example: I thought about attempting to create a text file inside the System32 folder and then checking for its existence; however, "Power Users" also have the ability to create files there. For some reason, I'm just drawing a blank. If anyone has any thoughts or ideas, I'd love to hear them. Thanks!
|
|
|
|