none
Enable Receive Location using Code RRS feed

  • Question

  • Hi There,

    Anyone to help with the below will be appreciated.

    I have the below code that works well on my local machine can start and stop receive location just fine.

    Now I wan to use the same code in a multiple biztalk sever installations and using a different admin account.

    I it possible and if so any sample code?

    System.Management.ManagementObject requiredRLObj = null;
    System.Management.ObjectGetOptions objGetOptions = new ObjectGetOptions();
    System.Management.ManagementClass rlObjectClass = new ManagementClass("root\\MicrosoftBizTalkServer", "MSBTS_ReceiveLocation", objGetOptions);

    System.Management.EnumerationOptions enumObjOptions = new EnumerationOptions();
    enumObjOptions.ReturnImmediately = false;
    System.Management.ManagementObjectCollection rlObjColl = rlObjectClass.GetInstances(enumObjOptions);

    foreach (ManagementObject rlObjInstance in rlObjColl)
                    {

                        if (rlObjInstance["Name"] != null)
                        {

                            if (string.Compare("My_Receive_LocationName", rlObjInstance["Name"].ToString(), true, System.Globalization.CultureInfo.CurrentUICulture) == 0)
                            {

                                requiredRLObj = rlObjInstance;

                            }

                        }

                    }

                    requiredRLObj.InvokeMethod("Disable", null);

                    requiredRLObj.InvokeMethod("Enable", null);

    Tuesday, March 20, 2018 7:49 AM

All replies