Discover index location dependencies

Veritas.EnterpriseVault.12.IndexLocationDependencies.DiscoveryDS (DataSourceModuleType)

Script for discovering index location dependencies.

Element properties:

TypeDataSourceModuleType
IsolationAny
AccessibilityPublic
RunAsDefault
OutputTypeSystem.Discovery.Data

Member Modules:

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

Overrideable Parameters:

IDParameterTypeSelector
IntervalSecondsint$Config/IntervalSeconds$
LogDebugEventbool$Config/LogDebugEvent$

Source Code:

<DataSourceModuleType ID="Veritas.EnterpriseVault.12.IndexLocationDependencies.DiscoveryDS" Accessibility="Public" Batching="false">
<Configuration>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="IntervalSeconds" type="xsd:integer"/>
<xsd:element xmlns:xsd="http://www.w3.org/2001/XMLSchema" minOccurs="1" name="LogDebugEvent" type="xsd:boolean"/>
</Configuration>
<OverrideableParameters>
<OverrideableParameter ID="IntervalSeconds" Selector="$Config/IntervalSeconds$" ParameterType="int"/>
<OverrideableParameter ID="LogDebugEvent" Selector="$Config/LogDebugEvent$" ParameterType="bool"/>
</OverrideableParameters>
<ModuleImplementation Isolation="Any">
<Composite>
<MemberModules>
<DataSource ID="DS" TypeID="Windows!Microsoft.Windows.TimedPowerShell.DiscoveryProvider">
<IntervalSeconds>$Config/IntervalSeconds$</IntervalSeconds>
<SyncTime/>
<ScriptName>VeritasEnterpriseVaultDiscoverIndexLocationDependencies.ps1</ScriptName>
<ScriptBody><Script>
param($sourceId, $managedEntityId, $indexLocationEntryId, $indexLocationPath, $principalName, $logDebugEvent)
#
# (c) 2016 Veritas Technologies LLC. All rights reserved.
#
# THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE SECRETS OF VERITAS
# TECHNOLOGIES LLC. USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED
# WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF VERITAS TECHNOLOGIES LLC.
#
# The Licensed Software and Documentation are deemed to be commercial computer
# software as defined in FAR 12.212 and subject to restricted rights as defined
# in FAR Section 52.227-19 "Commercial Computer Software - Restricted Rights"
# and DFARS 227.7202, Rights in "Commercial Computer Software or Commercial
# Computer Software Documentation," as applicable, and any successor regulations,
# whether delivered by Veritas Technologies LLC as on premises or hosted
# services. Any use, modification, reproduction release, performance, display or
# disclosure of the Licensed Software and Documentation by the U.S. Government
# shall be solely in accordance with the terms of this Agreement.
#


# Constants for event logging
Set-Variable EVENT_LEVEL_ERROR -Option Constant -Value 1
Set-Variable EVENT_LEVEL_WARNING -Option Constant -Value 2
Set-Variable EVENT_LEVEL_INFO -Option Constant -Value 4

