Installation Discovery

Microsoft.KnowledgeServices.Exchange.2010.InstallationDiscovery (Discovery)

Element properties:

TargetMicrosoft.KnowledgeServices.Exchange.2010.ExchangePowerShellSnapIn
EnabledTrue
Frequency44081
RemotableFalse

Object Discovery Details:

Discovered Classes and their attribuets:

Member Modules:

ID Module Type TypeId RunAs 
DS DataSource Microsoft.Windows.TimedPowerShell.DiscoveryProvider Default

Source Code:

<Discovery ID="Microsoft.KnowledgeServices.Exchange.2010.InstallationDiscovery" Enabled="true" Target="MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.ExchangePowerShellSnapIn" ConfirmDelivery="true" Remotable="true" Priority="Normal">
<Category>Discovery</Category>
<DiscoveryTypes>
<DiscoveryClass TypeID="MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation"/>
</DiscoveryTypes>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>44081</IntervalSeconds>
<SyncTime/>
<ScriptName>ExchangeInstallationDiscovery.ps1</ScriptName>
<ScriptBody><Script>
param($SourceId,$ManagedEntityId,$KeyPropertyPrincipalName)

$ErrorActionPreference = "Continue"

# Set up the arguments
$scriptargs = new-object psobject
$scriptargs | add-member NoteProperty "SourceId" $SourceId
$scriptargs | add-member NoteProperty "ManagedEntityId" $ManagedEntityId
$scriptargs | add-member NoteProperty "KeyPropertyPrincipalName" $KeyPropertyPrincipalName

# Set up the discovery output
$discoveryoutput = new-object psobject
$discoveryoutput | add-member NoteProperty "OSVersionMajor" ""
$discoveryoutput | add-member NoteProperty "OSVersionMinor" ""
$discoveryoutput | add-member NoteProperty "OSVersionBuild" ""
$discoveryoutput | add-member NoteProperty "OSSystem32Folder" ""

# Exchange 2010 Server Win32_OperatingSystem Properties
$discoveryoutput | add-member NoteProperty "OSCaption" ""
$discoveryoutput | add-member NoteProperty "OSDebug" ""
$discoveryoutput | add-member NoteProperty "OSFreePhysicalMemory" ""
$discoveryoutput | add-member NoteProperty "OSMaxProcessMemorySize" ""
$discoveryoutput | add-member NoteProperty "OSOSLanguage" ""
$discoveryoutput | add-member NoteProperty "OSServicePackMajorVersion" ""
$discoveryoutput | add-member NoteProperty "OSVersion" ""
$discoveryoutput | add-member NoteProperty "OSWindowsDirectory" ""

# Exchange 2010 Server Win32_ComputerSystem Properties
$discoveryoutput | add-member NoteProperty "CSManufacturer" ""
$discoveryoutput | add-member NoteProperty "CSModel" ""
$discoveryoutput | add-member NoteProperty "CSName" ""
$discoveryoutput | add-member NoteProperty "CSNumberOfProcessors" ""
$discoveryoutput | add-member NoteProperty "CSNumberOfLogicalProcessors" ""
$discoveryoutput | add-member NoteProperty "CSTotalPhysicalMemory" ""
$discoveryoutput | add-member NoteProperty "InstallPath" ""
$discoveryoutput | add-member NoteProperty "SetupProductMajor" ""
$discoveryoutput | add-member NoteProperty "SetupProductMinor" ""
$discoveryoutput | add-member NoteProperty "SetupProductBuild" ""
$discoveryoutput | add-member NoteProperty "SetupProductPrivate" ""
$discoveryoutput | add-member NoteProperty "SetupProductVersion" ""
$discoveryoutput | add-member NoteProperty "SetupLatestRollupInstalled" ""
$discoveryoutput | add-member NoteProperty "SetupInterimUpdate" ""
$discoveryoutput | add-member NoteProperty "InstallPath" ""

$discoveryoutput | add-member NoteProperty "exMapi32dllFileVersion" ""

#-----------------------------------------------------
# Environment
#-----------------------------------------------------

$ScriptEnv = new-object psobject

$ScriptEnv | add-member ScriptMethod "GetWin32OSWMIClass" -value {
Get-WmiObject -Class Win32_OperatingSystem -ComputerName "."
}

