Tutorial: Detect if SAP GUI is Installed and Which Version

Hello Community,

in some cases it can be very helpful to know if the SAP GUI for Windows is installed on the machine and in which version it is available.


SAP note 526199 delivers a tiny VBS file and on this base I realized an implementation in UiPath.


Dim SapDestDir As String
IsSAPGUIInstalled = False


  Dim Key As String = "Software\SAP\SAP Shared"
  Dim Key64 As String = "Software\Wow6432Node\SAP\SAP Shared"

  Dim regKey As Microsoft.Win32.RegistryKey
  regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(Key64)
  If regKey Is Nothing Then
    regKey = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(Key)
  End If

  If regKey Is Nothing Then
    ErrorRet = "SAP Shared key not exists"

    Dim oSapDestDir As Object = regKey.GetValue("SapDestDir")
    If Not oSapDestDir Is Nothing Then
      SapDestDir = CStr(oSapDestDir)
    End If

    If Not String.IsNullOrEmpty(SapDestDir) Then
      If File.Exists(SapDestDir + "\SapGui\saplogon.exe") Then
        IsSAPGUIInstalled = True
        Dim SAPVers As System.Diagnostics.FileVersionInfo = _
          System.Diagnostics.FileVersionInfo.GetVersionInfo(SapDestDir + _
        Version = SAPVers.FileVersion
        MajorVersion = SAPVers.FileMajorPart.ToString
        MinorVersion = SAPVers.FileMinorPart.ToString
        PatchLevel = SAPVers.FileBuildPart.ToString
      End If
    End If

  End If

Catch ex As Exception
  ErrorRet = ex.Message
End Try	


The only difference is, I choose saplogon.exe to get the version information. SAP uses sapgui.exe or sapfront.dll - but this is easy to change. :slightly_smiling_face:

Enjoy it.

Best regards

IsSAPGUIInstalledVersion.xaml (7.0 KB)


Great work! I did a minor change in defining SapDestDir as returning Argument. Instead of “Dim” assign it to “” instead. So I can use the path instead a hardcoded one in my SAP startup with “\SapGui\sapshcut.exe”.

1 Like


Hello Thomas,
thank you. Great idea and easy to realize :slightly_smiling_face:
Best regards

1 Like