Change name of webcam from windows registry programmatically

I want to change the name of a selected web camera in windows 10 so that the given name will be shown to other applications (zoom/meet) instead of the default webcam name. I have seen that I can change the camera name by changing the key FriendlyName of the following registry:

Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\DeviceClasses\{65e8773d-8f56-11d0-a3b9-00a0c9223196}\##?#USB#VID_046D&PID_082B&MI_00#6&8a7015f&0&0000#{65e8773d-8f56-11d0-a3b9-00a0c9223196}\#GLOBAL\Device Parameters

But I am sure this is not static for all computers. How can I get this value programmatically (say run a script to change the name) so that it will work in any Windows 10 machine?


Solution 1:

enter image description here


  • For cmd/batch:
@echo off && cd /d "%~dp0"

setlocal EnableExtensions DisableDelayedExpansion
for /f "delims= " %%T in ('"%__AppDir__%robocopy.exe" /L . . /njh /njs')do set^ "_tab=%%~T"

for /f skip^=1^eol^=^|^tokens^=*delims^=^%_tab%^  %%i in ('
%__AppDir__%wbem\wmic.exe path CIM_LogicalDevice where "Description like '%%Cam%%'" get DeviceID^|%__AppDir__%findstr.exe .
')do <con: ^< nul set^ "_HKey=%%~i"

for /f eol^=^|^tokens^=1-2delims^=^%_tab%^  %%g in ('
%__AppDir__%Reg.exe Query "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\%_HKey%"^|%__AppDir__%findstr.exe "FriendlyName DeviceDesc"
')do ^< nul %__AppDir__%Reg.exe add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\%_HKey:  =%" /f /v %%~g /t %%~h /d "EasyCamera"

endlocal & goto :EOF

  • In PowerShell // The same mechanics in PowerShell would be...
$VidStr=Get-PnpDevice -FriendlyName *cam* | Where-Object {$_.InstanceId -like “*\VID*“} | Select-Object -ExpandProperty 'InstanceId'; 
$RegStr=Join-Path -Path HKLM:SYSTEM\ControlSet001\Enum -ChildPath $VidStr -Resolve; $Old_is=Get-PnpDevice -FriendlyName *cam* | 

Where-Object {$_.InstanceId -like “*\VID*“} | Select-Object -ExpandProperty 'FriendlyName' ; if (Test-Path -Path $RegStr) { 
   Set-ItemProperty -Path $RegStr -Name FriendlyName -Value New_Camera_Name
      Set-ItemProperty -Path $RegStr -Name DeviceDesc -Value New_Camera_Name  
  } 

1 Get the part of register HKLM\...\ENUN path for change register using wmic:

wmic.exe path CIM_LogicalDevice where "Description like '%%Cam%%'" get DeviceID

rem :: returns :: 
USB\VID_174F&PID_116A&MI_00\6&233A6595&0&0000"

2 With reg query, you can easily find the description and friendly name by concatenating with HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\ and previous output:

reg query "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\USB\VID_174F&PID_116A&MI_00\6&233A6595&0&0000"

3 Use the Req Query outputs to execute you register changes:

C:\Windows\System32\Reg.exe add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\USB\VID_174F&PID_116A&MI_00\6&233A6595&0&0000" /f /v FriendlyName /t REG_SZ /d "New_Camera_Name"

C:\Windows\System32\Reg.exe add "HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Enum\USB\VID_174F&PID_116A&MI_00\6&233A6595&0&0000" /f /v DeviceDesc /t REG_SZ /d "New_Camera_Name"

Obs.: 1 Without editing/changing registry key permission, it will require you to run as administrator

Obs.: 2 When renaming your camera to some string that does not fit within originally (cmd/batch %%Cam%% and/or in powershell *cam*), an edit will have to be made for future executions in:

  • "Description like %%Fit_New_String_Name%%"
  • $VidStr = Get-PnpDevice -FriendlyName *Fit_New_String_Name*