$ScriptEnv | Add-Member ScriptMethod "GetWin32CSWMIClass" -Value {
Get-WmiObject -Class Win32_ComputerSystem -ComputerName "."
}

$ScriptEnv | add-member ScriptMethod "GetOSEnvironmentVersion" -value {
[Environment]::OSVersion.Version
}

$ScriptEnv | Add-Member ScriptMethod "GetExchInstallPath" -Value {
(Get-ItemProperty HKLM:SOFTWARE\Microsoft\ExchangeServer\v14\Setup).MsiInstallPath
}

$ScriptEnv | Add-Member ScriptMethod "GetSetupFileVersionInfo" -Value {
[System.Diagnostics.FileVersionInfo]::GetVersionInfo((Join-Path -Path (Get-ItemProperty HKLM:SOFTWARE\Microsoft\ExchangeServer\v14\Setup).MsiInstallPath -ChildPath "bin\exsetup.exe"))
}

$ScriptEnv | Add-Member ScriptMethod "GetSetupRegKey" -Value {
Get-ItemProperty HKLM:SOFTWARE\Microsoft\ExchangeServer\v14\Setup
}

function GetFileVersionInfo ($filePath){
If (Test-Path $filePath)
{
$FVInfo = [System.Diagnostics.FileVersionInfo]::GetVersionInfo($filePath)
return $FVInfo
}
Else
{
return "0"
}
}

#-----------------------------------------------------
# Main Discovery Function
#-----------------------------------------------------
function AdvisorDiscovery($ScriptArgs, $DiscoveryOutput)
{
$Win32OSClass = $ScriptEnv.GetWin32OSWMIClass()
$Win32CSClass = $ScriptEnv.GetWin32CSWMIClass()
$OSVersion = $ScriptEnv.GetOSEnvironmentVersion()
$SetupFileVersionInfo = $ScriptEnv.GetSetupFileVersionInfo()
$SetupRegKey = $ScriptEnv.GetSetupRegKey()

$DiscoveryOutput.OSVersionMajor = $OSVersion.Major
$DiscoveryOutput.OSVersionMinor = $OSVersion.Minor
$DiscoveryOutput.OSVersionBuild = $OSVersion.Build
$DiscoveryOutput.OSSystem32Folder = $Win32OSClass.SystemDirectory

# Exchange 2010 Server Win32_OperatingSystem Properties
$DiscoveryOutput.OSCaption = $Win32OSClass.Caption
$DiscoveryOutput.OSDebug = $Win32OSClass.Debug
$DiscoveryOutput.OSFreePhysicalMemory = $Win32OSClass.FreePhysicalMemory.ToString()
$DiscoveryOutput.OSMaxProcessMemorySize = $Win32OSClass.MaxProcessMemorySize.ToString()
$DiscoveryOutput.OSOSLanguage = $Win32OSClass.OSLanguage
$DiscoveryOutput.OSServicePackMajorVersion = $Win32OSClass.ServicePackMajorVersion
$DiscoveryOutput.OSVersion = $Win32OSClass.Version
$DiscoveryOutput.OSWindowsDirectory = $Win32OSClass.WindowsDirectory

# Exchange 2010 Server Win32_ComputerSystem Properties
$DiscoveryOutput.CSManufacturer = $Win32CSClass.Manufacturer
$DiscoveryOutput.CSModel = $Win32CSClass.Model
$DiscoveryOutput.CSName = $Win32CSClass.Name
$DiscoveryOutput.CSNumberOfProcessors = $Win32CSClass.NumberOfProcessors
$DiscoveryOutput.CSNumberOfLogicalProcessors = $Win32CSClass.NumberOfLogicalProcessors
$DiscoveryOutput.CSTotalPhysicalMemory = $Win32CSClass.TotalPhysicalMemory.ToString()
$DiscoveryOutput.InstallPath = $ScriptEnv.GetExchInstallPath()

# Exchange 2010 Server ExSetup Properties
$DiscoveryOutput.SetupProductVersion = $SetupFileVersionInfo.ProductVersion
$DiscoveryOutput.SetupProductMajor = $SetupFileVersionInfo.ProductMajorPart
$DiscoveryOutput.SetupProductMinor = $SetupFileVersionInfo.ProductMinorPart
$DiscoveryOutput.SetupProductBuild = $SetupFileVersionInfo.ProductBuildPart
$DiscoveryOutput.SetupProductPrivate = $SetupFileVersionInfo.ProductPrivatePart
$DiscoveryOutput.SetupLatestRollupInstalled = $SetupRegKey.LatestRollupInstalled
$DiscoveryOutput.SetupInterimUpdate = $SetupRegKey.InterimUpdate

$DiscoveryOutput.exMapi32dllFileVersion = (GetFileVersionInfo((Get-ItemProperty HKLM:SOFTWARE\Clients\Mail\ExchangeMAPI).DLLPathEx)).FileVersion

}