# Constants for IDs
Set-Variable const_siteCommonId -Option Constant -Value 'Common'
Set-Variable const_siteIndexingId -Option Constant -Value 'Indexing'
Set-Variable const_serverIndexingId -Option Constant -Value 'Indexing'
Set-Variable const_serverIndexLocations -Option Constant -Value 'Server.IndexLocations'
Set-Variable const_serverCommonId -Option Constant -Value 'Common'
Set-Variable const_commonDiskSpaceId -Option Constant -Value 'Common Disk Space'
Set-Variable const_commonServicesId -Option Constant -Value 'Common Services'
Set-Variable const_indexLocationDiskSpaceId -Option Constant -Value 'Index Location Disk Space'
Set-Variable const_indexLocationConnectivityId -Option Constant -Value 'Index Location Connectivity'
Set-Variable const_indexLocationsConnectivityId -Option Constant -Value 'Index Locations Connectivity'
Set-Variable const_serverCommonConnectivityId -Option Constant -Value 'Server Connectivity'
Set-Variable const_serverIndexLocationsId -Option Constant -Value 'Server.IndexLocations'
Set-Variable const_commonDatabasesId -Option Constant -Value 'CommonDatabases'
Set-Variable const_directoryDatabaseConnectivityId -Option Constant -Value 'Directory Database Connectivity'
Set-Variable const_auditDatabaseConnectivityId -Option Constant -Value 'Audit Database Connectivity'
Set-Variable const_monitoringDatabaseConnectivityId -Option Constant -Value 'Monitoring Database Connectivity'
Set-Variable const_directoryDatabaseDiskSpaceId -Option Constant -Value 'Directory Database Disk Space'
Set-Variable const_auditDatabaseDiskSpaceId -Option Constant -Value 'Audit Database Disk Space'
Set-Variable const_monitoringDatabaseDiskSpaceId -Option Constant -Value 'Monitoring Database Disk Space'
Set-Variable const_directoryDatabaseBackupId -Option Constant -Value 'Directory Database Backup'
Set-Variable const_auditDatabaseBackupId -Option Constant -Value 'Audit Database Backup'
Set-Variable const_monitoringDatabaseBackupId -Option Constant -Value 'Monitoring Database Backup'
Set-Variable const_directoryDatabaseFragmentationId -Option Constant -Value 'Directory Database Fragmentation'
Set-Variable const_backupDirectoryDatabaseBackupId -Option Constant -Value 'Backup Directory Database Backup'
Set-Variable const_backupAuditDatabaseBackupId -Option Constant -Value 'Backup Audit Database Backup'
Set-Variable const_backupMonitoringDatabaseBackupId -Option Constant -Value 'Backup Monitoring Database Backup'
Set-Variable const_serverTargetsExchangeId -Option Constant -Value 'Exchange'
Set-Variable const_serverTargetsSharepointId -Option Constant -Value 'SharePoint'
Set-Variable const_serverTargetsFileSystemId -Option Constant -Value 'File System'
Set-Variable const_serverTargetsDominoId -Option Constant -Value 'Domino'
Set-Variable const_serverTargetsId -Option Constant -Value 'Server.Targets'
Set-Variable const_siteTargetsFileSystemId -Option Constant -Value 'Site.Targets.FileSystem'
Set-Variable const_siteTargetsDominoId -Option Constant -Value 'Site.Targets.Domino'
Set-Variable const_siteTargetsSharepointId -Option Constant -Value 'Site.Targets.Sharepoint'
Set-Variable const_siteTargetsExchangeId -Option Constant -Value 'Site.Targets.Exchange'
Set-Variable const_siteTargetsOthersId -Option Constant -Value 'Site.Targets.Others'
Set-Variable const_siteTargetsSMTPId -Option Constant -Value 'Site.Targets.SMTP'
Set-Variable const_serverTargetsOthersId -Option Constant -Value 'Others'
Set-Variable const_serverTargetsSMTPId -Option Constant -Value 'SMTP'
Set-Variable const_siteTargetsId -Option Constant -Value 'Targets'
Set-Variable const_siteStorageId -Option Constant -Value 'Storage'
Set-Variable const_serverStorageId -Option Constant -Value 'Storage'
Set-Variable const_storageDatabasesId -Option Constant -Value 'StorageDatabases'
Set-Variable const_vaultStoreDatabaseBackupId -Option Constant -Value 'Vault Store Database Backup'
Set-Variable const_fingerprintDatabaseBackupId -Option Constant -Value 'Fingerprint Database Backup'
Set-Variable const_backupVaultStoreDatabaseBackupId -Option Constant -Value 'Backup Vault Store Database Backup'
Set-Variable const_backupFingerprintDatabaseBackupId -Option Constant -Value 'Backup Fingerprint Database Backup'
Set-Variable const_serverStorageDatabasesConnectivityId -Option Constant -Value 'Databases Connectivity'
Set-Variable const_commonDatabaseConnectivityId -Option Constant -Value 'Common Database Connectivity'
Set-Variable const_storageDatabaseConnectivityId -Option Constant -Value 'Storage Database Connectivity'
Set-Variable const_vaultStoreDatabaseConnectivityId -Option Constant -Value 'Vault Store Database Connectivity'
Set-Variable const_fingerprintDatabaseConnectivityId -Option Constant -Value 'Fingerprint Database Connectivity'
Set-Variable const_vaultStoreDatabaseFragmentationId -Option Constant -Value 'Vault Store Database Fragmentation'
Set-Variable const_fingerprintDatabaseFragmentationId -Option Constant -Value 'Fingerprint Database Fragmentation'
Set-Variable const_vaultStoreDatabaseDiskSpaceId -Option Constant -Value 'Vault Store Database Disk Space'
Set-Variable const_fingerprintDatabaseDiskSpaceId -Option Constant -Value 'Fingerprint Database Disk Space'
Set-Variable const_directoryDatabaseDataFileId -Option Constant -Value 'Directory Database Data File'
Set-Variable const_directoryDatabaseLogFileId -Option Constant -Value 'Directory Database Log File'
Set-Variable const_auditDatabaseDataFileId -Option Constant -Value 'Audit Database Data File'
Set-Variable const_auditDatabaseLogFileId -Option Constant -Value 'Audit Database Log File'
Set-Variable const_monitoringDatabaseDataFileId -Option Constant -Value 'Monitoring Database Data File'
Set-Variable const_monitoringDatabaseLogFileId -Option Constant -Value 'Monitoring Database Log File'
Set-Variable const_vaultStoreDatabaseDataFileId -Option Constant -Value 'Vault Store Database Data File'
Set-Variable const_vaultStoreDatabaseLogFileId -Option Constant -Value 'Vault Store Database Log File'
Set-Variable const_fingerprintDatabaseDataFileId -Option Constant -Value 'Fingerprint Database Data File'
Set-Variable const_fingerprintDatabaseLogFileId -Option Constant -Value 'Fingerprint Database Log File'

