Permanently Enable Com Port

CameronK96 20 Reputation points
2024-04-10T11:36:32.9966667+00:00

Some of my laptops have a certain COM Port disabled by default and users have to remember to enable them every day when logging into their computers. I was trying to find a way to permanently enable the COM port so it wouldn't disable again after a reboot.

I have attempted to create a Scheduled Task at start up with the PowerShell script below:

Get-PnpDevice -FriendlyName “Communications Port (COM1)” | enable-PnpDevice

The issue is that this command needs confirmation after the script is ran. Is there a way to permanently enable a COM port without a PowerShell script, or is there a way to get the command above to run and confirm the action?

It would not let me include a screenshot of PowerShell, below is the command I am trying to schedule to run and automatically confirm as well:

Windows PowerShell Copyright (C) Microsoft Corporation. All rights reserved. Try the new cross-platform PowerShell https://aka.ms/pscore6 PS C:\Users\USER> Get-PnpDevice -FriendlyName "Communications Port (COM1)" | enable-PnpDevice

Confirm

Are you sure you want to perform this action? Performing the operation "Enable" on target "Win32_PnPEntity: Communications Port (COM1) (DeviceID = "ACPI\PNP0501\1")".

[Y] Yes [A] Yes to All [N] No [L] No to All [S] Suspend [?] Help (default is "Y"):

Windows 10
Windows 10
A Microsoft operating system that runs on personal computers and tablets.
11,589 questions
0 comments No comments
{count} votes

Accepted answer
  1. Darrell Gorter 1,891 Reputation points
    2024-04-10T19:21:09.51+00:00

    Hello,

    What is the start value of the serial service in the Registry?

    Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Serial

    Try setting this to 2.

    Values described here.

    https://learn.microsoft.com/en-us/dotnet/api/system.serviceprocess.servicestartmode?view=dotnet-plat-ext-8.0

    If it still reverts to disabled, I would check for any group polices that could be affecting this.

    try using gpresult to get a list of the policies.

    Darrell

    1 person found this answer helpful.

1 additional answer

Sort by: Most helpful
  1. Ian Xue 36,936 Reputation points Microsoft Vendor
    2024-04-11T03:15:05+00:00

    Hi CameronK96,

    You can add the parameter -Confirm:$false to the Enable-PnpDevice cmdlet if you don't want to confirm it every time.

    Get-PnpDevice -FriendlyName  "Communications Port (COM1)"|Enable-PnpDevice -Confirm:$false
    

    Best Regards,

    Ian Xue


    If the Answer is helpful, please click "Accept Answer" and upvote it.


Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.