예제 #1
0
        private static ManagementObject GetreceiveLocationWmiObject(string receiveLocation)
        {
            var searcher = new ManagementObjectSearcher();
            var scope    = new ManagementScope("root\\MicrosoftBizTalkServer");

            searcher.Scope = scope;

            // Build a Query to enumerate the MSBTS_ReceiveLocation instances if an argument
            // is supplied use it to select only the matching RL.
            var query = new SelectQuery
            {
                QueryString = String.Format("SELECT * FROM MSBTS_ReceiveLocation WHERE Name =\"{0}\"", receiveLocation)
            };

            // Set the query for the searcher.
            searcher.Query = query;

            // Execute the query and determine if any results were obtained.
            ManagementObjectCollection queryCol = searcher.Get();

            ManagementObjectCollection.ManagementObjectEnumerator me = queryCol.GetEnumerator();
            me.Reset();
            if (me.MoveNext())
            {
                return((ManagementObject)me.Current);
            }
            else
            {
                throw new ApplicationException(string.Format("The WMI object for the receive location:{0} could not be retrieved.", receiveLocation));
            }
        }
        //=================================================================================================

        private PropertyDataCollection GetWmiColumns()
        {
            // Execute the WQL query and retrieve metadata
            ManagementObjectCollection.ManagementObjectEnumerator managementObjectEnumerator = ExecWQL(true).GetEnumerator();
            managementObjectEnumerator.Reset();
            managementObjectEnumerator.MoveNext();
            ManagementBaseObject managementBaseObject = managementObjectEnumerator.Current;

            return(managementBaseObject.Properties);
        }
예제 #3
0
 public virtual void Reset()
 {
     privObjEnum.Reset();
 }