# Constants for display strings
Set-Variable const_databaseDataFileType -Option Constant -Value 'Data'
Set-Variable const_databaseLogFileType -Option Constant -Value 'Log'
Set-Variable const_connectivityOn -Option Constant -Value 'Connectivity on '
Set-Variable const_diskSpaceOn -Option Constant -Value 'Disk Space on '
Set-Variable const_backupOn -Option Constant -Value 'Backup on '
Set-Variable const_directoryDatabaseType -Option Constant -Value 'Directory'
Set-Variable const_auditDatabaseType -Option Constant -Value 'Audit'
Set-Variable const_monitoringDatabaseType -Option Constant -Value 'Monitoring'
Set-Variable const_vaultStoreDatabaseType -Option Constant -Value 'Vault Store'
Set-Variable const_fingerprintDatabaseType -Option Constant -Value 'Fingerprint'
Set-Variable const_notAvailable -Option Constant -Value "Not Available"
Set-Variable const_adminService -Option Constant -Value "Admin Service"
Set-Variable const_directoryService -Option Constant -Value "Directory Service"
Set-Variable const_shoppingService -Option Constant -Value "Shopping Service"
Set-Variable const_taskControllerService -Option Constant -Value "Task Controller Service"
Set-Variable const_smtpService -Option Constant -Value "SMTP Service"
Set-Variable const_iisService -Option Constant -Value "IIS Service"
Set-Variable const_msmqService -Option Constant -Value "Message Queuing Service"
Set-Variable const_storageService -Option Constant -Value "Storage Service"
Set-Variable const_notApplicable -Option Constant -Value "Not Applicable"
Set-Variable const_application -Option Constant -Value 'Application'
Set-Variable const_temporary -Option Constant -Value 'Temporary'
Set-Variable const_cache -Option Constant -Value 'Cache'
Set-Variable const_applicationLocation -Option Constant -Value 'Application Location'
Set-Variable const_temporaryLocation -Option Constant -Value 'Temporary Location'
Set-Variable const_cacheLocation -Option Constant -Value 'Cache Location'

