Orphaned Lfx Connectors

Please dont run in production.  This was part of test environment to investigate how to identify and correct Orphaned Lfx Connectors.

  1. Run the following to identify if you Management Servers have orphaned connector objects.  You will noticed that if you run get-scsmconnector, you will not receive the same level of detail.
#
Set-ExecutionPolicy Unrestricted
import-module -force 'C:\Program Files\Microsoft System Center 2012 R2\Service Manager\Powershell\System.Center.Service.Manager.psd1'
import-module -force 'C:\Program Files\Microsoft System Center 2012 R2\Service Manager\Microsoft.EnterpriseManagement.Warehouse.Cmdlets.psd1'
#
#Check on each MS what connectors are in the lfx objects
Get-SCSMObject Class (Get-SCSMClass Name Microsoft.SystemCenter.Connector) 
  

1.       2. For my case, I have one of the MS servers that did not have all the connectors and also displayed older/removed    connectors.

2.      3.  Once you have identified you have an issue related to orphaned connectors, you can remove them using

Get-SCSMObject Class (Get-SCSMClass Name Microsoft.SystemCenter.Connector) | ?{$_.DisplayName eq "NAME OF YOUR CONNECTOR"} | Remove-SCSMObject Force Confirm
 

1.   4.  Run to confirm orphanes connectors are removed

#Check on each MS what connectors are in the lfx objects
Get-SCSMObject Class (Get-SCSMClass Name Microsoft.SystemCenter.Connector) 

5. You can now create your connectors or leave the MS alone until they sync up with Main MS.

******

In some major cases you might have to delete connectors data in the lfx databases.  This will remove the disabled connectors that we identified as orphaned.  Please be careful, since it will also remove any lfx connectors that are valid but disabled on SCSM.

DELETE FROM [ServiceManager].[LFX].[DataSourceDataCollection]
  WHERE [DataSourceId] IN
  (
  SELECT [DataSourceId] FROM [ServiceManager].[LFX].[DataSource] WHERE [Enabled] = 0
  )


DELETE FROM [ServiceManager].[LFX].[ClientWorkTable]
    WHERE [DataSourceId] IN
  (
  SELECT [DataSourceId] FROM [ServiceManager].[LFX].[DataSource] WHERE [Enabled] = 0
  )

DELETE FROM [ServiceManager].[LFX].[Session]
  WHERE [DataSourceId] IN
  (
  SELECT [DataSourceId] FROM [ServiceManager].[LFX].[DataSource] WHERE [Enabled] = 0
  )

DELETE FROM [ServiceManager].[LFX].[SessionBatch]
  WHERE [SessionTableId] IN
  (
       SELECT [SessionTableId] FROM [ServiceManager].[LFX].[SessionTable]
         WHERE [SessionId] IN
         (
                SELECT [SessionId] FROM [ServiceManager].[LFX].[Session]
                WHERE [DataSourceId] IN
                (
                SELECT [DataSourceId] FROM [ServiceManager].[LFX].[DataSource] WHERE [Enabled] = 0
                )
         )
  )

DELETE FROM [ServiceManager].[LFX].[SessionTable]
  WHERE [SessionId] IN
  (
         SELECT [SessionId] FROM [ServiceManager].[LFX].[Session]
         WHERE [DataSourceId] IN
         (
         SELECT [DataSourceId] FROM [ServiceManager].[LFX].[DataSource] WHERE [Enabled] = 0
         )
  )

DELETE FROM [ServiceManager].[LFX].[SessionProcess]
WHERE [SessionId] IN
(
  SELECT [SessionId] FROM [ServiceManager].[LFX].[Session]
  WHERE [DataSourceId] IN
  (
  SELECT [DataSourceId] FROM [ServiceManager].[LFX].[DataSource] WHERE [Enabled] = 0
  )
)

DELETE FROM [ServiceManager].[LFX].[Session]
  WHERE [DataSourceId] IN
  (
  SELECT [DataSourceId] FROM [ServiceManager].[LFX].[DataSource] WHERE [Enabled] = 0
  )

DELETE FROM [ServiceManager].[LFX].[DatasourceDataQuery]
  WHERE [DataSourceId] IN
  (
       SELECT [DataSourceId] FROM [ServiceManager].[LFX].[DataSource] WHERE [Enabled] = 0
  )

DELETE FROM [ServiceManager].[LFX].[sessionStatus]
  WHERE [DataSourceId] IN
  (
       SELECT [DataSourceId] FROM [ServiceManager].[LFX].[DataSource] WHERE [Enabled] = 0
  )

DELETE FROM [ServiceManager].[LFX].[DataSource] WHERE [Enabled] = 0




July 20th, 2015 3:42pm

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics