LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

LDAP

Hi,

   We are working in a project where we are integrating login module with
server details. and provide Software access level based on the group
type.

At present we are able to 1. Authenticate the user using USER_ID and
PASSWORD and 2. Retrieve User Group name using USER_NAME  

Now we want to retrieve USER_NAME by using USER_ID. kindly help us on
this.

From command Prompt we are able to fetch the details using DSQUERY and
DSGET command, but command Line Execution with LabView is throwing
error as _"dsquery' is not recognized as an internal or external
command,_
_operable program or batch file."._

Kindly Support for this issue.

0 Kudos
Message 1 of 2
(223 Views)

The first thing to do when your SystemExec returns with such an error is to prepend your command with "cmd /c <your command line>".

 

You can also add /k instead of /ct o keep the command line window open for debugging purposes.

 

However there is following issue from the Microsoft documentation found here: https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-r2-and-2012/cc...

 

Dsquery is a command-line tool that is built into Windows Server 2008. It is available if you have the Active Directory Domain Services (AD DS) server role installed. To use dsquery, you must run the dsquery command from an elevated command prompt. To open an elevated command prompt, click Start, right-click Command Prompt, and then click Run as administrator.

And System Exec does not allow you to start a program elevated, unless you start the entire LabVIEW program elevated. Microsoft only has a sparsely documented way of doing that and that involves directly calling the ShellExecute() Windows API with the "runas" as lpOperation action.

 

https://forums.ni.com/t5/LabVIEW/Implementing-Windows-API-Shell-Execute-call/td-p/248450

 

The VI in the last post doesn't know about the runas operation but it is trivial to add that yourself to the enum.

 

The SystemExec VI directly calls the CreateProcess() API and that only can instantiate executable program files. It specifically does not know about command line commands and other settings that are specific to the Windows Shell aka what your entire Windows Explorer and friends consists of. UAC is not part of the Windows kernel although it heavily uses security services that the kernel provides. As such CreateProcess() is not aware of these things nor could it prompt the user for his credentials to elevate the current process. But ShellExecute() has other limitations that make it a bad replacement for calling CreateProcess().

Rolf Kalbermatter
Averna BV
0 Kudos
Message 2 of 2
(203 Views)