I would like to obtain the following information with LabVIEW :
- user account (admin or other) which is actually connected.
- user list and their own permission.
I don't want to use the "DOS CMD" but .net, windows dll or registry keys directly.
I use XP 32 bits.
How is it possible to get these informations?
Here is part of what you want.
The outer structure decides what OS it's on, you can delete that if you're only on Windows.
You create a 64-byte empty string and call a Windows DLL.
You get back the name of the logged-in user.
Look around for that DLL name - you might find what else is available.
You could use WMI to access this, the link below is not particularly suited to your requirement but by changing the search query (for example "Select * from Win32_UserAccount Where LocalAccount = True") and using Win32_UserAccount class members, you can get the necessary information.
If you need help building the search query, you could use this: http://www.microsoft.com/en-gb/download/details.aspx?id=8572
Thanks for the answer.
Indeed there are several methods to get username as yours.
You can get it as the screeshot or with the key registry.
Also you can access the active directories through .NET
The .NET 4.0 constructors have some real advantages over the 2.0 and 3.5 versions
Complete the following steps to force LabVIEW to load .NET 4.0 assemblies.