# Create a new discovery data packet
$oAPI = new-object -comObject "MOM.ScriptAPI"
$discoverydata = $oAPI.CreateDiscoveryData(0, $scriptargs.SourceId, $scriptargs.ManagedEntityId)

AdvisorDiscovery $scriptargs $discoveryoutput

$installInstance = $discoverydata.CreateClassInstance("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']$")
$installInstance.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $scriptargs.KeyPropertyPrincipalName)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/InstallPath$", $discoveryoutput.InstallPath)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/SetupProductMajor$", $discoveryoutput.SetupProductMajor)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/SetupProductMinor$", $discoveryoutput.SetupProductMinor)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/SetupProductBuild$", $discoveryoutput.SetupProductBuild)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/SetupProductPrivate$", $discoveryoutput.SetupProductPrivate)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/SetupProductVersion$", $discoveryoutput.SetupProductVersion)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/SetupLatestRollupInstalled$", $discoveryoutput.SetupLatestRollupInstalled)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/SetupInterimUpdate$", $discoveryoutput.SetupInterimUpdate)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/exMapi32dllFileVersion$", $discoveryoutput.exMapi32dllFileVersion)

$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/OSVersionMajor$", $discoveryoutput.OSVersionMajor)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/OSVersionMinor$", $discoveryOutput.OSVersionMinor)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/OSVersionBuild$", $DiscoveryOutput.OSVersionBuild)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/OSSystem32Folder$", $DiscoveryOutput.OSSystem32Folder)

# Exchange 2010 Server Win32_OperatingSystem Properties
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/OSCaption$", $DiscoveryOutput.OSCaption)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/OSDebug$", $DiscoveryOutput.OSDebug)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/OSFreePhysicalMemory$", $DiscoveryOutput.OSFreePhysicalMemory)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/OSMaxProcessMemorySize$", $DiscoveryOutput.OSMaxProcessMemorySize)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/OSOSLanguage$", $DiscoveryOutput.OSOSLanguage)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/OSServicePackMajorVersion$", $DiscoveryOutput.OSServicePackMajorVersion)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/OSVersion$", $DiscoveryOutput.OSVersion)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/OSWindowsDirectory$", $DiscoveryOutput.OSWindowsDirectory)

# Exchange 2010 Server Win32_ComputerSystem Properties
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/CSManufacturer$", $DiscoveryOutput.CSManufacturer)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/CSModel$", $DiscoveryOutput.CSModel)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/CSName$", $DiscoveryOutput.CSName)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/CSNumberOfProcessors$", $DiscoveryOutput.CSNumberOfProcessors)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/CSNumberOfLogicalProcessors$", $DiscoveryOutput.CSNumberOfLogicalProcessors)
$installInstance.AddProperty("$MPElement[Name='MKSE2K10Lib!Microsoft.KnowledgeServices.Exchange.2010.Installation']/CSTotalPhysicalMemory$", $DiscoveryOutput.CSTotalPhysicalMemory)

$installInstance.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $DiscoveryOutput.CSName)

$discoverydata.AddInstance($installInstance)

$discoverydata

</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>SourceId</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>ManagedEntityId</Name>
<Value>$Target/Id$</Value>
</Parameter>
<Parameter>
<Name>KeyPropertyPrincipalName</Name>
<Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>300</TimeoutSeconds>
<StrictErrorHandling>true</StrictErrorHandling>
</DataSource>
</Discovery>