Sign in to follow this  
Followers 0
dbs179

User Priviledge Check?

7 posts in this topic

Hi all,

I have a script that I have been working on for a while now. I've been tied up with other things lately so it has been awhile since I last worked on it. Anyway, the script is for programming a multitude of serial devices that we use at my work. I have it almost worked out, but there is one annoying little item I would like to fix if I can. When the script launches, it kind of checks for Administrator rights by using

CODE
If @UserName <> 'Administrator' Then

But that doesn't always work. For example, if I have a use that is an Administrator on their PC, but the account is not called "Administrator" this method still requires them to enter a user name and password. Is there anyway that I can check to see if the current user is an Administrator and if so how? I did a few different searches here as well as in the help manual, but haven't been able to find anything. Also, I'm not sure if this matters or not, but this script could be used in either a work group, i.e. local users or in a domain (AD users).

Thanks for any help.

Dave

Share this post


Link to post
Share on other sites



#RequireAdmin

directive in your script says that the script must be run using admin credentials.

Also

IsAdmin()

function returns a bool.

Check help file. 8)

Share this post


Link to post
Share on other sites

I did a few different searches here as well as in the help manual, but haven't been able to find anything.

Are you sure you have searched? I don't believe you quite frankly.

I just entered "admin" in the help file and it came up with this.

Posted Image

Share this post


Link to post
Share on other sites

Manadar,

First, thanks for the quick reply and the point in the right direction. Second, contray to what you believe I actually did search, both here on the forums and in the help file. But I will say I didn't think it would be as simple as searching for "admin". I searched for privileges and user accounts as that is what I am checking for. From looking at the help file, it looks like IsAdmin is what I need.

Thanks again.

Dave

Share this post


Link to post
Share on other sites

That got it all worked out for me. Thanks so much. That is probably the simplest answer I have ever gotten when working with this program!!!

Dave

Share this post


Link to post
Share on other sites

I use vista on an admin acc.... and this doesnt give me the message box :D

If IsAdmin() Then MsgBox(0, "", "Admin rights detected")


[u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0