public NeoQueryData CollectData()
        {
            NeoQueryData  querydata    = new NeoQueryData();
            List <object> propertylist = new List <object>();

            try
            {
                // This query selects all collections
                int type = (int)PackageType.RegularSoftwareDistribution;

                string cmquery = "select * from SMS_PackageBaseclass WHERE PackageType='" + type + "'";

                // Run query
                using (IResultObject results = Connector.Instance.Connection.QueryProcessor.ExecuteQuery(cmquery))
                {
                    // Enumerate through the collection of objects returned by the query.
                    foreach (IResultObject resource in results)
                    {
                        propertylist.Add(new
                        {
                            Name        = ResultObjectHandler.GetString(resource, "Name"),
                            ID          = ResultObjectHandler.GetString(resource, "PackageID"),
                            Description = ResultObjectHandler.GetString(resource, "Description"),
                            PackageType = ((PackageType)ResultObjectHandler.GetInt(resource, "PackageType")).ToString()
                        });
                    }
                }
            }
            catch { }

            querydata.Properties = propertylist;
            return(querydata);
        }
        public NeoQueryData CollectData()
        {
            NeoQueryData  querydata    = new NeoQueryData();
            List <object> propertylist = new List <object>();

            try
            {
                string cmquery = "select * from SMS_TaskSequencePackage";

                // Run query
                using (IResultObject results = Connector.Instance.Connection.QueryProcessor.ExecuteQuery(cmquery))
                {
                    // Enumerate through the collection of objects returned by the query.
                    foreach (IResultObject resource in results)
                    {
                        propertylist.Add(new
                        {
                            ID               = ResultObjectHandler.GetString(resource, "PackageID"),
                            Name             = ResultObjectHandler.GetString(resource, "Name"),
                            TaskSequenceType = ((TaskSequenceType)ResultObjectHandler.GetInt(resource, "Type")).ToString()
                        });
                    }
                }
            }
            catch { }

            querydata.Properties = propertylist;
            return(querydata);
        }
Exemple #3
0
        public NeoQueryData CollectData()
        {
            NeoQueryData  querydata    = new NeoQueryData();
            List <object> propertylist = new List <object>();

            try
            {
                // This query selects all collections
                string cmquery = "select * from SMS_Collection";

                // Run query
                using (IResultObject results = Connector.Instance.Connection.QueryProcessor.ExecuteQuery(cmquery))
                {
                    // Enumerate through the collection of objects returned by the query.
                    foreach (IResultObject resource in results)
                    {
                        int typeint = ResultObjectHandler.GetInt(resource, "CollectionType");

                        propertylist.Add(new
                        {
                            ID   = ResultObjectHandler.GetString(resource, "CollectionID"),
                            Name = ResultObjectHandler.GetString(resource, "Name"),
                            LimitingCollectionID = ResultObjectHandler.GetString(resource, "LimitToCollectionID"),
                            Comment = ResultObjectHandler.GetString(resource, "Comment"),
                            IncludeExcludeCollectionCount = ResultObjectHandler.GetInt(resource, "IncludeExcludeCollectionsCount"),
                            CollectionType = ((CollectionType)typeint).ToString()
                        });
                    }
                }
            }
            catch { }

            querydata.Properties = propertylist;
            return(querydata);
        }
        public NeoQueryData CollectData()
        {
            NeoQueryData  querydata    = new NeoQueryData();
            List <object> propertylist = new List <object>();

            try
            {
                // This query selects all collections
                string cmquery = "select * from SMS_SoftwareUpdate";

                // Run query
                using (IResultObject results = Connector.Instance.Connection.QueryProcessor.ExecuteQuery(cmquery))
                {
                    // Enumerate through the collection of objects returned by the query.
                    foreach (IResultObject resource in results)
                    {
                        propertylist.Add(new
                        {
                            ID               = ResultObjectHandler.GetString(resource, "CI_ID"),
                            ArticleID        = ResultObjectHandler.GetString(resource, "ArticleID"),
                            BulletinID       = ResultObjectHandler.GetString(resource, "BulletinID"),
                            DateCreated      = ResultObjectHandler.GetDateTime(resource, "DateCreated").ToString(),
                            DateRevised      = ResultObjectHandler.GetDateTime(resource, "DateRevised").ToString(),
                            Name             = ResultObjectHandler.GetString(resource, "LocalizedDisplayName"),
                            IsBundle         = ResultObjectHandler.GetBool(resource, "IsBundle"),
                            IsDeployed       = ResultObjectHandler.GetBool(resource, "IsDeployed"),
                            IsExpired        = ResultObjectHandler.GetBool(resource, "IsExpired"),
                            IsLatest         = ResultObjectHandler.GetBool(resource, "IsLatest"),
                            IsSuperseded     = ResultObjectHandler.GetBool(resource, "IsSuperseded"),
                            Description      = ResultObjectHandler.GetString(resource, "LocalizedDescription"),
                            NumMissing       = ResultObjectHandler.GetInt(resource, "NumMissing"),
                            PercentCompliant = ResultObjectHandler.GetInt(resource, "PercentCompliant"),
                            SeverityName     = ResultObjectHandler.GetString(resource, "SeverityName"),
                            Size             = ResultObjectHandler.GetInt(resource, "Size")
                        });
                    }
                }
            }
            catch { }

            querydata.Properties = propertylist;
            return(querydata);
        }
Exemple #5
0
        public NeoQueryData CollectData()
        {
            NeoQueryData  querydata    = new NeoQueryData();
            List <object> propertylist = new List <object>();

            querydata.Properties = propertylist;

            try
            {
                // This query selects all collections
                string cmquery = "select * from SMS_DeploymentSummary";

                // Run query
                using (IResultObject results = Connector.Instance.Connection.QueryProcessor.ExecuteQuery(cmquery))
                {
                    // Enumerate through the collection of objects returned by the query.
                    foreach (IResultObject resource in results)
                    {
                        string ciid = ResultObjectHandler.GetString(resource, "CI_ID");
                        if (string.IsNullOrWhiteSpace(ciid))
                        {
                            ciid = ResultObjectHandler.GetString(resource, "PackageID");
                        }

                        string intent = string.Empty;
                        switch (ResultObjectHandler.GetInt(resource, "DeploymentIntent"))
                        {
                        case 1:
                            intent = "Install";
                            break;

                        case 2:
                            intent = "Uninstall";
                            break;

                        case 3:
                            intent = "Preflight";
                            break;

                        default:
                            break;
                        }

                        propertylist.Add(new
                        {
                            CollectionID = ResultObjectHandler.GetString(resource, "CollectionID"),
                            //CollectionName = ResultObjectHandler.GetString(resource, "CollectionName"),
                            DeploymentID     = ResultObjectHandler.GetString(resource, "DeploymentID"),
                            DeploymentIntent = intent,
                            SoftwareName     = ResultObjectHandler.GetString(resource, "SoftwareName"),
                            //PackageID = ResultObjectHandler.GetString(resource, "PackageID"),
                            //ProgramName = ResultObjectHandler.GetString(resource, "ProgramName"),
                            CIID = ciid
                                   //FeatureType = ((SccmItemType)ResultObjectHandler.GetInt(resource, "FeatureType")).ToString()
                        });
                    }
                }
            }
            catch { }

            return(querydata);
        }