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

            String pkgID           = request.Inputs["Existing Package ID"].AsString();
            String prgName         = request.Inputs["Existing Program Name"].AsString();
            String prgOSMaxVersion = request.Inputs["New Max Version"].AsString();
            String prgOSMinVersion = request.Inputs["New Min Version"].AsString();
            String prgOSName       = request.Inputs["New Name"].AsString();
            String prgOSPlatform   = request.Inputs["New Platform"].AsString();

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

            using (connection)
            {
                CMInterop.modifySCCMProgramSupportedPlatforms(connection, pkgID, prgName, prgOSMaxVersion, prgOSMinVersion, prgOSName, prgOSPlatform);

                IResultObject col = CMInterop.getSCCMProgram(connection, "PackageID LIKE '" + pkgID + "' AND ProgramName LIKE '" + prgName + "'");

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

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

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

            using (connection)
            {
                IResultObject col = null;
                col = CMInterop.getSCCMProgram(connection, filter);

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

            String objID   = request.Inputs["Package ID"].AsString();
            String prgName = request.Inputs["Program Name"].AsString();

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

            try
            {
                String[] propertyNameChoices = CMInterop.getSCCMObjectPropertyNames(connection, "SMS_Program");
                foreach (String propertyName in propertyNameChoices)
                {
                    if ((request.Inputs.Contains(propertyName + " : Property Type")) && (request.Inputs.Contains(propertyName + " : Property Value")))
                    {
                        CMInterop.modifySCCMProgram(connection, objID, prgName, request.Inputs[(propertyName + " : Property Type")].AsString(), propertyName, request.Inputs[(propertyName + " : Property Value")].AsString());
                    }
                }

                IResultObject col = CMInterop.getSCCMProgram(connection, "PackageID LIKE '" + objID + "' AND ProgramName LIKE '" + prgName + "'");
                if (col != null)
                {
                    response.WithFiltering().PublishRange(getObjects(col));
                }
                response.Publish("Number of Programs", ObjCount);
            }
            finally
            {
                connection.Close();
                connection.Dispose();
            }
        }
Exemple #4
0
        public void Execute(IActivityRequest request, IActivityResponse response)
        {
            SCCMServer = settings.SCCMSERVER;
            userName   = settings.UserName;
            password   = settings.Password;

            String objID   = request.Inputs["Package ID"].AsString();
            String prgName = request.Inputs["Program Name"].AsString();

            uint programFlags = 0x00000000;

            if (request.Inputs["UNATTENDED"].AsBoolean())
            {
                programFlags ^= UNATTENDED;
            }
            if (request.Inputs["USER CONTEXT"].AsBoolean())
            {
                programFlags ^= USERCONTEXT;
            }
            if (request.Inputs["EVERY USER"].AsBoolean())
            {
                programFlags ^= EVERYUSER;
            }
            if (request.Inputs["USE UNC PATH"].AsBoolean())
            {
                programFlags ^= USEUNCPATH;
            }
            if (request.Inputs["Authorized Dynamic Install"].AsBoolean())
            {
                programFlags ^= AUTHORIZED_DYNAMIC_INSTALL;
            }
            if (request.Inputs["USE CUSTOM PROGRESS MSG"].AsBoolean())
            {
                programFlags ^= USECUSTOMPROGRESSMSG;
            }
            if (request.Inputs["DEFAULT PROGRAM"].AsBoolean())
            {
                programFlags ^= DEFAULT_PROGRAM;
            }
            if (request.Inputs["DISABLE MOM ALERT ON RUNNING"].AsBoolean())
            {
                programFlags ^= DISABLEMOMALERTONRUNNING;
            }
            if (request.Inputs["MOM ALERT ON FAIL"].AsBoolean())
            {
                programFlags ^= MOMALERTONFAIL;
            }
            if (request.Inputs["RUN DEPENDANT ALWAYS"].AsBoolean())
            {
                programFlags ^= RUN_DEPENDANT_ALWAYS;
            }
            if (request.Inputs["WINDOWS CE"].AsBoolean())
            {
                programFlags ^= WINDOWS_CE;
            }
            if (request.Inputs["COUNTDOWN"].AsBoolean())
            {
                programFlags ^= COUNTDOWN;
            }
            if (request.Inputs["FORCE RERUN"].AsBoolean())
            {
                programFlags ^= FORCERERUN;
            }
            if (request.Inputs["DISABLED"].AsBoolean())
            {
                programFlags ^= DISABLED;
            }
            if (request.Inputs["ADMIN RIGHTS"].AsBoolean())
            {
                programFlags ^= ADMINRIGHTS;
            }
            if (request.Inputs["USE CUSTOM PROGRESS MSG"].AsBoolean())
            {
                programFlags ^= USECUSTOMPROGRESSMSG;
            }
            if (request.Inputs["NO USER LOGGED IN"].AsBoolean())
            {
                programFlags ^= NOUSERLOGGEDIN;
            }
            if (request.Inputs["OK TO QUIT"].AsBoolean())
            {
                programFlags ^= OKTOQUIT;
            }
            if (request.Inputs["OK TO REBOOT"].AsBoolean())
            {
                programFlags ^= OKTOREBOOT;
            }
            if (request.Inputs["PERSIST CONNECTION"].AsBoolean())
            {
                programFlags ^= PERSISTCONNECTION;
            }
            if (request.Inputs["RUN MINIMIZED"].AsBoolean())
            {
                programFlags ^= RUNMINIMIZED;
            }
            if (request.Inputs["RUN MAXIMIZED"].AsBoolean())
            {
                programFlags ^= RUNMAXIMIZED;
            }
            if (request.Inputs["HIDE WINDOW"].AsBoolean())
            {
                programFlags ^= HIDEWINDOW;
            }
            if (request.Inputs["OK TO LOGOFF"].AsBoolean())
            {
                programFlags ^= OKTOLOGOFF;
            }
            if (request.Inputs["RUN ACCOUNT"].AsBoolean())
            {
                programFlags ^= RUNACCOUNT;
            }
            if (request.Inputs["ANY PLATFORM"].AsBoolean())
            {
                programFlags ^= ANY_PLATFORM;
            }
            if (request.Inputs["STILL RUNNING"].AsBoolean())
            {
                programFlags ^= STILL_RUNNING;
            }
            if (request.Inputs["SUPPORT UNINSTALL"].AsBoolean())
            {
                programFlags ^= SUPPORT_UNINSTALL;
            }
            if (request.Inputs["Platform Not Supported"].AsBoolean())
            {
                programFlags ^= Platform_Not_Supported;
            }
            if (request.Inputs["SHOW IN ARP"].AsBoolean())
            {
                programFlags ^= SHOW_IN_ARP;
            }

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

            using (connection)
            {
                String prgFlags = Convert.ToString((int)programFlags);

                CMInterop.modifySCCMProgram(connection, objID, prgName, "IntegerValue", "ProgramFlags", prgFlags);
                IResultObject col = CMInterop.getSCCMProgram(connection, "PackageID LIKE '" + objID + "' AND ProgramName LIKE '" + prgName + "'");
                if (col != null)
                {
                    response.WithFiltering().PublishRange(getObjects(col));
                }
                response.Publish("Number of Programs", ObjCount);
            }
        }