Esempio n. 1
0
        /// <summary>
        /// ProcessRecord method.
        /// </summary>
        protected override void ProcessRecord()
        {
            base.CheckParameterSet();
            this.CheckArgument();
            if (this.ClientOnly)
            {
                string conflictParameterName = null;
                if (this.ComputerName != null)
                {
                    conflictParameterName = @"ComputerName";
                }
                else if (this.CimSession != null)
                {
                    conflictParameterName = @"CimSession";
                }

                if (conflictParameterName != null)
                {
                    ThrowConflictParameterWasSet(@"New-CimInstance", conflictParameterName, @"ClientOnly");
                    return;
                }
            }

            CimNewCimInstance cimNewCimInstance = this.GetOperationAgent();

            if (cimNewCimInstance == null)
            {
                cimNewCimInstance = CreateOperationAgent();
            }

            cimNewCimInstance.NewCimInstance(this);
            cimNewCimInstance.ProcessActions(this.CmdletOperation);
        }
Esempio n. 2
0
        protected override void ProcessRecord()
        {
            base.CheckParameterSet();
            this.CheckArgument();
            if (this.ClientOnly)
            {
                string str = null;
                if (this.ComputerName == null)
                {
                    if (this.CimSession != null)
                    {
                        str = "CimSession";
                    }
                }
                else
                {
                    str = "ComputerName";
                }
                if (str != null)
                {
                    base.ThrowConflictParameterWasSet("New-CimInstance", str, "ClientOnly");
                    return;
                }
            }
            CimNewCimInstance operationAgent = this.GetOperationAgent();

            if (operationAgent == null)
            {
                operationAgent = this.CreateOperationAgent();
            }
            operationAgent.NewCimInstance(this);
            operationAgent.ProcessActions(this.CmdletOperation);
        }