dbs179 Posted March 19, 2009 Posted March 19, 2009 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 CODEIf @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
jvanegmond Posted March 19, 2009 Posted March 19, 2009 #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) github.com/jvanegmond
jvanegmond Posted March 19, 2009 Posted March 19, 2009 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. github.com/jvanegmond
dbs179 Posted March 19, 2009 Author Posted March 19, 2009 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
jvanegmond Posted March 19, 2009 Posted March 19, 2009 (edited) I understand now.Look under my avatar to the right left of my post.<-- here Edited March 19, 2009 by Manadar github.com/jvanegmond
dbs179 Posted March 19, 2009 Author Posted March 19, 2009 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
ReaImDown Posted March 24, 2009 Posted March 24, 2009 I use vista on an admin acc.... and this doesnt give me the message box If IsAdmin() Then MsgBox(0, "", "Admin rights detected") [u][font="Century Gothic"]~я α и d γ ĵ . ċ . ѕ қ ϊ и и ε я~- My Programs -auto shutdownSleep funcdisallow programs[/font][/u]
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now