none
SCOM SDK Slow to connect RRS feed

  • Question

  • I am using c# writing to connect to SCOM with a windows Form, using ...

    ManagementGroup mg = ManagementGroup.Connect("localhost");
    Is extreemly slow to connect, 20 seconds or more.

    does anyone have any tips?

    K


    kittuk

    Monday, April 9, 2018 7:16 PM

All replies

  • Hi,

    how do you authenticate? Using the current user or do you specify auth credentials in the code?

    Your connection goes to a single management server if NLB is not configured. Can you please check for errors or warnings in the OperationsManager event log on the server you connect to?

    Can you please also do a simple test with PowerShell and connect to your MG:

    UserName = "<user name>"
    $UserDomain = "<user domain>"
    $password = "<password>"
    $ManagementServer = "Your MS name"
    $securePassword = ConvertTo-SecureString $password –AsPlainText -Force
    
    #Load assembly
    [System.Reflection.Assembly]::LoadFrom("$sdkDir\Microsoft.EnterpriseManagement.OperationsManager.Common.dll") | Out-Null
    [System.Reflection.Assembly]::LoadFrom("$sdkDir\Microsoft.EnterpriseManagement.OperationsManager.dll") | Out-Null
    
    #Management Group Connection 
    $MGConnSetting = New-Object Microsoft.EnterpriseManagement.ManagementGroupConnectionSettings($ManagementServer)
    $MGConnSetting.UserName = $UserName
    $MGConnSetting.Domain = $UserDomain
    $MGConnSetting.Password = $SecurePassword
    $ManagementGroup = New-Object Microsoft.EnterpriseManagement.ManagementGroup($MGConnSetting)
    

    You can also test this approach:

    OpsMgr 2012 PowerShell: Getting Connected

    This test could show if the issue is with the M itself or with the code. 

    Post back with the outcome.

    Regards,


    Stoyan (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" where applicable. This helps the community, keeps the forums tidy, and recognizes useful contributions. Thanks!) Blog: https://blog.pohn.ch/ Twitter: @StoyanChalakov


    Tuesday, April 10, 2018 10:19 AM
    Moderator
  • Thank you

    I can connect with Powershell commandlets in 4 seconds, I am using current user.
    No NLBs.

    c# takes 20, quite long for a simple form. I have just checked and Powershell takes the same time using the dll's.

    (I am using SCOM 1801 and .. 
    Microsoft.EnterpriseManagement.Core.dll 
    Microsoft.EnterpriseManagement.OperationsManager.dll 
    from the SCOM install dir\SDK Binaries
    )



    kittuk

    Tuesday, April 10, 2018 12:21 PM
  • Hi,

    "I have just checked and Powershell takes the same time using the dll's." So it is most probably not your code. 
    You've mentioned 1801... Could that be somehow a factor, I am wondering..

    Are you able to test with SCOM 2016?

    Sorry for not being that userful, it is just a weird behavior. Did you check for errors  or other related event on the Mgmt server?


    Stoyan (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" where applicable. This helps the community, keeps the forums tidy, and recognizes useful contributions. Thanks!) Blog: https://blog.pohn.ch/ Twitter: @StoyanChalakov

    Tuesday, April 10, 2018 12:55 PM
    Moderator
  • I have nothing in the Operationsmanager Event Log, looks like procmon or inteletrace my next stop.

    Thanks for the help.

    K


    kittuk

    Tuesday, April 10, 2018 1:45 PM
  • Hey,

    ProcMon is a good idea. Combine it with Network Monitor Tool (Message Analyzer, Wireshark, etc.) to check what are your VS and The MS exchanging.

    Regards,


    Stoyan (Please take a moment to "Vote as Helpful" and/or "Mark as Answer" where applicable. This helps the community, keeps the forums tidy, and recognizes useful contributions. Thanks!) Blog: https://blog.pohn.ch/ Twitter: @StoyanChalakov

    Tuesday, April 10, 2018 1:53 PM
    Moderator