i trying to query the wifi registry ProfileName under this path HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles as Wifi_5G i want to change the profilename to Network_5G. But the folder was not in fixed order example {FB2A1815-B93F-4CF0-A8C8-2CC78D2F98E6}. How can i query which registry folder Profilename = Wif_5G and set it to Network_5G?
This is my code:
SET /P lanuid=Please Enter The Wrong Lan Ethernet Profile Name:
IF "%lanuid%"=="" GOTO Error
reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles" /d /f "%lanuid%" /s /e
SET /P lanuid2=Please Enter The Wrong Lan Ethernet UID:
IF "%lanuid2%"=="" GOTO Error
SET /P lanuid3=Please Enter The Correct Lan Ethernet Profilename:
IF "%lanuid3%"=="" GOTO Error
Reg Add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\%lanuid2%" /V ProfileName /T Reg_SZ /D %lanuid3% /F>Nul
for /f "tokens=2 delims={}" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles" /d /f "Wifi_5G" /s /e') do set luid=%%a
orfor /f "delims=" %%a in ('reg query "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles" /d /f "Wifi_5G" /s /e^|find "HKEY_"') do set luid=%%a
?FB2A1815-B93F-4CF0-A8C8-2CC78D2F98E6
, the second oneHKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles\{FB2A1815-B93F-4CF0-A8C8-2CC78D2F98E6}
. When I understand you correctly, the second one should solve your problem.$Path = 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\NetworkList\Profiles'
;$ProfileName = 'Wifi_5G'
;$NewName = 'Network_5G'
;gci $Path | ? { $_.GetValue('ProfileName') -eq $ProfileName } | Set-ItemProperty -Name 'ProfileName' -Value $NewName