Function Get-SharePointInstall
{
if (Get-Command Get-CimInstance -ErrorAction SilentlyContinue)
{
# New way, borrowed from xSharePoint DSC project (https://github.com/PowerShell/xSharePoint)
if (Get-CimInstance -ClassName Win32_Product -Filter "Name like 'Microsoft SharePoint Server%'")
...
Probably needs to have an additional check for Foundation, if the detection needs to avoid false positives from SP Designer etc.
Comments: ** Comment from web user: Emblematic **
Oops - old method! Results are much the same though:
```
PS C:\> $val= Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object {$_.DisplayName -like "Microsoft SharePoint*"}
PS C:\> $val.DisplayName
Microsoft SharePoint Foundation 2013
Microsoft SharePoint Foundation 2013 Core
Microsoft SharePoint Foundation 2013 1033 Lang Pack
Microsoft SharePoint Foundation 2013
Microsoft SharePoint Foundation 2013 1033 SQL Express
PS C:\> $val= Get-ItemProperty HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\* | Where-Object {$_.DisplayName -like "Microsoft SharePoint*"}
PS C:\> $val.DisplayName
Microsoft SharePoint Foundation 2010
Microsoft SharePoint Foundation 2010 Core
Microsoft SharePoint Foundation 2010 1033 Lang Pack
Microsoft SharePoint Foundation 2010
```