14 Replies Latest reply on Jan 11, 2010 3:22 PM by Matt5150

    command-line for changing com port?

    DongTran

      Hello smart people,

       

      I have a situation which may/may not sound familiar to you.  I have a unified ghost image which we use for all of our desktops and laptops.  The short of the long is that we have some plug-in equipment that want to use com-port 3 via a PCI add-in card.  Is there some type of command-line utility I can run which will set the com port to a specified com port like COM12?  I'm working with Dell Optiplex 755 and 760 models.  If I build the image with the drivers installed on one model and set it to COM12, the other device will still show up as COM3 when it's detected.  Blah.  Anyways thanks.

        • 1. Re: command-line for changing com port?

          Please, try this program.

           

          Reminder of cmdline usage:

          Comport.exe COMx  <where x is the desired comport number>  the “COM” parameter is case sensitive

           

           

          Regards

           

          Jaime

          • 2. Re: command-line for changing com port?
            DanielK23

            Hi Jaime

             

            Could i possibly ask for you help with this? I've tried using this comport.exe on an M58 series Thinkcentre from Lenovo, however they've changed the device name and this is causing the comport.exe to not find the SOL device.

             

            Could i ask for a copy of the source code so i can amend this program to work on our model of computer(s)

             

            Cheers

             

            Daniel

            • 3. Re: command-line for changing com port?
              Trevor.Sullivan

              Daniel,

               

              This is only a guess, but I would imagine that it probably isn't much more than a simple registry change (somewhere under HKLM\SYSTEM\CurrentControlSet, or ControlSet###). This is where most device information is stored. If I get a chance, I'll see if I can do a bit of research into this when I get to the office.

               

              Trevor Sullivan

              Systems Engineer

              OfficeMax Corporation

              • 4. Re: command-line for changing com port?
                DanielK23

                Hi Trevor

                 

                I've been delving into the registry myself already so far, and have changed the PORTNAME under Device Parameters for the PCI device, i've also changed the Com Name Arbiter Value to 03 to only reserve ports 1 and 2, then re-enabled the device. The SOL device is now successfully on COM9, however when i install the new device it's now defaulting to COM1 and ignoring the reservation in the changed COM Name Arbiter value

                • 5. Re: command-line for changing com port?
                  Trevor.Sullivan

                  Dan,

                   

                  Here is what I'm seeing happening in Process Monitor while manually making the change:

                   

                  HKLM\System\CurrentControlSet\Enum\PCI\VEN_8086&DEV_2A07&SUBSYS_02321028&REV_0C\3&2b8e0b4b&0&1B\Device Parameters\PortName

                   

                  Type:    REG_SZ
                  Length:    10
                  Data:    COM3

                   

                  HKLM\System\CurrentControlSet\Enum\PCI\VEN_8086&DEV_2A07&SUBSYS_02321028&REV_0C\3&2b8e0b4b&0&1B\FriendlyName

                   

                  Type:    REG_SZ
                  Length:    102
                  Data:    Intel(R) Active Management Technology - SOL (COM3)

                   

                  HKLM\HARDWARE\DEVICEMAP\SERIALCOMM\\Device\Serial0

                   

                  Type:    REG_SZ
                  Length:    10
                  Data:    COM3

                   

                  I will post more as I find out more.

                   

                  Trevor Sullivan

                  Systems Engineer

                  OfficeMax Corporation

                  • 6. Re: command-line for changing com port?
                    DanielK23

                    Hi Trevor

                     

                    I think i've managed to get it now. I have to use devcon to get the hardware ID (we have multiple workstation models with different HID for the SOL device) I hit the two registry keys under ENUM\PCI to change the portname and friendly name (after having to amend the permissions on this particular devices registry key, it's only got everyone at read, no administrator access and system full control, very handy when working as admin!)

                    I also set the value of the COM NAME ARBITER key to 03,00,00.... to reserve ports 1 and 2 only and free port 3 for my device.

                     

                    Cheers

                     

                    Daniel

                    • 7. Re: command-line for changing com port?
                      K_Lloyd

                      I have a conflict on com port 3.

                       

                      under

                      HKLM\System\CurrentControlSet\Enum\PCI\VEN_8086&DEV_2A07&...

                       

                      the item LocationInformation - is set to "PCI bus 0, device 3, function 3"

                       

                      Is this where I change the com port from 3?

                      • 8. Re: command-line for changing com port?
                        Trevor.Sullivan

                        Ken,

                         

                        Did you try setting the registry values that I posted?

                         

                        Trevor Sullivan

                        Systems Engineer

                        OfficeMax Corporation

                        • 9. Re: command-line for changing com port?
                          mccajo71

                          This is a handy utility but I also have several different Lenovo's including the M58 that I'd like to use this on that also have different ID's for the SOL adapter.

                           

                          Could you  make the code available?

                           

                          Thanks!

                          • 10. Re: command-line for changing com port?
                            DanielK23

                            This is the script i wrote for our company in the end that will first check for a COM3 device in the registry, then will assign the COM9 port to it, before resetting the COM Arbiter as well to free up COM3.

                            CODE====================

                            for /f %%a in ('devcon findall * ^| find /i "com3"') do set AMTHWID=%%a


                            devcon disable @"%AMTHWID%"
                            subinacl /keyreg "HKEY_LOCAL_MACHINE\System\CurrentControlSet\ENUM\%AMTHWID%" /grant=administrators=f
                            subinacl /keyreg "HKEY_LOCAL_MACHINE\System\CurrentControlSet\ENUM\%AMTHWID%\Device Parameters" /grant=administrators=f
                            REG ADD "HKLM\SYSTEM\CurrentControlSet\ENUM\%AMTHWID%\DEVICE Parameters" /v PORTNAME /t REG_SZ /d COM9 /F
                            REG ADD "HKLM\SYSTEM\CurrentControlSet\ENUM\%AMTHWID%" /v FriendlyName /t REG_SZ /d "Intel AMT SOL (COM9)" /F
                            Regedit /S ComArbiter.reg

                            END CODE======================

                            COMArbiter.reg is attached, if you need subinacl.exe and devcon.exe they are available from Microsoft

                            • 11. Re: command-line for changing com port?
                              mccajo71

                              This looks like it's going to work for me.  Can you confirm that this method leaves full functionality?

                              • 12. Re: command-line for changing com port?
                                DanielK23

                                You would need to run an additional command in the batch file

                                devcon enable @"%AMTHWID%"

                                to re-enable the device, other than that, i can't think of any reason why full functionality should not be restored. I've left the device disabled on my systems, as we don't use the device at presnet.

                                Regards

                                • 13. Re: command-line for changing com port?
                                  Matt5150

                                  Any update to this?  I've tried the comport.exe and the batch/reg file with devcon neither can find the device.  Any guidance in getting this to work correctly?  Thanks!

                                  • 14. Re: command-line for changing com port?
                                    Matt5150

                                    C:\SOL>for /F %a in ('devcon findall * | find /i "com3"') do set AMTHWID=%a

                                    C:\SOL>set AMTHWID=PCI\VEN_8086&DEV_2E17&SUBSYS_027F1028&REV_03\3&172E68DD&0&1B:


                                    C:\SOL>devcon disable @"PCI\VEN_8086&DEV_2E17&SUBSYS_027F1028&REV_03\3&172E68DD&
                                    0&1B:"
                                    No devices disabled.

                                    C:\SOL>subinacl /keyreg "HKEY_LOCAL_MACHINE\System\CurrentControlSet\ENUM\PCI\VE
                                    N_8086&DEV_2E17&SUBSYS_027F1028&REV_03\3&172E68DD&0&1B:" /grant=administrators=f

                                    HKEY_LOCAL_MACHINE\System\CurrentControlSet\ENUM\PCI\VEN_8086&DEV_2E17&SUBSYS_02
                                    7F1028&REV_03\3&172E68DD&0&1B: : 2 The system cannot find the file specified.

                                     

                                    Elapsed Time: 00 00:00:00
                                    Done:        1, Modified        0, Failed        1, Syntax errors        0
                                    Last Done  : HKEY_LOCAL_MACHINE\System\CurrentControlSet\ENUM\PCI\VEN_8086&DEV_2
                                    E17&SUBSYS_027F1028&REV_03\3&172E68DD&0&1B:
                                    Last Failed: HKEY_LOCAL_MACHINE\System\CurrentControlSet\ENUM\PCI\VEN_8086&DEV_2
                                    E17&SUBSYS_027F1028&REV_03\3&172E68DD&0&1B: : 2 The system cannot find the file
                                    specified.


                                    C:\SOL>subinacl /keyreg "HKEY_LOCAL_MACHINE\System\CurrentControlSet\ENUM\PCI\VE
                                    N_8086&DEV_2E17&SUBSYS_027F1028&REV_03\3&172E68DD&0&1B:\Device Parameters" /gran
                                    t=administrators=f
                                    HKEY_LOCAL_MACHINE\System\CurrentControlSet\ENUM\PCI\VEN_8086&DEV_2E17&SUBSYS_02
                                    7F1028&REV_03\3&172E68DD&0&1B:\Device Parameters : 2 The system cannot find the
                                    file specified.

                                     

                                    Elapsed Time: 00 00:00:00
                                    Done:        1, Modified        0, Failed        1, Syntax errors        0
                                    Last Done  : HKEY_LOCAL_MACHINE\System\CurrentControlSet\ENUM\PCI\VEN_8086&DEV_2
                                    E17&SUBSYS_027F1028&REV_03\3&172E68DD&0&1B:\Device Parameters
                                    Last Failed: HKEY_LOCAL_MACHINE\System\CurrentControlSet\ENUM\PCI\VEN_8086&DEV_2
                                    E17&SUBSYS_027F1028&REV_03\3&172E68DD&0&1B:\Device Parameters : 2 The system can
                                    not find the file specified.


                                    C:\SOL>REG ADD "HKLM\SYSTEM\CurrentControlSet\ENUM\PCI\VEN_8086&DEV_2E17&SUBSYS_
                                    027F1028&REV_03\3&172E68DD&0&1B:\DEVICE Parameters" /v PORTNAME /t REG_SZ /d COM
                                    9 /F

                                    Error:  Access is denied.

                                    C:\SOL>REG ADD "HKLM\SYSTEM\CurrentControlSet\ENUM\PCI\VEN_8086&DEV_2E17&SUBSYS_
                                    027F1028&REV_03\3&172E68DD&0&1B:" /v FriendlyName /t REG_SZ /d "Intel AMT SOL (C
                                    OM9)" /F

                                    Error:  Access is denied.

                                    C:\SOL>Regedit /S ComArbiter.reg

                                    C:\SOL>pause
                                    Press any key to continue . . .