Hello,
I would like to get the "default browser" of a Windows 10 pc system as a VBS variable.
The following script doesn't work.
I don't know why.
The Registry subfolder "Firefox..." (belongs to HKCU\SOFTWARE\Clients\StartMenuInternet\) exists.
Const WbemAuthenticationLevelPktPrivacy = 6
strComputer = "localhost"
strNamespace = "root\cimv2"
strUser = ""
strPassword = ""
Set objWbemLocator = CreateObject("WbemScripting.SWbemLocator")
Set objWMIService = objwbemLocator.ConnectServer _
(strComputer, strNamespace, strUser, strPassword)
objWMIService.Security_.authenticationLevel = WbemAuthenticationLevelPktPrivacy
Const HKCU = &H80000001
Set objReg = GetObject("winmgmts://" & strComputer & _
"/root/default:StdRegProv")
Const strBaseKey = "SOFTWARE\Clients\StartMenuInternet\"
objReg.EnumKey HKCU, strBaseKey, arrSubKeys
For Each strSubKey In arrSubKeys
intRet = objReg.GetStringValue(HKCU, strBaseKey & strSubKey, _
"DisplayName", strValue)
If intRet <> 0 Then
intRet = objReg.GetStringValue(HKCU, strBaseKey & strSubKey, _
"QuietDisplayName", strValue)
End If
If (strValue <> "") and (intRet = 0) Then
str=str & strValue &vbcrlf
End If
Next
wscript.echo str
Result variable "str" has no value.
Value must be "Firefox...".
Thanks
Tommy