internal InstanceMethodInvocationJob(CimJobContext jobContext, bool passThru, CimInstance targetInstance, MethodInvocationInfo methodInvocationInfo) : base( jobContext, passThru, targetInstance.ToString(), methodInvocationInfo) { Dbg.Assert(targetInstance != null, "Caller should verify targetInstance != null"); _targetInstance = targetInstance; }
public void SetCimInstance(CimInstance cimInstance, CimSetCimInstanceContext context, CmdletOperationBase cmdlet) { DebugHelper.WriteLog("CimSetCimInstance::SetCimInstance", 4); if (cmdlet.ShouldProcess(cimInstance.ToString(), "Set-CimInstance")) { Exception exception = null; if (this.SetProperty(context.Property, ref cimInstance, ref exception)) { CimSessionProxy cimSessionProxy = base.CreateCimSessionProxy(context.Proxy, context.PassThru); cimSessionProxy.ModifyInstanceAsync(cimInstance.CimSystemProperties.Namespace, cimInstance); return; } else { cmdlet.ThrowTerminatingError(exception, "Set-CimInstance"); return; } } else { return; } }
public void InvokeCimMethodOnCimInstance(CimInstance cimInstance, XOperationContextBase context, CmdletOperationBase operation) { DebugHelper.WriteLogEx(); CimInvokeCimMethod.CimInvokeCimMethodContext cimInvokeCimMethodContext = context as CimInvokeCimMethod.CimInvokeCimMethodContext; object[] methodName = new object[1]; methodName[0] = cimInvokeCimMethodContext.MethodName; string str = string.Format(CultureInfo.CurrentUICulture, "Invoke-CimMethod: {0}", methodName); if (operation.ShouldProcess(cimInstance.ToString(), str)) { CimSessionProxy cimSessionProxy = base.CreateCimSessionProxy(cimInvokeCimMethodContext.Proxy); cimSessionProxy.InvokeMethodAsync(cimInvokeCimMethodContext.Namespace, cimInstance, cimInvokeCimMethodContext.MethodName, cimInvokeCimMethodContext.ParametersCollection); return; } else { return; } }
internal InstanceMethodInvocationJob(CimJobContext jobContext, bool passThru, CimInstance targetInstance, MethodInvocationInfo methodInvocationInfo) : base(jobContext, passThru, targetInstance.ToString(), methodInvocationInfo) { this.targetInstance = targetInstance; }
internal void RemoveCimInstance(CimInstance cimInstance, XOperationContextBase context, CmdletOperationBase cmdlet) { DebugHelper.WriteLogEx(); string str = cimInstance.ToString(); if (cmdlet.ShouldProcess(str, "Remove-CimInstance")) { CimRemoveCimInstanceContext cimRemoveCimInstanceContext = context as CimRemoveCimInstanceContext; CimSessionProxy cimSessionProxy = base.CreateCimSessionProxy(cimRemoveCimInstanceContext.Proxy); cimSessionProxy.DeleteInstanceAsync(cimRemoveCimInstanceContext.Namespace, cimInstance); return; } else { return; } }