From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

windows 7 & elevated privileges

I've done a bit of searching but can't find an answer to my questions on dealing with elevated privileges in window 7 environment.

 

1. How to test if current program is running with elevated privilege?

     This would be useful to tell a user that if not elevated they must run the program with elevated privilege (right click run as administrator) and terminating the program.

2. Creating a program that needs elevated prifilege and prompts user with Yes/No for elevated privilege.

     This way they don't have to right click and run as administrator.

3. Test to see if a user has elevated privileges.

    Tell the user that they don't have the required rights to run elevated processes.

 

This woud help improve the interface to the casual user that isn't interested in windows 7 security. I don't think there is a resource that explains in detail of building applications that are windows 7 security aware.

 

Norm

0 Kudos
Message 1 of 4
(2,857 Views)

Hello Viper,

 

I investigated about the issue and it seems it is a complex application, and they usually used .NET to check the user privileges. I’m linking two articles on how to determine if the user has administrator privileges and an example of the interface you could incorporate.

 

Simple LabVIEW User Log-In Demo (Admin and Operator User Accounts)

 

KB How Can I Programmatically Determine if a Windows User Has Administrator Privileges?

 

Best Regards,

0 Kudos
Message 2 of 4
(2,828 Views)

amezam, Thanks for the refs. A comment at the bottom of this one by Jroonk inspired the attached vi.

 

Norm

Message 3 of 4
(2,811 Views)
You can create a manifest file to go with your exe which tells Windows it needs to be run with elevated privileges. There are some details on this at http://msdn.microsoft.com/en-us/library/windows/desktop/bb756929.aspx although I thought I had found a simpler example previously but can't find it now. This will prevent a customer running it without the require privileges and may simplify your application code.
James Mc
========
CLA and cRIO Fanatic
My writings on LabVIEW Development are at devs.wiresmithtech.com
0 Kudos
Message 4 of 4
(2,803 Views)