Set-Variable const_evDirectoryDatabase -Option Constant -Value "Enterprise Vault Directory Database"
Set-Variable const_evAuditDatabase -Option Constant -Value "Enterprise Vault Audit Database"
Set-Variable const_evMonitoringDatabase -Option Constant -Value "Enterprise Vault Monitoring Database"
Set-Variable const_evVaultStoreDatabase -Option Constant -Value "Enterprise Vault Vault Store Database"
Set-Variable const_evFingerprintDatabase -Option Constant -Value "Enterprise Vault Fingerprint Database"
Set-Variable const_dataFile -Option Constant -Value "Data File"
Set-Variable const_logFile -Option Constant -Value "Log File"
Set-Variable const_connectivity -Option Constant -Value "Connectivity"
Set-Variable const_diskSpace -Option Constant -Value "Disk Space"
Set-Variable const_backup -Option Constant -Value "Backup"
Set-Variable const_fragmentation -Option Constant -Value "Fragmentation"
Set-Variable const_hyphen -Option Constant -Value " - "
Set-Variable const_space -Option Constant -Value " "
Set-Variable const_colon -Option Constant -Value ": "
Set-Variable const_dot -Option Constant -Value "."
Set-Variable const_default -Option Constant -Value "Default"
Set-Variable const_journal -Option Constant -Value "Journal"


Set-Variable const_exchangeMailbox -Option Constant -Value "Exchange Mailbox"
Set-Variable const_exchangeProvisioning -Option Constant -Value "Exchange Provisioning"
Set-Variable const_exchangeJournaling -Option Constant -Value "Exchange Journaling"
Set-Variable const_exchangePublicFolder -Option Constant -Value "Exchange Public Folder"
Set-Variable const_fileSystemArchiving -Option Constant -Value "File System Archiving"
Set-Variable const_sharePoint -Option Constant -Value "SharePoint"
Set-Variable const_dominoMailboxArchiving -Option Constant -Value "Domino Mailbox Archiving"
Set-Variable const_dominoJournaling -Option Constant -Value "Domino Journaling"
Set-Variable const_dominoProvisioning -Option Constant -Value "Domino Provisioning"
Set-Variable const_pstLocator -Option Constant -Value "PST Locator"
Set-Variable const_pstCollector -Option Constant -Value "PST Collector"
Set-Variable const_pstMigrator -Option Constant -Value "PST Migrator"
Set-Variable const_moveArchive -Option Constant -Value "Move Archive"
Set-Variable const_indexAdministration -Option Constant -Value "Index Administration"
Set-Variable const_clientAccessProvisioning -Option Constant -Value "Client Access Provisioning"
Set-Variable const_smtpArchiving -Option Constant -Value "SMTP Archiving"

Set-Variable const_yes -Option Constant -Value "Yes"
Set-Variable const_no -Option Constant -Value "No"
Set-Variable const_none -Option Constant -Value "None"

# Vault Store strings
Set-Variable const_vaultStoreStatusAvailable -Option Constant -Value "Available"
Set-Variable const_vaultStoreStatusMarkedForDeletion -Option Constant -Value "Marked for deletion"
Set-Variable const_vaultStoreStatusBeingCreated -Option Constant -Value "Being created"
Set-Variable const_vaultStoreSharingLevelNoSharing -Option Constant -Value "No sharing"
Set-Variable const_vaultStoreSharingLevelShareWithinGroup -Option Constant -Value "Share within group"
Set-Variable const_vaultStoreSharingLevelShareWithinVaultStore -Option Constant -Value "Share within Vault Store"
Set-Variable const_vaultStoreRemovalStatusRetainUntilBackup -Option Constant -Value "Retain until backup"
Set-Variable const_vaultStoreRemovalStatusRetainInStorageQueue -Option Constant -Value "Retain in storage queue"
Set-Variable const_vaultStoreRemovalStatusRemoveImmediatelyAfterArchive -Option Constant -Value "Remove immediately after archive"
Set-Variable const_vaultStoreRemovalStatusDoNotRemoveOriginalItems -Option Constant -Value "Do not remove original items"
Set-Variable const_vaultStoreSafetyCopyProperty -Option Constant -Value "SafetyCopy"
Set-Variable const_vaultStoreJournalSafetyCopyProperty -Option Constant -Value "JournalSafetyCopy"
Set-Variable const_notAvailableFromOlderVersionsOfEnterpriseVault -Option Constant -Value "Not available from older versions of Enterprise Vault"

# Vault Store Partition strings
Set-Variable const_vaultStorePartitionsConnectivityId -Option Constant -Value 'Vault Store Partitions Connectivity'
Set-Variable const_serverVaultStorePartitions -Option Constant -Value 'Server.VaultStorePartitions'
Set-Variable const_vaultStorePartitionConnectivity -Option Constant -Value "Vault Store Partition Connectivity"
Set-Variable const_vaultStorePartitionBackup -Option Constant -Value "Vault Store Partition Backup"
Set-Variable const_vaultStorePartitionDiskSpace -Option Constant -Value "Vault Store Partition Disk Space"
Set-Variable const_vaultStorePartitionStatusOpen -Option Constant -Value "Open"
Set-Variable const_vaultStorePartitionStatusClosed -Option Constant -Value "Closed"
Set-Variable const_vaultStorePartitionStatusReady -Option Constant -Value "Ready"
Set-Variable const_vaultStorePartitionStatusBeingDeleted -Option Constant -Value "Being Deleted"
Set-Variable const_vaultStorePartitionRolloverNotEnabled -Option Constant -Value "Not Enabled"
Set-Variable const_vaultStorePartitionRolloverEnabledBasedOnVolume -Option Constant -Value "Enabled based on volume"
Set-Variable const_vaultStorePartitionRolloverEnabledBasedOnTime -Option Constant -Value "Enabled based on time"
Set-Variable const_vaultStorePartitionRolloverEnabledBasedOnTimeOrVolume -Option Constant -Value "Enabled based on time or volume"

# SMTP Holding Folder strings
Set-Variable const_smtpHoldingFolderConnectivityId -Option Constant -Value 'SMTP Holding Folder Connectivity'
Set-Variable const_smtpHoldingFolderDiskSpaceId -Option Constant -Value 'SMTP Holding Folder Disk Space'
#
# (c) 2016 Veritas Technologies LLC. All rights reserved.
#
# THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE SECRETS OF VERITAS
# TECHNOLOGIES LLC. USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED
# WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF VERITAS TECHNOLOGIES LLC.
#
# The Licensed Software and Documentation are deemed to be commercial computer
# software as defined in FAR 12.212 and subject to restricted rights as defined
# in FAR Section 52.227-19 "Commercial Computer Software - Restricted Rights"
# and DFARS 227.7202, Rights in "Commercial Computer Software or Commercial
# Computer Software Documentation," as applicable, and any successor regulations,
# whether delivered by Veritas Technologies LLC as on premises or hosted
# services. Any use, modification, reproduction release, performance, display or
# disclosure of the Licensed Software and Documentation by the U.S. Government
# shall be solely in accordance with the terms of this Agreement.
#



# -----------------------------------------------------------
# Script containing common functions required by SCOM Scripts
# -----------------------------------------------------------

# Set strict mode on to Latest to
# -- Prohibits references to uninitialized variables, except for uninitialized variables in strings.
Set-StrictMode -Version 1;

Function Log-DebugEvent
{
param($scriptName,$message, $eventNo, $event_level, $logDebugEvent)

$message = "`n" + $message
if ($logDebugEvent -eq $true)
{
$api.LogScriptEvent($scriptName, $eventNo, $event_level, $message)
}
}

# Handle error
Function HandleError
{
param($err)
if ($err)
{
throw $err
}
}

# Checks if OS architecture is x64
Function Isx64PC
{
# Check if x86 or x64 based PC, and get 'FullVersion' registry value
$architecture = (gwmi Win32_ComputerSystem).SystemType

if ( $architecture -like 'x64*' )
{
return $true
}
elseif ( $architecture -like 'x86*' )
{
return $false
}

throw 'Invalid OS Architecture'
}

# Returns EV registry key
Function GetEVRegKey
{
$regKey = 'HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\KVS\Enterprise Vault'

if ( Isx64PC -eq "True" )
{
$regKey = 'HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\KVS\Enterprise Vault'
}

return $regKey
}

# Returns string of requested registry value
Function GetRegString
{
param([string]$key, [string]$subKey, [string]$regValue)
return ((Get-ItemProperty ($key + $subKey)).$regValue)
}

# Loads given PowerShell SnapIn
Function LoadPSSnapin
{
param([string]$moduleName, $logDebugEvent)
$evInstallPath = GetRegString (GetEVRegKey) '\Install' 'InstallPath'
$modulePath = $evInstallPath + $moduleName + '.dll'

$message = "Adding PS module '" + $moduleName + "'."
Log-DebugEvent $SCRIPT_NAME $message 20 $EVENT_LEVEL_INFO $logDebugEvent

if ( (Get-Module -Name $moduleName -ErrorAction SilentlyContinue) -eq $null )
{
$message = "Module Path'" + $modulePath + "'."
Log-DebugEvent $SCRIPT_NAME $message 20 $EVENT_LEVEL_INFO $logDebugEvent

Import-Module $modulePath -errorvariable err
HandleError $err
}
}

