Origem de Dados de Deteção Genérica

LW.Microsoft.Windows.NonServerRoles.Registry.Discovery.DataSource (DataSourceModuleType)

Esta origem de dados é executada em todos os computadores Windows 2008 R2/2012/2012 R2 e verifica se existem várias funções sem ser de servidor.

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityPublic
RunAsSystem.PrivilegedMonitoringAccount
OutputTypeSystem.Discovery.Data

Member Modules:

ID Module Type TypeId RunAs 
Scheduler DataSource System.Discovery.Scheduler Default
PowerShellDiscoveryProbe ProbeAction Microsoft.Windows.PowerShellDiscoveryProbe Default

Overrideable Parameters:

IDParameterTypeSelectorDisplay NameDescription
IntervalSecondsint$Config/IntervalSeconds$Intervalo (seg)
TimeoutSecondsint$Config/TimeoutSeconds$Segundos de Tempo Limite

Source Code:

<DataSourceModuleType ID="LW.Microsoft.Windows.NonServerRoles.Registry.Discovery.DataSource" Accessibility="Public" RunAs="System!System.PrivilegedMonitoringAccount" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="IntervalSeconds" type="xsd:unsignedInt"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="ComputerPrincipalName" type="xsd:string"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="TimeoutSeconds" type="xsd:unsignedInt"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="TimeoutSeconds" Selector="$Config/TimeoutSeconds$" ParameterType="int"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="Scheduler" TypeID="System!System.Discovery.Scheduler">
<Scheduler>
<SimpleReccuringSchedule>
<Interval Unit="Seconds">$Config/IntervalSeconds$</Interval>
</SimpleReccuringSchedule>
<ExcludeDates/>
</Scheduler>
</DataSource>
<ProbeAction ID="PowerShellDiscoveryProbe" TypeID="Windows!Microsoft.Windows.PowerShellDiscoveryProbe">
<ScriptName>"Lightweight non server roles discovery script"</ScriptName>
<ScriptBody><Script>
param ([String] $sourceID, [String] $managedEntityID, [String] $computerName)
#Copyright (c) Microsoft Corporation. All rights reserved.
#*************************************************************************
#Author - Arpit Mittal
#ScriptName: "NonServerRoles.ps1"$
#Purpose: This script will discover installed non-server roles on the Windows computers
#by searching the registries
#*************************************************************************

#Table containing class name with multiple registry paths
$registryPathTable = @{}
#Table containing key value pairs for each registry path
$regKeyValuePairs = @{}
#Mapping of class names with their class instance names
$classMPElementTable = @{}
#Mapping of class name with category names
$classCategoryTable = @{}

#Get-WindowsFeature Discoveries
#SQL Server 2005
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2005",@("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\90\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2005","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2005']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2005","SQL Server 2005")

#SQL Server 2008
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2008",@("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\100\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2008","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2008']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2008","SQL Server 2008")

#SQL Server 2012
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2012",@("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\110\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2012","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2012']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2012","SQL Server 2012")

#SQL Server 2014
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2014",@("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\120\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2014","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2014']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2014","SQL Server 2014")

#Windows Server Backup
$registryPathTable.Add("LW.Microsoft.Windows.Server.Backup",("HKLM:\SYSTEM\CurrentControlSet\Services\wbengine"))
$regKeyValuePairs.Add("HKLM:\SYSTEM\CurrentControlSet\Services\wbengine\LW.Microsoft.Windows.Server.Backup",@{"ImagePath"="%systemroot%\system32\wbengine.exe"})
$classMPElementTable.Add("LW.Microsoft.Windows.Server.Backup","`$MPElement[Name='LW.Microsoft.Windows.Server.Backup']$")
$classCategoryTable.Add("LW.Microsoft.Windows.Server.Backup","Windows Server Backup")

