Control use of the Serial API: registry value DefaultSerialGuardSetting (Edge)UserHKCU\Software\Policies\Microsoft\Edge

Policy ID
DefaultSerialGuardSetting
Scope
Computer Configuration, User Configuration
Supported on
Microsoft Edge version 86, Windows 7 or later
Source
Microsoft Edge Policy Templates (version 155.0.4283.45)
Category
Microsoft Edge

Registry

DefaultSerialGuardSetting

REG_DWORDUserComputer
Enabled value
Depends on the option value
Element
Control use of the Serial API
Options
ItemStored value
Do not allow any site to request access to serial ports via the Serial API2
Allow sites to ask for user permission to access a serial port3
Apply with .reg · CMD · PowerShell
UserPer-account setting
.reg
Windows Registry Editor Version 5.00

[HKEY_CURRENT_USER\Software\Policies\Microsoft\Edge]

; Options (use only one)
; Do not allow any site to request access to serial ports via the Serial API
"DefaultSerialGuardSetting"=dword:00000002
; Allow sites to ask for user permission to access a serial port
"DefaultSerialGuardSetting"=dword:00000003
CMD
:: Options (use only one)

:: Do not allow any site to request access to serial ports via the Serial API
reg add "HKCU\Software\Policies\Microsoft\Edge" /v "DefaultSerialGuardSetting" /t REG_DWORD /d 2 /f
:: Allow sites to ask for user permission to access a serial port
reg add "HKCU\Software\Policies\Microsoft\Edge" /v "DefaultSerialGuardSetting" /t REG_DWORD /d 3 /f
PowerShell
# Common: create the key
New-Item -Path 'HKCU:\Software\Policies\Microsoft\Edge' -Force | Out-Null

# Options (use only one)
# Do not allow any site to request access to serial ports via the Serial API
New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Edge' -Name 'DefaultSerialGuardSetting' -PropertyType DWord -Value 2 -Force | Out-Null
# Allow sites to ask for user permission to access a serial port
New-ItemProperty -Path 'HKCU:\Software\Policies\Microsoft\Edge' -Name 'DefaultSerialGuardSetting' -PropertyType DWord -Value 3 -Force | Out-Null
ComputerMachine-wide setting
.reg
Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\Software\Policies\Microsoft\Edge]

; Options (use only one)
; Do not allow any site to request access to serial ports via the Serial API
"DefaultSerialGuardSetting"=dword:00000002
; Allow sites to ask for user permission to access a serial port
"DefaultSerialGuardSetting"=dword:00000003
CMD
:: Options (use only one)

:: Do not allow any site to request access to serial ports via the Serial API
reg add "HKLM\Software\Policies\Microsoft\Edge" /v "DefaultSerialGuardSetting" /t REG_DWORD /d 2 /f
:: Allow sites to ask for user permission to access a serial port
reg add "HKLM\Software\Policies\Microsoft\Edge" /v "DefaultSerialGuardSetting" /t REG_DWORD /d 3 /f
PowerShell
# Common: create the key
New-Item -Path 'HKLM:\Software\Policies\Microsoft\Edge' -Force | Out-Null

# Options (use only one)
# Do not allow any site to request access to serial ports via the Serial API
New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Edge' -Name 'DefaultSerialGuardSetting' -PropertyType DWord -Value 2 -Force | Out-Null
# Allow sites to ask for user permission to access a serial port
New-ItemProperty -Path 'HKLM:\Software\Policies\Microsoft\Edge' -Name 'DefaultSerialGuardSetting' -PropertyType DWord -Value 3 -Force | Out-Null