Example Code

Programmatically Rename A Device Alias

Code and Documents

Attachment

I had the problem of not being able to programmatically rename a device back to 'Dev1' when exchanging multiple USB devices connected to my PC.

So I made this VI because I found no mention of a workaround.

This handy VI uses the NI System Configuration API pallet to programmatically rename the alias of a device connected to a system.

It will find the first instance of the device given by your selections and renames the alias accordingly.

Complete the 'Device To Rename' and 'New Alias' fields along with the other selections to

customise the VI's operation. Once run it returns the devices found and the properties of the

overwritten device if needed.

 

'Device To Rename' - Must match name within M.A.X, e.g 'NI USB-6343'

'New Alias'             - Must be a valid device alias, e.g 'Dev1'

It returns all the 'Expert' properties of the devices found along with the properties of the device that has been overwritten.

Device_Rename.PNG

Thanks!

John McLaughlin.


Windows 7. LabVIEW 2011.

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.

Comments
19jmc
Member
Member
on

This is the only other related discussion forum entry for this issue:
http://forums.ni.com/t5/LabVIEW/how-to-programmatically-configure-USB-devices-So-that-each-time/m-p/...


Windows 7. LabVIEW 2011.
JÞB
Knight of NI
Knight of NI
on

Do you know that you could Automate this further by incorporating it with NI Device Monitor?

Nice trick with the System API


"Should be" isn't "Is" -Jay
19jmc
Member
Member
on

I will look at using the NI Device Monitor in the future, I believe there is more that could be done with this VI!

Would be nice to see it as a full solution in a newer version of LabVIEW.


Windows 7. LabVIEW 2011.
miniquark
Member
Member
on

Great utility...but I need to run it into TestStand environment. And I just discovered it doesn't work

if adapter is set to LabVIEW runtime. (I'm using TS/LV 2014). It works with LabVIEW development adapter.

Any suggestions?

 

Contributors