Beispiel #1
0
        public void Execute(IActivityRequest request, IActivityResponse response)
        {
            SCCMServer = settings.SCCMSERVER;
            userName   = settings.UserName;
            password   = settings.Password;

            String filter = request.Inputs["Filter Query"].AsString();

            //Setup WQL Connection and WMI Management Scope
            WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password);

            using (connection)
            {
                IResultObject col = CMInterop.getSCCMObject(connection, "SMS_R_System", filter);

                List <system> systemCollection = new List <system>();
                foreach (IResultObject obj in col)
                {
                    ObjCount++;
                    systemCollection.Add(new system(obj));
                }

                if (systemCollection != null)
                {
                    response.WithFiltering().PublishRange(getObjects(systemCollection));
                }
                response.Publish("Number of Systems", ObjCount);

                CMInterop.removeSCCMObject(connection, filter, "SMS_R_System");
            }
        }
Beispiel #2
0
        public void Execute(IActivityRequest request, IActivityResponse response)
        {
            SCCMServer = settings.SCCMSERVER;
            userName   = settings.UserName;
            password   = settings.Password;

            String filter   = request.Inputs["Filter Query"].AsString();
            String objClass = request.Inputs["Class"].AsString();

            //Setup WQL Connection and WMI Management Scope
            WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password);

            using (connection)
            {
                IResultObject col = CMInterop.getSCCMObject(connection, objClass, filter);

                CMInterop.removeSCCMObject(connection, filter, objClass);

                foreach (IResultObject obj in col)
                {
                    ObjCount++;
                }
                response.Publish("Number of Objects", ObjCount);
            }
        }
Beispiel #3
0
        public void Execute(IActivityRequest request, IActivityResponse response)
        {
            SCCMServer = settings.SCCMSERVER;
            userName   = settings.UserName;
            password   = settings.Password;

            String argType   = request.Inputs["Argument Type"].AsString();
            String argString = request.Inputs["Argument String"].AsString();

            //Setup WQL Connection and WMI Management Scope
            WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password);

            using (connection)
            {
                IResultObject col = null;

                //Get Computer Collection
                switch (argType)
                {
                case "ResourceID":
                    col = CMInterop.getSCCMUser(connection, argString, "", "");
                    break;

                case "UserName":
                    col = CMInterop.getSCCMUser(connection, "", argString, "");
                    break;

                case "DomainName":
                    col = CMInterop.getSCCMUser(connection, "", "", argString);
                    break;

                case "Query":
                    col = CMInterop.getSCCMObject(connection, "SMS_R_User", argString);
                    break;
                }

                if (col != null)
                {
                    response.WithFiltering().PublishRange(getObjects(col));
                }
                response.Publish("Number of Users", ObjCount);
            }
        }
Beispiel #4
0
        public void Execute(IActivityRequest request, IActivityResponse response)
        {
            SCCMServer = settings.SCCMSERVER;
            userName   = settings.UserName;
            password   = settings.Password;

            String folderType = request.Inputs["Folder Type"].AsString();
            String filter     = request.Inputs["Filter"].AsString();

            switch (folderType)
            {
            case "SMS_Package":
                filter += " AND ObjectType = 2";
                break;

            case "SMS_Advertisement":
                filter += " AND ObjectType = 3";
                break;

            case "SMS_Query":
                filter += " AND ObjectType = 7";
                break;

            case "SMS_Report":
                filter += " AND ObjectType = 8";
                break;

            case "SMS_MeteredProductRule":
                filter += " AND ObjectType = 9";
                break;

            case "SMS_ConfigurationItem":
                filter += " AND ObjectType = 11";
                break;

            case "SMS_OperatingSystemInstallPackage":
                filter += " AND ObjectType = 14";
                break;

            case "SMS_StateMigration":
                filter += " AND ObjectType = 17";
                break;

            case "SMS_ImagePackage":
                filter += " AND ObjectType = 18";
                break;

            case "SMS_BootImagePackage":
                filter += " AND ObjectType = 19";
                break;

            case "SMS_TaskSequencePackage":
                filter += " AND ObjectType = 20";
                break;

            case "SMS_DeviceSettingPackage":
                filter += " AND ObjectType = 21";
                break;

            case "SMS_DriverPackage":
                filter += " AND ObjectType = 23";
                break;

            case "SMS_Driver":
                filter += " AND ObjectType = 25";
                break;

            case "SMS_SoftwareUpdate":
                filter += " AND ObjectType = 1011";
                break;

            default:
                break;
            }

            //Setup WQL Connection and WMI Management Scope
            WqlConnectionManager connection = CMInterop.connectSCCMServer(SCCMServer, userName, password);

            using (connection)
            {
                IResultObject col = null;
                col = CMInterop.getSCCMObject(connection, "SMS_ObjectContainerNode", filter);

                if (col != null)
                {
                    response.WithFiltering().PublishRange(getObjects(col));
                }
                response.Publish("Number of Folders", ObjCount);
            }
        }