Example #1
0
        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["New Program Name"].AsString();
            String prgComment          = request.Inputs["New Program Comment"].AsString();
            String prgCommandLine      = request.Inputs["New Program Command Line"].AsString();
            int    prgMaxRunTime       = (int)request.Inputs["New Program Max Runtime"].AsUInt32();
            String prgWorkingDirectory = request.Inputs["New Program Working Directory"].AsString();

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

            using (connection)
            {
                IResultObject col = CM2012Interop.createSCCMProgram(connection, pkgID, prgName, prgComment, prgCommandLine, prgMaxRunTime, prgWorkingDirectory);

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