#BizTalk server 2013
$registryPathTable.Add("LW.Microsoft.Windows.Biztalk.2013",("HKLM:\SOFTWARE\Microsoft\BizTalk Server\3.0"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\BizTalk Server\3.0\LW.Microsoft.Windows.Biztalk.2013",@{"ProductVersion"="3.10.229.0"})
$classMPElementTable.Add("LW.Microsoft.Windows.Biztalk.2013","`$MPElement[Name='LW.Microsoft.Windows.Biztalk.2013']$")
$classCategoryTable.Add("LW.Microsoft.Windows.Biztalk.2013","BizTalk 2013")

#BizTalk server 2013R2
$registryPathTable.Add("LW.Microsoft.Windows.Biztalk.2013R2",("HKLM:\SOFTWARE\Microsoft\BizTalk Server\3.0"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\BizTalk Server\3.0\LW.Microsoft.Windows.Biztalk.2013R2",@{"ProductVersion"="3.11"})
$classMPElementTable.Add("LW.Microsoft.Windows.Biztalk.2013R2","`$MPElement[Name='LW.Microsoft.Windows.Biztalk.2013R2']$")
$classCategoryTable.Add("LW.Microsoft.Windows.Biztalk.2013R2","BizTalk 2013 R2")

#CRM 2011
$registryPathTable.Add("LW.Microsoft.Windows.CRM.2011",("HKLM:\SOFTWARE\Microsoft\MSCRM"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\MSCRM\LW.Microsoft.Windows.CRM.2011",@{"CRM_Server_Version"="^5.*"})
$classMPElementTable.Add("LW.Microsoft.Windows.CRM.2011","`$MPElement[Name='LW.Microsoft.Windows.CRM.2011']$")
$classCategoryTable.Add("LW.Microsoft.Windows.CRM.2011","Dynamics CRM 2011")

#CRM 2013
$registryPathTable.Add("LW.Microsoft.Windows.CRM.2013",("HKLM:\SOFTWARE\Microsoft\MSCRM"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\MSCRM\LW.Microsoft.Windows.CRM.2013",@{"CRM_Server_Version"="^6.*"})
$classMPElementTable.Add("LW.Microsoft.Windows.CRM.2013","`$MPElement[Name='LW.Microsoft.Windows.CRM.2013']$")
$classCategoryTable.Add("LW.Microsoft.Windows.CRM.2013","Dynamics CRM 2013")

#CRM 2015
$registryPathTable.Add("LW.Microsoft.Windows.CRM.2015",("HKLM:\SOFTWARE\Microsoft\MSCRM"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\MSCRM\LW.Microsoft.Windows.CRM.2015",@{"CRM_Server_Version"="^7.*"})
$classMPElementTable.Add("LW.Microsoft.Windows.CRM.2015","`$MPElement[Name='LW.Microsoft.Windows.CRM.2015']$")
$classCategoryTable.Add("LW.Microsoft.Windows.CRM.2015","Dynamics CRM 2015")

#NAV 2013
$registryPathTable.Add("LW.Microsoft.Windows.NAV.2013",("HKLM:\SOFTWARE\Microsoft\Microsoft Dynamics NAV\70\Service"))
$classMPElementTable.Add("LW.Microsoft.Windows.NAV.2013","`$MPElement[Name='LW.Microsoft.Windows.NAV.2013']$")
$classCategoryTable.Add("LW.Microsoft.Windows.NAV.2013","Dynamics NAV 2013")

#NAV 2013R2
$registryPathTable.Add("LW.Microsoft.Windows.NAV.2013R2",("HKLM:\SOFTWARE\Microsoft\Microsoft Dynamics NAV\71\Service"))
$classMPElementTable.Add("LW.Microsoft.Windows.NAV.2013R2","`$MPElement[Name='LW.Microsoft.Windows.NAV.2013R2']$")
$classCategoryTable.Add("LW.Microsoft.Windows.NAV.2013R2","Dynamics NAV 2013")


#Exchange Server 2013
$registryPathTable.Add("LW.Microsoft.Windows.Exchange.Server.2013",("HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Setup"))
$classMPElementTable.Add("LW.Microsoft.Windows.Exchange.Server.2013","`$MPElement[Name='LW.Microsoft.Windows.Exchange.Server.2013']$")
$classCategoryTable.Add("LW.Microsoft.Windows.Exchange.Server.2013","Exchange 2013")

#SharePoint Server 2013
$registryPathTable.Add("LW.Microsoft.Windows.SharePoint.Server.2013",("HKLM:\SOFTWARE\Microsoft\Office Server\15.0"))
$classMPElementTable.Add("LW.Microsoft.Windows.SharePoint.Server.2013","`$MPElement[Name='LW.Microsoft.Windows.SharePoint.Server.2013']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SharePoint.Server.2013","SharePoint Server 2013")

#SharePoint Foundation Server 2013
$registryPathTable.Add("LW.Microsoft.Windows.SharePoint.Foundation.Server.2013",("HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS"))
$classMPElementTable.Add("LW.Microsoft.Windows.SharePoint.Foundation.Server.2013","`$MPElement[Name='LW.Microsoft.Windows.SharePoint.Foundation.Server.2013']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SharePoint.Foundation.Server.2013","SharePoint Foundation 2013")

#SPF 2012R2
$registryPathTable.Add("LW.Microsoft.Windows.SPF.2012R2",("HKLM:\SOFTWARE\Microsoft\Service Provider Foundation"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\Service Provider Foundation\LW.Microsoft.Windows.SPF.2012R2",@{"Version"="^7.2*"})
$classMPElementTable.Add("LW.Microsoft.Windows.SPF.2012R2","`$MPElement[Name='LW.Microsoft.Windows.SPF.2012R2']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SPF.2012R2","Service Provider Foundation")

#Host Integration Server 2013
$registryPathTable.Add("LW.Microsoft.Windows.Host.Integration.Server.2013",@("HKLM:\SOFTWARE\Microsoft\Host Integration Server\9.0"))
$classMPElementTable.Add("LW.Microsoft.Windows.Host.Integration.Server.2013","`$MPElement[Name='LW.Microsoft.Windows.Host.Integration.Server.2013']$")
$classCategoryTable.Add("LW.Microsoft.Windows.Host.Integration.Server.2013","Host Integration Server 2013")

#Orchestrator 2012R2
$registryPathTable.Add("LW.Microsoft.Windows.Orchestrator.2012",@("HKLM:\SYSTEM\CurrentControlSet\Services\omanagement"))
$classMPElementTable.Add("LW.Microsoft.Windows.Orchestrator.2012","`$MPElement[Name='LW.Microsoft.Windows.Orchestrator.2012']$")
$classCategoryTable.Add("LW.Microsoft.Windows.Orchestrator.2012","System Center 2012 - Orchestrator")

#SMA 2012R2
$registryPathTable.Add("LW.Microsoft.Windows.SMA.2012R2",@("HKLM:\SOFTWARE\Microsoft\ServiceManagementAutomation"))
$classMPElementTable.Add("LW.Microsoft.Windows.SMA.2012R2","`$MPElement[Name='LW.Microsoft.Windows.SMA.2012R2']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SMA.2012R2","ServiceManagementAutomation")

#Dynamics AX 2012
$registryPathTable.Add("LW.Microsoft.Windows.Dynamics.AX.2012",@("HKLM:\SYSTEM\CurrentControlSet\Services\Dynamics Server\6.0\01"))
$classMPElementTable.Add("LW.Microsoft.Windows.Dynamics.AX.2012","`$MPElement[Name='LW.Microsoft.Windows.Dynamics.AX.2012']$")
$classCategoryTable.Add("LW.Microsoft.Windows.Dynamics.AX.2012","Dynamics AX 2012")

#Service Manager 2012 (RTM, SP1, R2)
$registryPathTable.Add("LW.Microsoft.Windows.ServiceManager.2012",@("HKLM:\SOFTWARE\Microsoft\System Center\2010\Service Manager\Setup"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\System Center\2010\Service Manager\Setup\LW.Microsoft.Windows.ServiceManager.2012",@{"CurrentVersion"="^7.5*"})
$classMPElementTable.Add("LW.Microsoft.Windows.ServiceManager.2012","`$MPElement[Name='LW.Microsoft.Windows.ServiceManager.2012']$")
$classCategoryTable.Add("LW.Microsoft.Windows.ServiceManager.2012","System Center 2012 - Service Manager")

#TFS 2010
$registryPathTable.Add("LW.Microsoft.Windows.TFS.2010",@("HKLM:\SOFTWARE\Microsoft\TeamFoundationServer\10.0\InstalledComponents\ApplicationTier"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\TeamFoundationServer\10.0\InstalledComponents\ApplicationTier\LW.Microsoft.Windows.TFS.2010",@{"IsConfigured"="^1"})
$classMPElementTable.Add("LW.Microsoft.Windows.TFS.2010","`$MPElement[Name='LW.Microsoft.Windows.TFS.2010']$")
$classCategoryTable.Add("LW.Microsoft.Windows.TFS.2010","Team Foundation Server 2010")

#TFS 2012
$registryPathTable.Add("LW.Microsoft.Windows.TFS.2012",@("HKLM:\SOFTWARE\Microsoft\TeamFoundationServer\11.0\InstalledComponents\ApplicationTier"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\TeamFoundationServer\11.0\InstalledComponents\ApplicationTier\LW.Microsoft.Windows.TFS.2012",@{"IsConfigured"="^1"})
$classMPElementTable.Add("LW.Microsoft.Windows.TFS.2012","`$MPElement[Name='LW.Microsoft.Windows.TFS.2012']$")
$classCategoryTable.Add("LW.Microsoft.Windows.TFS.2012","Team Foundation Server 2012")

#TFS 2013
$registryPathTable.Add("LW.Microsoft.Windows.TFS.2013",@("HKLM:\SOFTWARE\Microsoft\TeamFoundationServer\12.0\InstalledComponents\ApplicationTier"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\TeamFoundationServer\12.0\InstalledComponents\ApplicationTier\LW.Microsoft.Windows.TFS.2013",@{"IsConfigured"="^1"})
$classMPElementTable.Add("LW.Microsoft.Windows.TFS.2013","`$MPElement[Name='LW.Microsoft.Windows.TFS.2013']$")
$classCategoryTable.Add("LW.Microsoft.Windows.TFS.2013","Team Foundation Server 2013")

#TFS 2015
$registryPathTable.Add("LW.Microsoft.Windows.TFS.2015",@("HKLM:\SOFTWARE\Microsoft\TeamFoundationServer\14.0\InstalledComponents\ApplicationTier"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\TeamFoundationServer\14.0\InstalledComponents\ApplicationTier\LW.Microsoft.Windows.TFS.2015",@{"IsConfigured"="^1"})
$classMPElementTable.Add("LW.Microsoft.Windows.TFS.2015","`$MPElement[Name='LW.Microsoft.Windows.TFS.2015']$")
$classCategoryTable.Add("LW.Microsoft.Windows.TFS.2015","Team Foundation Server 2015")

#SCCM 2012
$registryPathTable.Add("LW.Microsoft.Windows.SCCM.2012",("HKLM:\SOFTWARE\Microsoft\SMS\Operations Management"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\SMS\Operations Management\LW.Microsoft.Windows.SCCM.2012",@{"Version"="^5.0*"})
$classMPElementTable.Add("LW.Microsoft.Windows.SCCM.2012","`$MPElement[Name='LW.Microsoft.Windows.SCCM.2012']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SCCM.2012","System Center 2012 - Configuration Manager")

#MSDTC 2016
$registryPathTable.Add("LW.Microsoft.Windows.MSDTC.2016",("HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\SMS\Operations Management\LW.Microsoft.Windows.MSDTC.2016",@{"CurrentVersion"="6.3"})
$classMPElementTable.Add("LW.Microsoft.Windows.MSDTC.2016","`$MPElement[Name='LW.Microsoft.Windows.MSDTC.2016']$")
$classCategoryTable.Add("LW.Microsoft.Windows.MSDTC.2016","Distributed Transaction Coordinator 2016")

#MSDTC 2012 R2
$registryPathTable.Add("LW.Microsoft.Windows.MSDTC.2012R2",("HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\SMS\Operations Management\LW.Microsoft.Windows.MSDTC.2012R2",@{"CurrentVersion"="6.3"})
$classMPElementTable.Add("LW.Microsoft.Windows.MSDTC.2012R2","`$MPElement[Name='LW.Microsoft.Windows.MSDTC.2012R2']$")
$classCategoryTable.Add("LW.Microsoft.Windows.MSDTC.2012R2","Distributed Transaction Coordinator 2012 R2")

#SQL Server 2016
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2016",@("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\130\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2016","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2016']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2016","SQL Server 2016")

#Dynamics AX 2009
$registryPathTable.Add("LW.Microsoft.Windows.Dynamics.AX.2009",@("HKLM:\SYSTEM\CurrentControlSet\Services\Dynamics Server\5.0"))
$classMPElementTable.Add("LW.Microsoft.Windows.Dynamics.AX.2009","`$MPElement[Name='LW.Microsoft.Windows.Dynamics.AX.2009']$")
$classCategoryTable.Add("LW.Microsoft.Windows.Dynamics.AX.2009","Dynamics AX 2009")

#Dynamics AX Retail 2012 R3
$registryPathTable.Add("LW.Microsoft.Windows.Dynamics.AX.Retail.2012R3",@("HKLM:\SOFTWARE\Microsoft\Dynamics\6.0"))
$classMPElementTable.Add("LW.Microsoft.Windows.Dynamics.AX.Retail.2012R3","`$MPElement[Name='LW.Microsoft.Windows.Dynamics.AX.Retail.2012R3']$")
$classCategoryTable.Add("LW.Microsoft.Windows.Dynamics.AX.Retail.2012R3","Dynamics AX Retail 2012 R3")

#Host Integration Server 2010
$registryPathTable.Add("LW.Microsoft.Windows.Host.Integration.Server.2010",("HKLM:\SOFTWARE\Microsoft\SNA Server\CurrentVersion"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\SNA Server\CurrentVersion\LW.Microsoft.Windows.Host.Integration.Server.2010",@{"SNAVersion"="^8.5*"})
$classMPElementTable.Add("LW.Microsoft.Windows.Host.Integration.Server.2010","`$MPElement[Name='LW.Microsoft.Windows.Host.Integration.Server.2010']$")
$classCategoryTable.Add("LW.Microsoft.Windows.Host.Integration.Server.2010","Host Integration Server 2010")

#SharePoint Foundation Server 2010
$registryPathTable.Add("LW.Microsoft.Windows.SharePoint.Foundation.Server.2010",("HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0\WSS"))
$classMPElementTable.Add("LW.Microsoft.Windows.SharePoint.Foundation.Server.2010","`$MPElement[Name='LW.Microsoft.Windows.SharePoint.Foundation.Server.2010']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SharePoint.Foundation.Server.2010","Office SharePoint Foundation 2010")

#SharePoint 2010 Products
$registryPathTable.Add("LW.Microsoft.Windows.SharePoint.Server.2010",("HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\14.0"))
$classMPElementTable.Add("LW.Microsoft.Windows.SharePoint.Server.2010","`$MPElement[Name='LW.Microsoft.Windows.SharePoint.Server.2010']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SharePoint.Server.2010","SharePoint 2010 Products")

#BizTalk server 2010
$registryPathTable.Add("LW.Microsoft.Windows.Biztalk.2010",("HKLM:\SOFTWARE\Microsoft\BizTalk Server\3.0"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\BizTalk Server\3.0\LW.Microsoft.Windows.Biztalk.2010",@{"ProductVersion"="3.9.469.0"})
$classMPElementTable.Add("LW.Microsoft.Windows.Biztalk.2010","`$MPElement[Name='LW.Microsoft.Windows.Biztalk.2010']$")
$classCategoryTable.Add("LW.Microsoft.Windows.Biztalk.2010","BizTalk 2010")

#BizTalk server 2009
$registryPathTable.Add("LW.Microsoft.Windows.Biztalk.2009",("HKLM:\SOFTWARE\Microsoft\BizTalk Server\3.0"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\BizTalk Server\3.0\LW.Microsoft.Windows.Biztalk.2009",@{"ProductVersion"="3.8.368.0"})
$classMPElementTable.Add("LW.Microsoft.Windows.Biztalk.2009","`$MPElement[Name='LW.Microsoft.Windows.Biztalk.2009']$")
$classCategoryTable.Add("LW.Microsoft.Windows.Biztalk.2009","BizTalk 2009")

#BizTalk server 2006
$registryPathTable.Add("LW.Microsoft.Windows.Biztalk.2006",("HKLM:\SOFTWARE\Microsoft\BizTalk Server\3.0"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\BizTalk Server\3.0\LW.Microsoft.Windows.Biztalk.2006",@{"ProductVersion"="3.5.1602.0"})
$classMPElementTable.Add("LW.Microsoft.Windows.Biztalk.2006","`$MPElement[Name='LW.Microsoft.Windows.Biztalk.2006']$")
$classCategoryTable.Add("LW.Microsoft.Windows.Biztalk.2006","BizTalk 2006")

#SQL Server 2016 Reporting Services (Native Mode)
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2016.ReportingServices.NativeMode",("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\130\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2016.ReportingServices.NativeMode","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2016.ReportingServices.NativeMode']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2016.ReportingServices.NativeMode","SQL Server 2016 Reporting Services (Native Mode)")

#SQL Server 2014 Reporting Services (Native Mode)
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2014.ReportingServices.NativeMode",("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\120\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2014.ReportingServices.NativeMode","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2014.ReportingServices.NativeMode']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2014.ReportingServices.NativeMode","SQL Server 2014 Reporting Services (Native Mode)")

#SQL Server 2012 Reporting Services (Native Mode)
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2012.ReportingServices.NativeMode",("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\110\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2012.ReportingServices.NativeMode","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2012.ReportingServices.NativeMode']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2012.ReportingServices.NativeMode","SQL Server 2012 Reporting Services (Native Mode)")

#SQL Server 2016 Analysis Services
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2016.AnalysisServices",("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\130\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2016.AnalysisServices","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2016.AnalysisServices']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2016.AnalysisServices","SQL Server 2016 Analysis Services")

#SQL Server 2014 Analysis Services
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2014.AnalysisServices",("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\120\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2014.AnalysisServices","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2014.AnalysisServices']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2014.AnalysisServices","SQL Server 2014 Analysis Services")

#SQL Server 2012 Analysis Services
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2012.AnalysisServices",("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\110\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2012.AnalysisServices","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2012.AnalysisServices']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2012.AnalysisServices","SQL Server 2012 Analysis Services")

#SQL Server 2016 Replication
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2016.Replication",("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\130\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2016.Replication","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2016.Replication']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2016.Replication","SQL Server 2016 Replication")

#SQL Server 2014 Replication
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2014.Replication",("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\120\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2014.Replication","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2014.Replication']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2014.Replication","SQL Server 2014 Replication")

#SQL Server 2012 Replication
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2012.Replication",("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\110\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2012.Replication","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2012.Replication']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2012.Replication","SQL Server 2012 Replication")

#SQL Server 2017+ Replication
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2017.Replication",("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\140\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2017.Replication","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2017.Replication']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2017.Replication","SQL Server 2017+ Replication")

#SQL Server 2017+
$registryPathTable.Add("LW.Microsoft.Windows.SQL.Server.2017",@("HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\140\Machines"))
$classMPElementTable.Add("LW.Microsoft.Windows.SQL.Server.2017","`$MPElement[Name='LW.Microsoft.Windows.SQL.Server.2017']$")
$classCategoryTable.Add("LW.Microsoft.Windows.SQL.Server.2017","SQL Server 2017+")

#App Controler 2012
$registryPathTable.Add("LW.Microsoft.Windows.AppController.2012R2",@("HKLM:\SOFTWARE\Microsoft\Microsoft System Center App Controller"))
$classMPElementTable.Add("LW.Microsoft.Windows.AppController.2012R2","`$MPElement[Name='LW.Microsoft.Windows.AppController.2012R2']$")
$classCategoryTable.Add("LW.Microsoft.Windows.AppController.2012R2","System Center 2012 - App Controller")

#Advanced Threat Analytics
$registryPathTable.Add("LW.Microsoft.AdvancedThreatAnalytics",@("HKLM:\SOFTWARE\Microsoft\Microsoft Advanced Threat Analytics"))
$classMPElementTable.Add("LW.Microsoft.AdvancedThreatAnalytics","`$MPElement[Name='LW.Microsoft.AdvancedThreatAnalytics']$")
$classCategoryTable.Add("LW.Microsoft.AdvancedThreatAnalytics","Advanced Threat Analytics")

#SDN Monitoring
$registryPathTable.Add("LW.Microsoft.SDNMonitoring",@("HKLM:\SOFTWARE\MICROSOFT\SDNMonitoringMP"))
$classMPElementTable.Add("LW.Microsoft.SDNMonitoring","`$MPElement[Name='LW.Microsoft.SDNMonitoring']$")
$classCategoryTable.Add("LW.Microsoft.SDNMonitoring","SDN Monitoring")

#Lync.Server.2013
$registryPathTable.Add("LW.Microsoft.Lync.Server.2013",("HKLM:\Software\Microsoft\Real-Time Communications\{2A0B4BB2-4921-4b40-BA9E-81747CB84635}"))
$regKeyValuePairs.Add("HKLM:\Software\Microsoft\Real-Time Communications\{2A0B4BB2-4921-4b40-BA9E-81747CB84635}\LW.Microsoft.Lync.Server.2013",@{"Version"="^5"})
$classMPElementTable.Add("LW.Microsoft.Lync.Server.2013","`$MPElement[Name='LW.Microsoft.Lync.Server.2013']$")
$classCategoryTable.Add("LW.Microsoft.Lync.Server.2013","Lync Server 2013")

#LW.Microsoft.SkypeForBusiness.2015
$registryPathTable.Add("LW.Microsoft.SkypeForBusiness.2015",("HKLM:\Software\Microsoft\Real-Time Communications\{2A0B4BB2-4921-4b40-BA9E-81747CB84635}"))
$regKeyValuePairs.Add("HKLM:\Software\Microsoft\Real-Time Communications\{2A0B4BB2-4921-4b40-BA9E-81747CB84635}\LW.Microsoft.SkypeForBusiness.2015",@{"Version"="^6"})
$classMPElementTable.Add("LW.Microsoft.SkypeForBusiness.2015","`$MPElement[Name='LW.Microsoft.SkypeForBusiness.2015']$")
$classCategoryTable.Add("LW.Microsoft.SkypeForBusiness.2015","Skype for Business Server 2015")

#Virtual Machine Manager 2016
$registryPathTable.Add("LW.Microsoft.2016.VirtualMachineManager",@("HKLM:\SYSTEM\CurrentControlSet\Services\Virtual Server"))
$classMPElementTable.Add("LW.Microsoft.2016.VirtualMachineManager","`$MPElement[Name='LW.Microsoft.2016.VirtualMachineManager']$")
$classCategoryTable.Add("LW.Microsoft.2016.VirtualMachineManager","Virtual Machine Manager 2016")

#LW.Microsoft.Power.Management.2012
$registryPathTable.Add("LW.Microsoft.Power.Management.2012",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.Power.Management.2012","`$MPElement[Name='LW.Microsoft.Power.Management.2012']$")
$classCategoryTable.Add("LW.Microsoft.Power.Management.2012","Power Management 2012")

#LW.Microsoft.3rdParty.Infront.RightFax
$registryPathTable.Add("LW.Microsoft.3rdParty.Infront.RightFax",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.Infront.RightFax","`$MPElement[Name='LW.Microsoft.3rdParty.Infront.RightFax']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.Infront.RightFax","RightFax (by Infront)")

#LW.Microsoft.3rdParty.Infront.SCOrchestrator.Core
$registryPathTable.Add("LW.Microsoft.3rdParty.Infront.SCOrchestrator.Core",@("HKLM:\SOFTWARE\WOW6432NODE\Microsoft\SystemCenter2012\Orchestrator"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.Infront.SCOrchestrator.Core","`$MPElement[Name='LW.Microsoft.3rdParty.Infront.SCOrchestrator.Core']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.Infront.SCOrchestrator.Core","SC Orchestrator (by Infront)")

#LW.Microsoft.3rdParty.Infront.McAfee
$registryPathTable.Add("LW.Microsoft.3rdParty.Infront.McAfee",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.Infront.McAfee","`$MPElement[Name='LW.Microsoft.3rdParty.Infront.McAfee']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.Infront.McAfee","McAfee (by Infront)")

#LW.Microsoft.3rdParty.NiCE.IBM.Domino
$registryPathTable.Add("LW.Microsoft.3rdParty.NiCE.IBM.Domino",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.NiCE.IBM.Domino","`$MPElement[Name='LW.Microsoft.3rdParty.NiCE.IBM.Domino']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.NiCE.IBM.Domino","IBM Domino (by NiCE)")

#LW.Microsoft.3rdParty.NiCE.Oracle
$registryPathTable.Add("LW.Microsoft.3rdParty.NiCE.Oracle",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.NiCE.Oracle","`$MPElement[Name='LW.Microsoft.3rdParty.NiCE.Oracle']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.NiCE.Oracle","Oracle (by NiCE)")

#LW.Microsoft.3rdParty.OpsLogix.VMware
$registryPathTable.Add("LW.Microsoft.3rdParty.OpsLogix.VMware",@("HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\VMware Tools"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.OpsLogix.VMware","`$MPElement[Name='LW.Microsoft.3rdParty.OpsLogix.VMware']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.OpsLogix.VMware","VMware (by OpsLogix)")

#LW.Microsoft.3rdParty.OpsLogix.Oracle
$registryPathTable.Add("LW.Microsoft.3rdParty.OpsLogix.Oracle",@("HKLM:\Software\Oracle"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.OpsLogix.Oracle","`$MPElement[Name='LW.Microsoft.3rdParty.OpsLogix.Oracle']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.OpsLogix.Oracle","Oracle (by OpsLogix)")

#LW.Microsoft.3rdParty.OpsLogix.IBMMQ
$registryPathTable.Add("LW.Microsoft.3rdParty.OpsLogix.IBMMQ",@("HKLM:\SOFTWARE\Wow6432Node\IBM\MQSeries"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.OpsLogix.IBMMQ","`$MPElement[Name='LW.Microsoft.3rdParty.OpsLogix.IBMMQ']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.OpsLogix.IBMMQ","IBM MQ (by OpsLogix)")

#LW.Microsoft.3rdParty.OpsLogix.BlackBerryV12
$registryPathTable.Add("LW.Microsoft.3rdParty.OpsLogix.BlackBerryV12",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.OpsLogix.BlackBerryV12","`$MPElement[Name='LW.Microsoft.3rdParty.OpsLogix.BlackBerryV12']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.OpsLogix.BlackBerryV12","BlackBerry (by OpsLogix)")

#LW.Microsoft.3rdParty.OpsLogix.Swift
$registryPathTable.Add("LW.Microsoft.3rdParty.OpsLogix.Swift",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.OpsLogix.Swift","`$MPElement[Name='LW.Microsoft.3rdParty.OpsLogix.Swift']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.OpsLogix.Swift","Swift (by OpsLogix)")

#LW.Microsoft.3rdParty.NiCE.DB2
$registryPathTable.Add("LW.Microsoft.3rdParty.NiCE.DB2",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.NiCE.DB2","`$MPElement[Name='LW.Microsoft.3rdParty.NiCE.DB2']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.NiCE.DB2","DB2 (by NiCE)")

#LW.Microsoft.3rdParty.Comtrade.NutanixVM
$registryPathTable.Add("LW.Microsoft.3rdParty.Comtrade.NutanixVM",@("HKLM:\HARDWARE\DESCRIPTION\System\BIOS"))
$regKeyValuePairs.Add("HKLM:\HARDWARE\DESCRIPTION\System\BIOS\LW.Microsoft.3rdParty.Comtrade.NutanixVM",@{"SystemManufacturer"="Nutanix"})
$classMPElementTable.Add("LW.Microsoft.3rdParty.Comtrade.NutanixVM","`$MPElement[Name='LW.Microsoft.3rdParty.Comtrade.NutanixVM']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.Comtrade.NutanixVM","Nutanix VM (by Comtrade)")

#LW.Microsoft.3rdParty.Calcomp.CHS
$registryPathTable.Add("LW.Microsoft.3rdParty.Calcomp.CHS",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.Calcomp.CHS","`$MPElement[Name='LW.Microsoft.3rdParty.Calcomp.CHS']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.Calcomp.CHS","CHS Suite (by Calcomp)")

#LW.Microsoft.3rdParty.Savision.Exchange.2013
$registryPathTable.Add("LW.Microsoft.3rdParty.Savision.Exchange.2013",("HKLM:\SOFTWARE\Microsoft\ExchangeServer\v15\Setup"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.Savision.Exchange.2013","`$MPElement[Name='LW.Microsoft.3rdParty.Savision.Exchange.2013']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.Savision.Exchange.2013","Exchange 2013 (by Savision)")

#LW.Microsoft.3rdParty.Savision.Exchange.2010
$registryPathTable.Add("LW.Microsoft.3rdParty.Savision.Exchange.2010",("HKLM:\SOFTWARE\Microsoft\ExchangeServer\v14\Setup"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.Savision.Exchange.2010","`$MPElement[Name='LW.Microsoft.3rdParty.Savision.Exchange.2010']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.Savision.Exchange.2010","Exchange 2010 (by Savision)")

#LW.Microsoft.3rdParty.Savision.Dynamics.CRM
$registryPathTable.Add("LW.Microsoft.3rdParty.Savision.Dynamics.CRM",("HKLM:\SOFTWARE\Microsoft\MSCRM"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\MSCRM\LW.Microsoft.3rdParty.Savision.Dynamics.CRM",@{"CRM_Server_Version"="^7.*"})
$classMPElementTable.Add("LW.Microsoft.3rdParty.Savision.Dynamics.CRM","`$MPElement[Name='LW.Microsoft.3rdParty.Savision.Dynamics.CRM']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.Savision.Dynamics.CRM","Dynamics CRM (by Savision)")

#LW.Microsoft.3rdParty.Savision.SharePoint.2013
$registryPathTable.Add("LW.Microsoft.3rdParty.Savision.SharePoint.2013",("HKLM:\SOFTWARE\Microsoft\Shared Tools\Web Server Extensions\15.0\WSS"))
$classMPElementTable.Add("LW.Microsoft.3rdParty.Savision.SharePoint.2013","`$MPElement[Name='LW.Microsoft.3rdParty.Savision.SharePoint.2013']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.Savision.SharePoint.2013","SharePoint 2013 (by Savision)")

#LW.Microsoft.3rdParty.Savision.Lync.Server.2013
$registryPathTable.Add("LW.Microsoft.3rdParty.Savision.Lync.Server.2013",("HKLM:\Software\Microsoft\Real-Time Communications\{2A0B4BB2-4921-4b40-BA9E-81747CB84635}"))
$regKeyValuePairs.Add("HKLM:\Software\Microsoft\Real-Time Communications\{2A0B4BB2-4921-4b40-BA9E-81747CB84635}\LW.Microsoft.3rdParty.Savision.Lync.Server.2013",@{"Version"="^5"})
$classMPElementTable.Add("LW.Microsoft.3rdParty.Savision.Lync.Server.2013","`$MPElement[Name='LW.Microsoft.3rdParty.Savision.Lync.Server.2013']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.Savision.Lync.Server.2013","Lync Server 2013 (by Savision)")

#LW.Microsoft.3rdParty.Savision.SkypeForBusiness.2015
$registryPathTable.Add("LW.Microsoft.3rdParty.Savision.SkypeForBusiness.2015",("HKLM:\Software\Microsoft\Real-Time Communications\{2A0B4BB2-4921-4b40-BA9E-81747CB84635}"))
$regKeyValuePairs.Add("HKLM:\Software\Microsoft\Real-Time Communications\{2A0B4BB2-4921-4b40-BA9E-81747CB84635}\LW.Microsoft.3rdParty.Savision.SkypeForBusiness.2015",@{"Version"="^6"})
$classMPElementTable.Add("LW.Microsoft.3rdParty.Savision.SkypeForBusiness.2015","`$MPElement[Name='LW.Microsoft.3rdParty.Savision.SkypeForBusiness.2015']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.Savision.SkypeForBusiness.2015","Skype for Business Server 2015 (by Savision)")

#LW.Microsoft.3rdParty.Savision.SCCM.2012
$registryPathTable.Add("LW.Microsoft.3rdParty.Savision.SCCM.2012",("HKLM:\SOFTWARE\Microsoft\SMS\Operations Management"))
$regKeyValuePairs.Add("HKLM:\SOFTWARE\Microsoft\SMS\Operations Management\LW.Microsoft.3rdParty.Savision.SCCM.2012",@{"Version"="^5.0*"})
$classMPElementTable.Add("LW.Microsoft.3rdParty.Savision.SCCM.2012","`$MPElement[Name='LW.Microsoft.3rdParty.Savision.SCCM.2012']$")
$classCategoryTable.Add("LW.Microsoft.3rdParty.Savision.SCCM.2012","SCCM 2012 (by Savision)")

#LW.Microsoft.JEE.WebSphere.8plus.Windows.Configuration
$registryPathTable.Add("LW.Microsoft.JEE.WebSphere.8plus.Windows.Configuration",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.JEE.WebSphere.8plus.Windows.Configuration","`$MPElement[Name='LW.Microsoft.JEE.WebSphere.8plus.Windows.Configuration']$")
$classCategoryTable.Add("LW.Microsoft.JEE.WebSphere.8plus.Windows.Configuration","WebSphere 8+")

#LW.Microsoft.JEE.Tomcat.8plus.Windows.Configuration
$registryPathTable.Add("LW.Microsoft.JEE.Tomcat.8plus.Windows.Configuration",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.JEE.Tomcat.8plus.Windows.Configuration","`$MPElement[Name='LW.Microsoft.JEE.Tomcat.8plus.Windows.Configuration']$")
$classCategoryTable.Add("LW.Microsoft.JEE.Tomcat.8plus.Windows.Configuration","Tomcat 8+")

#LW.Microsoft.JEE.Wildfly.8plus.Windows.Configuration
$registryPathTable.Add("LW.Microsoft.JEE.Wildfly.8plus.Windows.Configuration",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.JEE.Wildfly.8plus.Windows.Configuration","`$MPElement[Name='LW.Microsoft.JEE.Wildfly.8plus.Windows.Configuration']$")
$classCategoryTable.Add("LW.Microsoft.JEE.Wildfly.8plus.Windows.Configuration","Wildfly 8+")

#LW.Microsoft.JEE.JBoss.7.Windows.Configuration
$registryPathTable.Add("LW.Microsoft.JEE.JBoss.7.Windows.Configuration",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.JEE.JBoss.7.Windows.Configuration","`$MPElement[Name='LW.Microsoft.JEE.JBoss.7.Windows.Configuration']$")
$classCategoryTable.Add("LW.Microsoft.JEE.JBoss.7.Windows.Configuration","JBoss 7")

#LW.Microsoft.JEE.WebLogic.12plus.Windows.Configuration
$registryPathTable.Add("LW.Microsoft.JEE.WebLogic.12plus.Windows.Configuration",@("HKLM:\SOFTWARE\MICROSOFT"))
$classMPElementTable.Add("LW.Microsoft.JEE.WebLogic.12plus.Windows.Configuration","`$MPElement[Name='LW.Microsoft.JEE.WebLogic.12plus.Windows.Configuration']$")
$classCategoryTable.Add("LW.Microsoft.JEE.WebLogic.12plus.Windows.Configuration","WebLogic 12+")

function LogWrite
{
Param([string]$logString)
$script:logMessage += $logString
}

function Test-AllRegistryValue ($RegKeys)
{
$checkKeyExists = $true
foreach ($RegKey in $RegKeys)
{
$result = Test-RegistryValue $RegKey
if ( $result -eq $false )
{
$checkKeyExists = $false
}

}
return $checkKeyExists
}

function Test-AnyRegistryValue ($RegKeys)
{
$checkKeyExists = $false
ForEach ($RegKey in $RegKeys)
{
$result = Test-RegistryValue $RegKey
if ( $result -eq $true )
{
$checkKeyExists = $true
break
}

}
return $checkKeyExists
}

Function Check-Websphere($requiredVersion)
{
$usersList=Get-ChildItem Registry::HKEY_USERS|Select Name
foreach($user in $usersList)
{
$key1="Registry::"+$user.Name+"\Software\IBM\WebSphere Application Server";
$key2="Registry::"+$user.Name+"\Software\IBM\WebSphere Application Server Network Deployment";

if((Test-Path $key1) -and (Check-RequiredVersion -key $key1 -requiredVersion $requiredVersion))
{
return $true;
}

if((Test-Path $key2) -and (Check-RequiredVersion -key $key2 -requiredVersion $requiredVersion))
{
return $true;
}
}
return $false;
}

Function Check-RequiredVersion($key,$requiredVersion)
{
$versionKeys=Get-ChildItem $key;
foreach($version in $versionKeys)
{
$finalKey=$key+'\'+$version.PSChildName;
$keyData=Get-ItemProperty -Path $finalKey;
if([int]$keyData.MajorVersion -ge [int]$requiredVersion)
{
$keyData.MajorVersion
return $true;
}
}
return $false;
}


Function Check-Tomcat($requiredVersion)
{
$list=Get-WmiObject -Query "SELECT * FROM Win32_Process WHERE Name LIKE 'java%.exe' or Name = 'conhost.exe' or Name Like 'Tomcat_.exe'"
$objects=$list|where {$_.CommandLine -like '*Tomcat*'}
foreach($object in $objects)
{
if($object.CommandLine -like '*-Dcatalina.home*')
{
$locationReg=[Regex]::new('"-Dcatalina.home=([^"]+)"')
$result=$locationReg.Match($object.CommandLine);
if($result.Success)
{
$location=$result.Groups[1].Value;
}
else
{
$locationReg=[Regex]::new('-Dcatalina.home="([^"]+)"')
$result=$locationReg.Match($object.CommandLine);
if($result.Success)
{
$location=$result.Groups[1].Value;
}
}
}
$location=$location.Replace('"','');
$rootLocation=$location+"\RELEASE-NOTES";
if(Test-Path $rootLocation)
{
$data=Get-Content $rootLocation
foreach($line in $data)
{
if($line -like "*Apache Tomcat Version *")
{
$reg=[Regex]::new("([0-9]+\.[0-9]+\.[0-9]+)")
$resolvedData=$reg.Match($line);
if($resolvedData.Success)
{
$version=$resolvedData.Value.Split('.');
if([int]$version[0] -ge [int]$requiredVersion)
{
return $true;
}
}
break;
}
}
}
}
return $false;
}

Function Check-Wildfly($requiredVersion)
{
$list=Get-WmiObject -Query "SELECT CommandLine FROM Win32_Process WHERE Name LIKE 'java%.exe' or Name = 'conhost.exe'"
$objects=$list|Where-Object {$_.CommandLine -like '*-Djboss.home.dir*'}
$fileLocation1="\modules\system\layers\base\org\jboss\as\product\wildfly-full\dir\META-INF\MANIFEST.MF";
$fileLocation2="\modules\system\layers\base\org\jboss\as\server\main\module.xml"
foreach($object in $objects)
{
$locationReg=[Regex]::new('"-Djboss.home.dir=([^"]+)"')
$location=$null
$result=$locationReg.Match($object.CommandLine);
if($result.Success)
{
$location=$result.Groups[1].Value;
}
else
{
$locationReg=[Regex]::new('-Djboss.home.dir="([^"]+)"')
$result=$locationReg.Match($object.CommandLine);
if($result.Success)
{
$location=$result.Groups[1].Value;
}
}

$location=$location.Replace('"','');
if(Test-Path ($location+$fileLocation1))
{
$rootLocation=$location+$fileLocation1
$versionData=Get-Content -Path $rootLocation;
}
elseif(Test-Path ($location+$fileLocation2))
{
$rootLocation=$location+$fileLocation2;
$fileData=[xml](Get-Content -Path $rootLocation);
$versionData=$fileData.module.resources.'resource-root'.path
}
if($versionData -ne $null -and $versionData -ne "")
{
$reg=[Regex]::new("([0-9]+\.[0-9]+\.[0-9]+)")
$resolvedData=$reg.Match($versionData);
if($resolvedData.Success)
{
$version=$resolvedData.Value.Split('.');
if([int]$version[0] -ge [int]$requiredVersion)
{
return $true;
}
}
}
}
return $false;
}

Function Check-JBoss($requiredVersion)
{
$list=Get-WmiObject -Query "SELECT CommandLine FROM Win32_Process WHERE Name LIKE 'java%.exe' or Name = 'conhost.exe'"
$objects=$list|Where-Object {$_.CommandLine -like '*-Djboss.home.dir*'}
foreach($object in $objects)
{
$locationReg=[Regex]::new('"-Djboss.home.dir=([^"]+)"')
$location=$null
$result=$locationReg.Match($object.CommandLine);
if($result.Success)
{
$location=$result.Groups[1].Value;
}
else
{
$locationReg=[Regex]::new('-Djboss.home.dir="([^"]+)"')
$result=$locationReg.Match($object.CommandLine);
if($result.Success)
{
$location=$result.Groups[1].Value;
}
}

$location=$location.Replace('"','');
$rootLocation=$location+"\modules\org\jboss\as\server\main\module.xml"
if(Test-Path $rootLocation)
{
$fileData=[xml](Get-Content -Path $rootLocation);
$versionData=$fileData.module.resources.'resource-root'.path
$reg=[Regex]::new("([0-9]+\.[0-9]+\.[0-9]+)")
$resolvedData=$reg.Match($versionData);
if($resolvedData.Success)
{
$version=$resolvedData.Value.Split('.');
if([int]$version[0] -eq [int]$requiredVersion)
{
return $true;
}
}
}
}
return $false;
}

Function Check-Weblogic($requiredVersion)
{
$query="Select CommandLine from Win32_Process WHERE Name LIKE 'java%.exe'"
$objects=Get-WmiObject -Query $query
$requiredObjects=$objects|Where-Object{$_.CommandLine -like '*-Dweblogic.home*'}
foreach($object in $requiredObjects)
{
$lines=$object.CommandLine.Split(" ");
foreach($line in $lines)
{
if($line -like '*-Dweblogic.home*')
{
$location=$line.replace("-Dweblogic.home=","");
break;
}
}

$locationValues=$location.Split("\");
$rootLocation=$locationValues[0]+'\'+$locationValues[1];
$registryFile=Get-ChildItem -Path $rootLocation -Recurse |Where-Object {$_.Name -eq 'registry.xml'}
$registryLocation=$registryFile.FullName;
$fileData=[xml](Get-Content -Path $registryLocation);
$version=$fileData.registry.distributions.distribution.version
$versions=$version.Split(".");

if([int]$versions[0] -ge [int]$requiredVersion)
{
return $true;
break;
}
}
return $false;
}


#This function will check the existence of registry path
#Providing path is mandatory, key value is optional
function Test-RegistryValue {
param (
[parameter(Mandatory=$true)]
[ValidateNotNullOrEmpty()]$Path,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]$Key,
[parameter(Mandatory=$false)]
[ValidateNotNullOrEmpty()]$Value
)

$checkRegistryKeyExists = $false

#Check if path exists
$isPathPresent = Test-Path $Path

#If only path argument was passed in function and path is present, then return true
if($isPathPresent -and ($Key -eq $null) -and ($Value -eq $null))
{
$checkRegistryKeyExists = $true
}
#handle other scenarios where key or value or both were passed in function arguments
elseif($isPathPresent)
{
#retrieve all keys present on that path
$allKeys = Get-ItemProperty $Path

#check if key parameter passed to the function is present in the retrieved keys list
if($allKeys.($Key))
{
#check if value is not null then match it with key or if value is null then return true
if((($Value -ne $null) -and $allKeys.($Key) -match $Value) -or ($Value -eq $null))
{
$checkRegistryKeyExists = $true
}
}
}

return $checkRegistryKeyExists
}

#scriptStartTime will help in calculating script run time
$scriptStartTime = Get-Date
$script:logMessage = ''
$GuestOS = ''
$wmiOS = (Get-WmiObject -Class Win32_OperatingSystem).caption
if (-not ([string]::IsNullOrEmpty($wmiOS)))
{
$GuestOS = $wmiOS
}

LogWrite "`nNonServerRoles::Starting NonServerRoles script."

if(($SourceId -eq $null) -or ($ManagedEntityId -eq $null) -or ($computerName -eq $null))
{
LogWrite "`nNonServerRoles::SourceId, ManagedEntityId or Computer name is null. Exiting script."
Exit -1
}

#Create discovery property bag only once as we can't return multiple property bags
$api = new-object -comObject 'MOM.ScriptAPI'
$discoveryData = $api.CreateDiscoveryData(0, $SourceId, $ManagedEntityId)

#Iterate through discovery method table
if($registryPathTable -eq $null)
{
#Code shouldn't come here
LogWrite "`nNonServerRoles::Registry path table is empty. Exiting the script."
Exit -1
}

#Iterate through non-server roles list with their registry paths
foreach ($classDetails in $registryPathTable.GetEnumerator())
{
$className = $classDetails.Name
$regPaths = $classDetails.Value
#Let's set the bool to true for each non-server roles in the list and set to false if non-server role is not installed
$IsValidProperties = $true

#Only proceed if non-server role has some paths to test else continue to second entry in registryPathTable
if($regPaths.length -ne 0)
{
foreach($path in $regPaths)
{
$pathWithClass = "$path\$className"
#Check if we need to validate key value pairs for the given path else just test the existence of path
if($regKeyValuePairs.Item($pathWithClass) -ne $null)
{
$pairs = $regKeyValuePairs.Item($pathWithClass)
#As a precaution check - if somebody creates a false entry of path in the table with empty key value pairs
if($pairs.Count -ne 0)
{
foreach($keypair in $pairs.GetEnumerator())
{
#Test the path with key values
$valid = Test-RegistryValue -Path $path -Key $keyPair.Key -Value $keyPair.Value

if($valid -eq $false)
{
#Set the bool to false so that we don't create instance for this role
$IsValidProperties = $false
break
}
}
}
else
{
$IsValidProperties = $false
break
}
}
else
{
#Test the existence of the path which has no key value pairs and set bool to false if not found
$valid = Test-RegistryValue -Path $path

if($valid -eq $false)
{
$IsValidProperties = $false
break
}

if($className -eq "LW.Microsoft.Windows.MSDTC.2016")
{
$IsValidProperties =$false
$MSDTCobject = $null
$MSDTCobject = Get-WmiObject win32_service -filter "name='MSDTC'"
if($MSDTCobject)
{
$OSObject = Get-WMIObject Win32_OperatingSystem

if($OSObject.ProductType -ne "1" -and $OSObject.Version.Contains("10.0."))
{
$IsValidProperties =$true
}

}
}
elseif($className -eq "LW.Microsoft.Windows.MSDTC.2012R2")
{
$IsValidProperties =$false
$MSDTCobject = $null
$MSDTCobject = Get-WmiObject win32_service -filter "name='MSDTC'"
if($MSDTCobject)
{
$OSObject = Get-WMIObject Win32_OperatingSystem

if($OSObject.ProductType -ne "1" -and $OSObject.Version.Contains("6.3."))
{
$IsValidProperties =$true
}
}
}
elseif($className -eq "LW.Microsoft.Windows.SharePoint.Server.2010")
{
$IsValidProperties =$false
$Regkeys = @(
"HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\Office14.WCSERVER"
"HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\Office14.SSERVERX"
"HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\Office14.SSERVER"
"HKLM:\Software\Microsoft\Windows\CurrentVersion\Uninstall\Office14.OSERVER"
)
$Allvalid = Test-AnyRegistryValue $Regkeys
if($Allvalid -eq $true)
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.Windows.SQL.Server.2016.ReportingServices.NativeMode")
{
$IsValidProperties =$false
$regkeys1 = @(
"HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\130\Machines"
"HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS"
)
$regkeys2 = @(
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\130\Machines"
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Instance Names\RS"
)

$allvalid1 = Test-AllRegistryValue $regkeys1
$allvalid2 = Test-AllRegistryValue $regkeys2

if($allvalid1 -eq $true -Or $allvalid2 -eq $true )
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.Windows.SQL.Server.2014.ReportingServices.NativeMode")
{
$IsValidProperties =$false
$regkeys1 = @(
"HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\120\Machines"
"HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS"
)

$regkeys2 = @(
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\120\Machines"
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Instance Names\RS"
)

$allvalid1 = Test-AllRegistryValue $regkeys1
$allvalid2 = Test-AllRegistryValue $regkeys2

if($allvalid1 -eq $true -Or $allvalid2 -eq $true )
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.Windows.SQL.Server.2012.ReportingServices.NativeMode")
{
$IsValidProperties =$false
$regkeys1 = @(
"HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\110\Machines"
"HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Instance Names\RS"
)

$regkeys2 = @(
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\110\Machines"
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Instance Names\RS"
)

$allvalid1 = Test-AllRegistryValue $regkeys1
$allvalid2 = Test-AllRegistryValue $regkeys2

if($allvalid1 -eq $true -Or $allvalid2 -eq $true )
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.Windows.SQL.Server.2016.AnalysisServices")
{
$IsValidProperties =$false
$Regkeys = @(
"HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\130\Machines"
"HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Microsoft Analysis Services"
)

$Regkeys = @(
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\130\Machines"
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Microsoft Analysis Services"
)

$allvalid1 = Test-AllRegistryValue $regkeys1
$allvalid2 = Test-AllRegistryValue $regkeys2

if($allvalid1 -eq $true -Or $allvalid2 -eq $true )
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.Windows.SQL.Server.2014.AnalysisServices")
{
$IsValidProperties =$false
$regkeys1 = @(
"HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\120\Machines"
"HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Microsoft Analysis Services"
)

$regkeys2 = @(
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\120\Machines"
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Microsoft Analysis Services"
)

$allvalid1 = Test-AllRegistryValue $regkeys1
$allvalid2 = Test-AllRegistryValue $regkeys2

if($allvalid1 -eq $true -Or $allvalid2 -eq $true )
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.Windows.SQL.Server.2012.AnalysisServices")
{
$IsValidProperties =$false
$regkeys1 = @(
"HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\110\Machines"
"HKLM:\SOFTWARE\Microsoft\Microsoft SQL Server\Microsoft Analysis Services"
)

$regkeys2 = @(
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\110\Machines"
"HKLM:\SOFTWARE\Wow6432Node\Microsoft\Microsoft SQL Server\Microsoft Analysis Services"
)

$allvalid1 = Test-AllRegistryValue $regkeys1
$allvalid2 = Test-AllRegistryValue $regkeys2

if($allvalid1 -eq $true -Or $allvalid2 -eq $true )
{
$IsValidProperties =$true
}
}
elseif(($className -eq "LW.Microsoft.Windows.SQL.Server.2017.Replication") -Or ($className -eq "LW.Microsoft.Windows.SQL.Server.2016.Replication") -Or ($className -eq "LW.Microsoft.Windows.SQL.Server.2014.Replication") -Or ($className -eq "LW.Microsoft.Windows.SQL.Server.2012.Replication"))
{
$IsValidProperties =$false
try
{
# Make Connecting string to the SQL Server Instance and the Database
$con = New-Object System.Data.SqlClient.SqlConnection("Data Source=.; Initial Catalog=master; Integrated Security=SSPI")
$stmt_select = "SELECT COUNT(*) FROM sys.databases WHERE is_distributor = 1"
# Create command to execute to SQL connection
$cmd = $con.CreateCommand()
$cmd.CommandText = $stmt_select
$con.Open()
# Invoke the Insert statement
if($cmd.ExecuteScalar() -gt 0)
{
$IsValidProperties =$true
}
}
catch
{
$con.Close()
$cmd.Dispose()
$IsValidProperties =$false
}
finally
{
$con.Close()
$cmd.Dispose()
}
}
elseif($className -eq "LW.Microsoft.SDNMonitoring")
{
$key = "HKLM:\SOFTWARE\MICROSOFT\SDNMonitoringMP\"
$NCURLRegKeyName = "RestUrl"
#Get the Rest URL from the registry
$NCRegistry = Get-ItemProperty -Path $key -Name $NCURLRegKeyName -ErrorAction SilentlyContinue
if($NCRegistry -eq $null)
{
$IsValidProperties =$false
break
}
$NCURL = $NCRegistry.$NCURLRegKeyName
if($NCURL -eq $null)
{
$IsValidProperties =$false
break
}
$IsValidProperties =$true
}
elseif($className -eq "LW.Microsoft.3rdParty.Infront.McAfee")
{
$IsValidProperties =$false
$Regkeys = @(
"HKLM:\SOFTWARE\McAfee\AVEngine"
"HKLM:\SOFTWARE\Wow6432Node\McAfee\AVEngine"
"HKLM:\SOFTWARE\Network Associates\ePolicy Orchestrator\Agent"
"HKLM:\SOFTWARE\Wow6432Node\Network Associates\ePolicy Orchestrator"
"HKLM:\SOFTWARE\Wow6432Node\Network Associates\ePolicy Orchestrator\Agent"
"HKLM:\SOFTWARE\Wow6432Node\McAfee\ePolicy Orchestrator\MFS Framework"
)
$Allvalid = Test-AnyRegistryValue $Regkeys
if($Allvalid -eq $true)
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.3rdParty.Infront.RightFax")
{
$IsValidProperties =$false
$regkeys1 = @(
"HKLM:\SOFTWARE\Wow6432Node\RightFax"
"HKLM:\SOFTWARE\RightFax"
)

$regkeys2 = @(
"HKLM:\SOFTWARE\Wow6432Node\RightFax\AddToSCOM"
"HKLM:\SOFTWARE\RightFax\AddToSCOM"
)

$allvalid1 = Test-AnyRegistryValue $regkeys1
$allvalid2 = Test-AnyRegistryValue $regkeys2

if($allvalid1 -eq $true -Or $allvalid2 -eq $true )
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.3rdParty.NiCE.IBM.Domino")
{
$IsValidProperties =$false
$Regkeys = @(
"HKLM:\SOFTWARE\Wow6432Node\Lotus\Domino"
"HKLM:\SOFTWARE\Lotus\Domino"
)
$Allvalid = Test-AnyRegistryValue $Regkeys
if($Allvalid -eq $true)
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.3rdParty.NiCE.Oracle")
{
$IsValidProperties =$false
$strQuery = "select DisplayName from win32_service where Name like 'OracleService%' and StartMode != 'Disabled'"
$NiCEOracleobject = $null
try{
$cimSessionOption = New-CimSessionOption -Protocol DCOM
$cimsession = New-CimSession -SessionOption $cimSessionOption
$NiCEOracleobject = Get-CimInstance -CimSession $cimsession -Namespace $("root\cimv2") -Query $strQuery -ErrorAction Stop
}
catch
{
$NiCEOracleobject = Get-WmiObject -Namespace $("root\cimv2") -Query $strQuery -ErrorAction Stop
}
Finally{
Get-CimSession | Remove-CimSession
$cimsession =$null
$cimSessionOption = $null
}
if($NiCEOracleobject)
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.3rdParty.OpsLogix.BlackBerryV12")
{
$IsValidProperties =$false
$regkeys1 = @(
"HKLM:\SOFTWARE\Wow6432Node\BlackBerry\BES12"
"HKLM:\SOFTWARE\Wow6432Node\Research In Motion\BES\Setup\InstallVersion"
)
$allvalid1 = Test-AnyRegistryValue $regkeys1

if($allvalid1 -eq $true)
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.3rdParty.OpsLogix.Swift")
{
$IsValidProperties =$false
$strQuery = "select DisplayName from win32_service where DisplayName like 'SWIFT%'"
$OpsLogixSwiftobject = $null
try{
$cimSessionOption = New-CimSessionOption -Protocol DCOM
$cimsession = New-CimSession -SessionOption $cimSessionOption
$OpsLogixSwiftobject = Get-CimInstance -CimSession $cimsession -Namespace $("root\cimv2") -Query $strQuery -ErrorAction Stop
}
catch
{
$OpsLogixSwiftobject = Get-WmiObject -Namespace $("root\cimv2") -Query $strQuery -ErrorAction Stop
}
Finally{
Get-CimSession | Remove-CimSession
$cimsession =$null
$cimSessionOption = $null
}
if($OpsLogixSwiftobject)
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.3rdParty.NiCE.DB2")
{
$IsValidProperties =$false
$strQuery = "select DisplayName from win32_service where Name like 'DB2%' and StartMode != 'Disabled'"
$NiceDB2object = $null
try{
$cimSessionOption = New-CimSessionOption -Protocol DCOM
$cimsession = New-CimSession -SessionOption $cimSessionOption
$NiceDB2object = Get-CimInstance -CimSession $cimsession -Namespace $("root\cimv2") -Query $strQuery -ErrorAction Stop
}
catch
{
$NiceDB2object = Get-WmiObject -Namespace $("root\cimv2") -Query $strQuery -ErrorAction Stop
}
Finally{
Get-CimSession | Remove-CimSession
$cimsession =$null
$cimSessionOption = $null
}
if($NiceDB2object)
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.Power.Management.2012")
{
$IsValidProperties =$false
$strQuery = "select * from Win32_PowerMeter"
$PowerManagement = $null
try{
$cimSessionOption = New-CimSessionOption -Protocol DCOM
$cimsession = New-CimSession -SessionOption $cimSessionOption
$PowerManagement = Get-CimInstance -CimSession $cimsession -Namespace $("root\cimv2\power") -Query $strQuery -ErrorAction Stop
}
catch
{
$PowerManagement = Get-WmiObject -Namespace $("root\cimv2\power") -Query $strQuery -ErrorAction Stop
}
Finally{
Get-CimSession | Remove-CimSession
$cimsession =$null
$cimSessionOption = $null
}
if($PowerManagement)
{
$IsValidProperties =$true
}
}
elseif($className -eq "LW.Microsoft.JEE.WebSphere.8plus.Windows.Configuration")
{
$IsValidProperties =$false
$valid = Check-Websphere 8
if($valid -eq $true)
{
$IsValidProperties =$true
}
else
{ $IsValidPropertie = $false
}
}
elseif($className -eq "LW.Microsoft.JEE.Tomcat.8plus.Windows.Configuration")
{
$IsValidProperties =$false
$valid = Check-Tomcat 8
if($valid -eq $true)
{
$IsValidProperties =$true
}
else
{ $IsValidPropertie = $false
}
}
elseif($className -eq "LW.Microsoft.JEE.Wildfly.8plus.Windows.Configuration")
{
$IsValidProperties =$false
$valid = Check-Wildfly 8
if($valid -eq $true)
{
$IsValidProperties =$true
}
else
{ $IsValidPropertie = $false
}
}
elseif($className -eq "LW.Microsoft.JEE.JBoss.7.Windows.Configuration")
{
$IsValidProperties =$false
$valid = Check-JBoss 7
if($valid -eq $true)
{
$IsValidProperties =$true
}
else
{ $IsValidPropertie = $false
}
}
elseif($className -eq "LW.Microsoft.JEE.WebLogic.12plus.Windows.Configuration")
{
$IsValidProperties =$false
$valid = Check-Weblogic 12
if($valid -eq $true)
{
$IsValidProperties =$true
}
else
{ $IsValidPropertie = $false
}
}
}
}
#getfeaturedetails will be null if supported role in NOT present in installed list
if($IsValidProperties -eq $true -and $classMPElementTable.Item($className) -ne $null)
{
LogWrite "`nCreating class instance for class $className"
$instance = $discoveryData.CreateClassInstance($classMPElementTable.Item($className))
$instance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $computerName)
$instance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $computerName)
$instance.AddProperty("$MPElement[Name='LW.Base.Microsoft.Windows.ComputerRole.Category']/CategoryName$", $classCategoryTable.Item($className))
$instance.AddProperty("$MPElement[Name='LW.Base.Microsoft.Windows.ComputerRole.Category']/GuestOS$", $GuestOS)
$discoveryData.AddInstance($instance)
}
}
}

$scriptEndTime = Get-Date
$totalScriptRunTime = ($scriptEndTime - $scriptStartTime) | select-object TotalSeconds
$totalScriptRunTime = $totalScriptRunTime.TotalSeconds
LogWrite "`n Total time taken to run the script $totalScriptRunTime"

#Log an event after running the script
$api.LogScriptEvent("NonServerRoles.ps1", 5002, 0, $script:logMessage)

#Return discovery property bag
$discoveryData</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>sourceID</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>managedEntityID</Name>
<Value>$Target/Id$</Value>
</Parameter>
<Parameter>
<Name>computerName</Name>
<Value>$Config/ComputerPrincipalName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>$Config/TimeoutSeconds$</TimeoutSeconds>
<StrictErrorHandling>false</StrictErrorHandling>
</ProbeAction>
</MemberModules>
<Composition>
<Node ID="PowerShellDiscoveryProbe">
<Node ID="Scheduler"/>
</Node>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>