From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to disable or enable (Connect or Disconnect )Wireless HID mouse connected computer in LabVIEW?

Hi Rolf,

 

Thanks for the reply. Yes the systems have been restarted, but the same Exit Code (1) and error from SysExec is returned. I feel like something has been updated which broke the functionality, but don't know how to find what that might be.

 

Thanks again!

 

George

0 Kudos
Message 11 of 33
(1,226 Views)

That is typically a sign of some other program locking the device. You may find the sysiternals toolbox to be useful in troubleshooting these.

0 Kudos
Message 12 of 33
(1,211 Views)

I will play around with that toolset & see if I can find what is preventing the command from executing.

 

Thanks very much for the help!

 

George

0 Kudos
Message 13 of 33
(1,201 Views)

Powershell works.

 

Use this to list devices:

Query USB Devices.png

 

Disable devices by it's DeviceID (strings with no enters):

powershell.exe Disable-PnpDevice -InstanceId 'USB\VID_04F2&PID_B446&MI_00\6&1EC0C69F&0&0000' -Confirm:$false

 

Enable devices by it's DeviceID (strings with no enters):

powershell.exe Enable-PnpDevice -InstanceId 'USB\VID_04F2&PID_B446&MI_00\6&1EC0C69F&0&0000' -Confirm:$false

 

Your application might need to be started as administrator. This is not the same as having admin rights!

 

This works fine for my webcam, but not for all my (input) devices...

0 Kudos
Message 14 of 33
(1,197 Views)

Hi wiebe,

 

Thanks for the info. That is almost identical to what I am doing with DevCon commands into SysExec. I have edited & embedded application manifest files into the runtime .exe applications where the user must enter admin creds to run the app as an admin. As I said earlier, this was working for several months on a few different workstations, and now (without changing / updating) any LabVIEW / NI SW, the functionality is broken.

 

I may try your powershell commands just to see if they are unaffected by whatever is locking out my DevCon commands.

 

Thanks for the help!

 

George

0 Kudos
Message 15 of 33
(1,190 Views)

While some installed NI software might indirectly try to incorrectly claim that device and make it inaccessible for DevCon (and Power Shell), this is quite unlikely. Or did you play with the VISA driver wizard to experiment trying to control the device directly???


Your problem most likely lies either in a Windows Update that changed something in the configuration of your system or another software you installed that feels entitled to that device and grabs it eagerly. Some Logitech utility maybe?

 

Is this a new system where it doesn't work anymore? Do the different other systems that worked in the past according to you all show the same symptom or do they still work? Can you check if those older systems have Windows Update enabled and what actual Windows version is installed on them?

Rolf Kalbermatter
My Blog
0 Kudos
Message 16 of 33
(1,167 Views)

@LvTech wrote:

I may try your powershell commands just to see if they are unaffected by whatever is locking out my DevCon commands.


I fear that DevCon actually solves some credential problems, so I think in general it should be less picky than the raw commands.

 

PowerShell does have options to start commands with credentials, so you wouldn't have to create (maintain, manage, etc.) a separate executable.

 

Probably (haven't tried) something like this:

$cred = Get-Credential
Invoke-Command -Computer $env:COMPUTERNAME -ScriptBlock {
  # commands here
} -Credential $cred

 

0 Kudos
Message 17 of 33
(1,152 Views)

Rolf,

 

There shouldn't be any other processes grabbing the BT dongle or power supply on these systems other than the LV .exe I built. We discovered the issue while installing the .exe with the DevCon code on a system which hadn't had it installed previously, but always has the dongle & p.s. for other testing.

 

The other systems had the DevCon functionality working for some time, and it has stopped working. I am in agreement that it is a Windows issue. I don't have the deep knowledge of Windows' inner workings to properly investigate what that may be.

 

Thanks again!

 

George

0 Kudos
Message 18 of 33
(1,139 Views)

Hi wiebe,

 

Embedding the application manifest file in the runtime .exe of my LV test app prompts the user to enter admin credentials to run the app as an admin. Sounds like what you are describing in powershell does basically the same thing?

 

Thanks,

 

George

0 Kudos
Message 19 of 33
(1,111 Views)

You know that "shouldn't" is not equal to "isn't"?

 

Any sentence containing should or shouldn't can end up being the famous last words! 😀

Rolf Kalbermatter
My Blog
0 Kudos
Message 20 of 33
(1,133 Views)