# Populate ComputerEntryIDs for EV Server.
Function PopulateComputerEntryIds
{
param($evServer)

# Prepare Computer Entry Ids string
$computerEntryIDs = ""
if ($evServer.PSObject.Properties.Match('ComputerEntryIds').Count)
{
foreach ($entryId in $evServer.ComputerEntryIds)
{
if ($computerEntryIDs -ne "")
{
$computerEntryIDs += ", "
}
$computerEntryIDs += $entryId
}
}
else
{
$computerEntryIDs = $evServer.ID
}

return $computerEntryIDs
}

# Checks if EV Server version is based on input parameters
Function IsEVVersion
{
param([int]$majorVer, [int]$minorVer, [int]$servicePackVer)

# Get EV Server version
if ( ( $evVersion = GetRegString (GetEVRegKey) '\Install' 'FullVersion' -ErrorAction SilentlyContinue ) -eq $null )
{
return $null
}

$evVersionArr = $evVersion.Split(".")

if ( [System.Convert]::ToInt32($evVersionArr[0]) -eq $majorVer )
{
return $true
}
elseif ( [System.Convert]::ToInt32($evVersionArr[0]) -eq $majorVer -and [System.Convert]::ToInt32($evVersionArr[1]) -eq $minorVer )
{
return $true
}
elseif ( [System.Convert]::ToInt32($evVersionArr[0]) -eq $majorVer -and [System.Convert]::ToInt32($evVersionArr[1]) -eq $minorVer -and [System.Convert]::ToInt32($evVersionArr[2]) -eq $servicePackVer )
{
return $true
}

return $false
}#
# (c) 2016 Veritas Technologies LLC. All rights reserved.
#
# THIS SOFTWARE CONTAINS CONFIDENTIAL INFORMATION AND TRADE SECRETS OF VERITAS
# TECHNOLOGIES LLC. USE, DISCLOSURE OR REPRODUCTION IS PROHIBITED
# WITHOUT THE PRIOR EXPRESS WRITTEN PERMISSION OF VERITAS TECHNOLOGIES LLC.
#
# The Licensed Software and Documentation are deemed to be commercial computer
# software as defined in FAR 12.212 and subject to restricted rights as defined
# in FAR Section 52.227-19 "Commercial Computer Software - Restricted Rights"
# and DFARS 227.7202, Rights in "Commercial Computer Software or Commercial
# Computer Software Documentation," as applicable, and any successor regulations,
# whether delivered by Veritas Technologies LLC as on premises or hosted
# services. Any use, modification, reproduction release, performance, display or
# disclosure of the Licensed Software and Documentation by the U.S. Government
# shall be solely in accordance with the terms of this Agreement.
#



$SCRIPT_NAME = 'IndexLocationDependenciesDiscovery.ps1'


