access registrykey from within SSRS report

  • I am trying to the code function to determine if a particular application is installed on the client machine with the intent that it would either result in one of two actions to occur.  in reading materials online, it appears that Microsoft.Win32.Registry or Microsoft.Win32 should have the access to the RegistryKey object so that I can utilize GetValue to check if the app is installed.  However, i have tried to add the registry assembly as a reference under Report Properties and an error message that the Type is not defined in VS2019 when I tried to build the report.

    Public Shared Function RegKey as Integer

    Dim rKey As RegistryKey, p as string

    rKey = Registry.LocalMachine.OpenSubKey("SOFTWARE\Altec\Applauncher", False)

    p = rKey.GetValue("Path", "")

    rKey.Close()

    if p <> "" then

    return 1

    else

    return 0

    end if

    End Function

    I also read that i would need to explicit declare rKey with Microsoft.Win32.Registry.RegistryKey however get a different error message saying that Registry is ambiguous in the namespace Microsoft.Win32.

    any ideas what i can do to fix this or perhaps another solution?

     

     

  • I assume SSRS is running on the client in question, since a remote server can't read client's Windows registry (clients don't even have to be Windows).

    If so, one could use xp_regread extended procedure, or Powershell, in SQL Server, and return the value in a dataset used by SSRS.

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply