You can add a reference to System.Management.Automation and use the PowerShell to invoke Get-Module cmdlet to check if a specific module has been installed:
var exists = false;
using (PowerShell ps = PowerShell.Create())
{
string moduleName = "something";
ps.AddScript($"Get-Module -ListAvailable -Name {moduleName}");
var result = ps.Invoke();
exists = result.Count > 0;
}
Note: To add a reference to System.Management.Automation, you can install the NuGet package using Install-Package System.Management.Automation.dll Or if you want to see where the dll is located on your system, using powershell console, you can see [PSObject].Assembly.Location and pick it.