Function DiscoverIndexLocationDependencies
{
$functionName = 'Function: DiscoverIndexLocationDependencies'

$discoveryData = $api.CreateDiscoveryData(0, $sourceId, $managedEntityId)

$message = $functionName + "`nCreating Veritas.EnterpriseVault.12.IndexLocationDiskSpace object."
Log-DebugEvent $SCRIPT_NAME $message 20 $EVENT_LEVEL_INFO $logDebugEvent

# Create IndexLocationDiskSpace object
$indexLocationDiskSpace = $discoveryData.CreateClassInstance("$MPElement[Name='Veritas.EnterpriseVault.12.IndexLocationDiskSpace']$")
$indexLocationDiskSpace.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $const_indexLocationDiskSpaceId)
$indexLocationDiskSpace.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $principalName)
$indexLocationDiskSpace.AddProperty("$MPElement[Name='Veritas.EnterpriseVault.12.IndexLocationBase']/EntryId$", $indexLocationEntryId)
$indexLocationDiskSpace.AddProperty("$MPElement[Name='Veritas.EnterpriseVault.12.DiskSpace']/Id$", $const_indexLocationDiskSpaceId)
$locationTrimed = $indexLocationPath.trimstart("\")
$indexLocationDiskSpace.AddProperty("$MPElement[Name='Veritas.EnterpriseVault.12.IndexLocationDiskSpace']/Location$", $locationTrimed )

$message = $functionName + "`nCreating Veritas.EnterpriseVault.12.Server.IndexLocations object."
Log-DebugEvent $SCRIPT_NAME $message 20 $EVENT_LEVEL_INFO $logDebugEvent

# Create Server.IndexLocations object
$serverIndexLocations = $discoveryData.CreateClassInstance("$MPElement[Name='Veritas.EnterpriseVault.12.Server.IndexLocations']$")
$serverIndexLocations.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $const_serverIndexLocationsId)
$serverIndexLocations.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $principalName)
$serverIndexLocations.AddProperty("$MPElement[Name='Veritas.EnterpriseVault.12.Server.IndexLocations']/Id$", $const_serverIndexLocationsId)


$message = $functionName + "`nCreating Veritas.EnterpriseVault.12.ServerIndexLocationsContainsIndexLocationDiskSpace relationship."
Log-DebugEvent $SCRIPT_NAME $message 20 $EVENT_LEVEL_INFO $logDebugEvent

# Create ServerIndexLocationsContainsIndexLocationDiskSpace object
$serverIndexLocationsContainsIndexLocationDiskSpace = $discoveryData.CreateRelationshipInstance("$MPElement[Name='Veritas.EnterpriseVault.12.ServerIndexLocationsContainsIndexLocationDiskSpace']$")
$serverIndexLocationsContainsIndexLocationDiskSpace.Source = $serverIndexLocations
$serverIndexLocationsContainsIndexLocationDiskSpace.Target = $indexLocationDiskSpace

$message = $functionName + "`nCreating Veritas.EnterpriseVault.12.IndexLocationConnectivity object."
Log-DebugEvent $SCRIPT_NAME $message 20 $EVENT_LEVEL_INFO $logDebugEvent

# Create IndexLocationConnectivity object
$indexLocationConnectivity = $discoveryData.CreateClassInstance("$MPElement[Name='Veritas.EnterpriseVault.12.IndexLocationConnectivity']$")
$indexLocationConnectivity.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $const_indexLocationConnectivityId)
$indexLocationConnectivity.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $principalName)
$indexLocationConnectivity.AddProperty("$MPElement[Name='Veritas.EnterpriseVault.12.IndexLocationBase']/EntryId$", $indexLocationEntryId)
$indexLocationConnectivity.AddProperty("$MPElement[Name='Veritas.EnterpriseVault.12.Connectivity']/Id$", $const_indexLocationConnectivityId)

