It can be done in C++, but it is complex, because there are several steps :
DefineDosDevice
Writing to
HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM with RegSetValueEx
ComDBReleasePort
ComDBClaimPort
SetupDiSetDeviceRegistryProperty with SPDRP_FRIENDLYNAME
SetupDiSetDeviceInstallParams with DI_PROPERTIES_CHANGE
Switching COM Ports using script or Powershell or command line
AKR2021
1
Reputation point
Hello,
I am working on OEM. I use a windows image to install the devices. When the device is newly installed , the COM ports are shifted to 9-16 rather than 1-8 and it shows as comports 1-8 are in use. Is there a possibility to write a script to change the COM Port numbers. I was changing them manually till now but manual changes is not an option any more.
Thank you
Windows for business Windows Client for IT Pros Devices and deployment Set up, install, or upgrade
1,543 questions
Microsoft 365 and Office Development Other
4,374 questions
Windows for business Windows Client for IT Pros User experience Other
1 answer
Sort by: Most helpful
-
Castorix31 90,521 Reputation points
2021-08-18T10:57:54.033+00:00