02-21-2013 07:58 AM
Hello,
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?
02-21-2013 08:42 AM
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.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
02-21-2013 09:58 AM - edited 02-21-2013 10:02 AM
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.
http://forums.ni.com/t5/LabVIEW/How-to-access-WMI-Classes-via-NET-in-LabVIEW/m-p/286699#M150949
If you need help building the search query, you could use this: http://www.microsoft.com/en-gb/download/details.aspx?id=8572
02-21-2013 03:26 PM
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.
02-21-2013 03:28 PM
Thanks also for the WMI which I didn't know before and which can be very useful and powerful.
02-21-2013 04:00 PM
Why not just use Application.Username?
02-21-2013 04:03 PM
Why not just use Application.Username?
--- Read the comment on my screenshot above.
Blog for (mostly LabVIEW) programmers: Tips And Tricks
02-21-2013 04:08 PM
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.