$locationTrimed = $indexLocationPath.trimstart("\")
$message = "location trimed :" + $locationTrimed
Log-DebugEvent $SCRIPT_NAME $message 20 $EVENT_LEVEL_INFO $logDebugEvent
$indexLocationConnectivity.AddProperty("$MPElement[Name='Veritas.EnterpriseVault.12.IndexLocationConnectivity']/Location$", $locationTrimed )

# Get computer entry id, which is not available in the hosting parent(s)
LoadPSSnapin 'Symantec.EnterpriseVault.PowerShell.Core' $logDebugEvent
$evServer = Get-EVServer -errorvariable err
HandleError $err

$computerEntryIDs = PopulateComputerEntryIds($evServer)
$indexingId = $const_serverIndexingId

# To set IndexLocationsConnectivityContainsIndexLocationConnectivity relationship we need to re-discover Veritas.EnterpriseVault.12.IndexLocationsConnectivity object.

$message = $functionName + "`nCreating Veritas.EnterpriseVault.12.IndexLocationsConnectivity object."
Log-DebugEvent $SCRIPT_NAME $message 20 $EVENT_LEVEL_INFO $logDebugEvent

# Create IndexLocationsConnectivity object
$indexLocationsConnectivity = $discoveryData.CreateClassInstance("$MPElement[Name='Veritas.EnterpriseVault.12.IndexLocationsConnectivity']$")
$indexLocationsConnectivity.AddProperty("$MPElement[Name='System!System.Entity']/DisplayName$", $const_indexLocationsConnectivityId)
$indexLocationsConnectivity.AddProperty("$MPElement[Name='Windows!Microsoft.Windows.Computer']/PrincipalName$", $principalName)
$indexLocationsConnectivity.AddProperty("$MPElement[Name='Veritas.EnterpriseVault.12.Server']/EntryId$", $computerEntryIDs)
$indexLocationsConnectivity.AddProperty("$MPElement[Name='Veritas.EnterpriseVault.12.Server.Indexing']/Id$", $indexingId)
$indexLocationsConnectivity.AddProperty("$MPElement[Name='Veritas.EnterpriseVault.12.IndexLocationsConnectivity']/Id$", $const_indexLocationsConnectivityId)


$message = $functionName + "`nCreating Veritas.EnterpriseVault.12.IndexLocationsConnectivityContainsIndexLocationConnectivity relationship."
Log-DebugEvent $SCRIPT_NAME $message 20 $EVENT_LEVEL_INFO $logDebugEvent

# Create IndexLocationsConnectivityContainsIndexLocationConnectivity object
$indexLocationsConnectivityContainsIndexLocationConnectivityRelDiscovery = $discoveryData.CreateRelationshipInstance("$MPElement[Name='Veritas.EnterpriseVault.12.IndexLocationsConnectivityContainsIndexLocationConnectivity']$")
$indexLocationsConnectivityContainsIndexLocationConnectivityRelDiscovery.Source = $indexLocationsConnectivity
$indexLocationsConnectivityContainsIndexLocationConnectivityRelDiscovery.Target = $indexLocationConnectivity

$discoveryData.AddInstance($indexLocationDiskSpace)
$discoveryData.AddInstance($serverIndexLocations)
$discoveryData.AddInstance($serverIndexLocationsContainsIndexLocationDiskSpace)
$discoveryData.AddInstance($indexLocationConnectivity)
$discoveryData.AddInstance($indexLocationsConnectivityContainsIndexLocationConnectivityRelDiscovery)

$discoveryData
}

Try
{
$api = new-object -comObject &#x2018;MOM.ScriptAPI&#x2019;
$message = 'Discovery of IndexLocation dependencies has started.'
Log-DebugEvent $SCRIPT_NAME $message 20 $EVENT_LEVEL_INFO $logDebugEvent

DiscoverIndexLocationDependencies

$message = 'Discovery of IndexLocation dependencies is complete.'
Log-DebugEvent $SCRIPT_NAME $message 20 $EVENT_LEVEL_INFO $logDebugEvent
}
Catch [system.exception]
{
# Log exception irrespective of Debug mode is on/off
$message = 'Error in discovery of IndexLocation dependencies.' + "`n" + 'Error: ' + $_
Log-DebugEvent $SCRIPT_NAME $message 20 $EVENT_LEVEL_ERROR true
}
</Script></ScriptBody>
<Parameters>
<Parameter>
<Name>sourceID</Name>
<Value>$MPElement$</Value>
</Parameter>
<Parameter>
<Name>managedEntityID</Name>
<Value>$Target/Id$</Value>
</Parameter>
<Parameter>
<Name>indexLocationEntryId</Name>
<Value>$Target/Property[Type="Veritas.EnterpriseVault.12.IndexLocationBase"]/EntryId$</Value>
</Parameter>
<Parameter>
<Name>indexLocationPath</Name>
<Value>$Target/Property[Type="Veritas.EnterpriseVault.12.IndexLocationBase"]/Location$</Value>
</Parameter>
<Parameter>
<Name>principalName</Name>
<Value>$Target/Host/Property[Type="Windows!Microsoft.Windows.Computer"]/PrincipalName$</Value>
</Parameter>
<Parameter>
<Name>logDebugEvent</Name>
<Value>$Config/LogDebugEvent$</Value>
</Parameter>
</Parameters>
<TimeoutSeconds>300</TimeoutSeconds>
</DataSource>
</MemberModules>
<Composition>
<Node ID="DS"/>
</Composition>
</Composite>
</ModuleImplementation>
<OutputType>System!System.Discovery.Data</OutputType>
</DataSourceModuleType>