If you are using CVI 6 together with the tradiditionel NI-DAQ driver than you can use the function Init_DA_Brds or Get_DAQ_Device_Info in a loop to obtain the device code.
A much better idea is to upgrade to CVI 7.0 and use the DAQmx function call which is able to deliver an array that contains the names of all devices installed in the system.
Regards,
Heinrich Illig
NI