PowerShell/src/Microsoft.Management.Infrastructure.CimCmdlets/CimGetInstance.cs

541 lines
19 KiB
C#
Raw Normal View History

// Copyright (c) Microsoft Corporation.
// Licensed under the MIT License.
#region Using directives
using System;
using System.Collections;
using System.Collections.Generic;
using System.Globalization;
using System.Management.Automation;
using System.Text;
#endregion
namespace Microsoft.Management.Infrastructure.CimCmdlets
{
/// <summary>
/// A class used to add pstypename to partial ciminstance
/// for <see cref="GetCimInstanceCommand"/>, if -KeyOnly
/// or -SelectProperties is been specified, then add a pstypename:
/// "Microsoft.Management.Infrastructure.CimInstance#__PartialCIMInstance"
/// </summary>
internal class FormatPartialCimInstance : IObjectPreProcess
{
/// <summary>
/// Partial ciminstance pstypename.
/// </summary>
internal const string PartialPSTypeName = @"Microsoft.Management.Infrastructure.CimInstance#__PartialCIMInstance";
/// <summary>
/// Add pstypename to the resultobject if necessary.
/// </summary>
/// <param name="resultObject"></param>
/// <returns></returns>
public object Process(object resultObject)
{
if (resultObject is CimInstance)
{
PSObject obj = PSObject.AsPSObject(resultObject);
obj.TypeNames.Insert(0, PartialPSTypeName);
return obj;
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
return resultObject;
}
}
/// <summary>
/// <para>
/// Implements operations of get-ciminstance cmdlet.
/// </para>
/// </summary>
internal class CimGetInstance : CimAsyncOperation
{
/// <summary>
/// <para>
/// Constructor
/// </para>
/// </summary>
public CimGetInstance() : base()
{
}
/// <summary>
/// <para>
/// Base on parametersetName to retrieve ciminstances
/// </para>
/// </summary>
/// <param name="cmdlet"><see cref="GetCimInstanceCommand"/> object.</param>
public void GetCimInstance(GetCimInstanceCommand cmdlet)
{
GetCimInstanceInternal(cmdlet);
}
/// <summary>
/// <para>
Spelling comments (#2066) * spelling: comments in src/Microsoft.Management.Infrastructure.CimCmdlets * spelling: comments in src/Microsoft.PackageManagement.ArchiverProviders * spelling: comments in src/Microsoft.PackageManagement.CoreProviders * spelling: comments in src/Microsoft.PackageManagement.MetaProvider.PowerShell * spelling: comments in src/Microsoft.PackageManagement.MsiProvider * spelling: comments in src/Microsoft.PackageManagement.MsuProvider * spelling: comments in src/Microsoft.PackageManagement.NuGetProvider * spelling: comments in src/Microsoft.PackageManagement.PackageSourceListProvider * spelling: comments in src/Microsoft.PackageManagement * spelling: comments in src/Microsoft.PowerShell.Activities * spelling: comments in src/Microsoft.PowerShell.Commands.Diagnostics * spelling: comments in src/Microsoft.PowerShell.Commands.Management * spelling: comments in src/Microsoft.PowerShell.Commands.Utility * spelling: comments in src/Microsoft.PowerShell.ConsoleHost * spelling: comments in src/Microsoft.PowerShell.Core.Activities * spelling: comments in src/Microsoft.PowerShell.CoreCLR.AssemblyLoadContext * spelling: comments in src/Microsoft.PowerShell.CoreCLR.Eventing * spelling: comments in src/Microsoft.PowerShell.Diagnostics.Activities * spelling: comments in src/Microsoft.PowerShell.GraphicalHost * spelling: comments in src/Microsoft.PowerShell.LocalAccounts * spelling: comments in src/Microsoft.PowerShell.Management.Activities * spelling: comments in src/Microsoft.PowerShell.PSReadLine * spelling: comments in src/Microsoft.PowerShell.PackageManagement * spelling: comments in src/Microsoft.PowerShell.ScheduledJob * spelling: comments in src/Microsoft.PowerShell.Security.Activities * spelling: comments in src/Microsoft.PowerShell.Security * spelling: comments in src/Microsoft.PowerShell.Utility.Activities * spelling: comments in src/Microsoft.PowerShell.Workflow.ServiceCore * spelling: comments in src/Microsoft.WSMan.Management.Activities * spelling: comments in src/Modules * spelling: comments in src/Schemas * spelling: comments in src/libpsl-native * spelling: comments in src/powershell-native * spelling: comments in build.psm1 * spelling: comments in src/System.Management.Automation/CoreCLR * spelling: comments in src/System.Management.Automation/DscSupport * spelling: comments in src/System.Management.Automation/cimSupport * spelling: comments in src/System.Management.Automation/commands * spelling: comments in src/System.Management.Automation/engine/Modules
2016-08-26 22:46:03 +02:00
/// Refactor to be reused by Get-CimInstance;Remove-CimInstance;Set-CimInstance
/// </para>
/// </summary>
/// <param name="cmdlet"></param>
protected void GetCimInstanceInternal(CimBaseCommand cmdlet)
{
IEnumerable<string> computerNames = ConstValue.GetComputerNames(
GetComputerName(cmdlet));
string nameSpace;
List<CimSessionProxy> proxys = new List<CimSessionProxy>();
bool isGetCimInstanceCommand = (cmdlet is GetCimInstanceCommand);
CimInstance targetCimInstance = null;
switch (cmdlet.ParameterSetName)
{
case CimBaseCommand.CimInstanceComputerSet:
foreach (string computerName in computerNames)
{
targetCimInstance = GetCimInstanceParameter(cmdlet);
CimSessionProxy proxy = CreateSessionProxy(computerName, targetCimInstance, cmdlet);
if (isGetCimInstanceCommand)
{
this.SetPreProcess(proxy, cmdlet as GetCimInstanceCommand);
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
proxys.Add(proxy);
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
break;
case CimBaseCommand.ClassNameComputerSet:
case CimBaseCommand.QueryComputerSet:
case CimBaseCommand.ResourceUriComputerSet:
foreach (string computerName in computerNames)
{
CimSessionProxy proxy = CreateSessionProxy(computerName, cmdlet);
if (isGetCimInstanceCommand)
{
this.SetPreProcess(proxy, cmdlet as GetCimInstanceCommand);
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
proxys.Add(proxy);
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
break;
case CimBaseCommand.ClassNameSessionSet:
case CimBaseCommand.CimInstanceSessionSet:
case CimBaseCommand.QuerySessionSet:
case CimBaseCommand.ResourceUriSessionSet:
foreach (CimSession session in GetCimSession(cmdlet))
{
CimSessionProxy proxy = CreateSessionProxy(session, cmdlet);
if (isGetCimInstanceCommand)
{
this.SetPreProcess(proxy, cmdlet as GetCimInstanceCommand);
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
proxys.Add(proxy);
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
break;
default:
break;
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
switch (cmdlet.ParameterSetName)
{
case CimBaseCommand.ClassNameComputerSet:
case CimBaseCommand.ClassNameSessionSet:
nameSpace = ConstValue.GetNamespace(GetNamespace(cmdlet));
if (IsClassNameQuerySet(cmdlet))
{
string query = CreateQuery(cmdlet);
DebugHelper.WriteLogEx(@"Query = {0}", 1, query);
foreach (CimSessionProxy proxy in proxys)
{
proxy.QueryInstancesAsync(nameSpace,
ConstValue.GetQueryDialectWithDefault(GetQueryDialect(cmdlet)),
query);
}
}
else
{
foreach (CimSessionProxy proxy in proxys)
{
proxy.EnumerateInstancesAsync(nameSpace, GetClassName(cmdlet));
}
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
break;
case CimBaseCommand.CimInstanceComputerSet:
case CimBaseCommand.CimInstanceSessionSet:
{
CimInstance instance = GetCimInstanceParameter(cmdlet);
nameSpace = ConstValue.GetNamespace(instance.CimSystemProperties.Namespace);
foreach (CimSessionProxy proxy in proxys)
{
proxy.GetInstanceAsync(nameSpace, instance);
}
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
break;
case CimBaseCommand.QueryComputerSet:
case CimBaseCommand.QuerySessionSet:
nameSpace = ConstValue.GetNamespace(GetNamespace(cmdlet));
foreach (CimSessionProxy proxy in proxys)
{
proxy.QueryInstancesAsync(nameSpace,
ConstValue.GetQueryDialectWithDefault(GetQueryDialect(cmdlet)),
GetQuery(cmdlet));
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
break;
case CimBaseCommand.ResourceUriSessionSet:
case CimBaseCommand.ResourceUriComputerSet:
foreach (CimSessionProxy proxy in proxys)
{
proxy.EnumerateInstancesAsync(GetNamespace(cmdlet), GetClassName(cmdlet));
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
2017-01-16 22:31:14 +01:00
break;
default:
break;
}
}
#region bridge methods to read properties from cmdlet
protected static string[] GetComputerName(CimBaseCommand cmdlet)
{
if (cmdlet is GetCimInstanceCommand)
{
return (cmdlet as GetCimInstanceCommand).ComputerName;
}
else if (cmdlet is RemoveCimInstanceCommand)
{
return (cmdlet as RemoveCimInstanceCommand).ComputerName;
}
else if (cmdlet is SetCimInstanceCommand)
{
return (cmdlet as SetCimInstanceCommand).ComputerName;
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
return null;
}
protected static string GetNamespace(CimBaseCommand cmdlet)
{
if (cmdlet is GetCimInstanceCommand)
{
return (cmdlet as GetCimInstanceCommand).Namespace;
}
else if (cmdlet is RemoveCimInstanceCommand)
{
return (cmdlet as RemoveCimInstanceCommand).Namespace;
}
else if (cmdlet is SetCimInstanceCommand)
{
return (cmdlet as SetCimInstanceCommand).Namespace;
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
return null;
}
protected static CimSession[] GetCimSession(CimBaseCommand cmdlet)
{
if (cmdlet is GetCimInstanceCommand)
{
return (cmdlet as GetCimInstanceCommand).CimSession;
}
else if (cmdlet is RemoveCimInstanceCommand)
{
return (cmdlet as RemoveCimInstanceCommand).CimSession;
}
else if (cmdlet is SetCimInstanceCommand)
{
return (cmdlet as SetCimInstanceCommand).CimSession;
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
return null;
}
protected static string GetClassName(CimBaseCommand cmdlet)
{
if (cmdlet is GetCimInstanceCommand)
{
return (cmdlet as GetCimInstanceCommand).ClassName;
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
return null;
}
protected static string GetQuery(CimBaseCommand cmdlet)
{
if (cmdlet is GetCimInstanceCommand)
{
return (cmdlet as GetCimInstanceCommand).Query;
}
else if (cmdlet is RemoveCimInstanceCommand)
{
return (cmdlet as RemoveCimInstanceCommand).Query;
}
else if (cmdlet is SetCimInstanceCommand)
{
return (cmdlet as SetCimInstanceCommand).Query;
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
return null;
}
internal static bool IsClassNameQuerySet(CimBaseCommand cmdlet)
{
DebugHelper.WriteLogEx();
GetCimInstanceCommand cmd = cmdlet as GetCimInstanceCommand;
if (cmd != null)
{
if (cmd.QueryDialect != null || cmd.SelectProperties != null || cmd.Filter != null)
{
return true;
}
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
return false;
}
protected static string CreateQuery(CimBaseCommand cmdlet)
{
DebugHelper.WriteLogEx();
GetCimInstanceCommand cmd = cmdlet as GetCimInstanceCommand;
if (cmd != null)
{
StringBuilder propertyList = new StringBuilder();
if (cmd.SelectProperties == null)
{
propertyList.Append("*");
}
else
{
foreach (string property in cmd.SelectProperties)
{
if (propertyList.Length > 0)
{
propertyList.Append(",");
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
propertyList.Append(property);
}
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
return (cmd.Filter == null) ?
string.Format(CultureInfo.CurrentUICulture, queryWithoutWhere, propertyList, cmd.ClassName) :
string.Format(CultureInfo.CurrentUICulture, queryWithWhere, propertyList, cmd.ClassName, cmd.Filter);
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
return null;
}
protected static string GetQueryDialect(CimBaseCommand cmdlet)
{
if (cmdlet is GetCimInstanceCommand)
{
return (cmdlet as GetCimInstanceCommand).QueryDialect;
}
else if (cmdlet is RemoveCimInstanceCommand)
{
return (cmdlet as RemoveCimInstanceCommand).QueryDialect;
}
else if (cmdlet is SetCimInstanceCommand)
{
return (cmdlet as SetCimInstanceCommand).QueryDialect;
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
return null;
}
protected static CimInstance GetCimInstanceParameter(CimBaseCommand cmdlet)
{
if (cmdlet is GetCimInstanceCommand)
{
return (cmdlet as GetCimInstanceCommand).CimInstance;
}
else if (cmdlet is RemoveCimInstanceCommand)
{
return (cmdlet as RemoveCimInstanceCommand).CimInstance;
}
else if (cmdlet is SetCimInstanceCommand)
{
return (cmdlet as SetCimInstanceCommand).CimInstance;
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
return null;
}
#endregion
#region help methods
/// <summary>
/// <para>
/// Set <see cref="CimSessionProxy"/> properties
/// </para>
/// </summary>
/// <param name="proxy"></param>
/// <param name="cmdlet"></param>
private void SetSessionProxyProperties(
ref CimSessionProxy proxy,
CimBaseCommand cmdlet)
{
if (cmdlet is GetCimInstanceCommand)
{
GetCimInstanceCommand getCimInstance = cmdlet as GetCimInstanceCommand;
proxy.KeyOnly = getCimInstance.KeyOnly;
proxy.Shallow = getCimInstance.Shallow;
proxy.OperationTimeout = getCimInstance.OperationTimeoutSec;
if (getCimInstance.ResourceUri != null)
{
proxy.ResourceUri = getCimInstance.ResourceUri;
}
}
else if (cmdlet is RemoveCimInstanceCommand)
{
RemoveCimInstanceCommand removeCimInstance = cmdlet as RemoveCimInstanceCommand;
proxy.OperationTimeout = removeCimInstance.OperationTimeoutSec;
if (removeCimInstance.ResourceUri != null)
{
2017-01-16 22:31:14 +01:00
proxy.ResourceUri = removeCimInstance.ResourceUri;
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
CimRemoveCimInstanceContext context = new CimRemoveCimInstanceContext(
ConstValue.GetNamespace(removeCimInstance.Namespace),
proxy);
proxy.ContextObject = context;
}
else if (cmdlet is SetCimInstanceCommand)
{
SetCimInstanceCommand setCimInstance = cmdlet as SetCimInstanceCommand;
proxy.OperationTimeout = setCimInstance.OperationTimeoutSec;
if (setCimInstance.ResourceUri != null)
{
2017-01-16 22:31:14 +01:00
proxy.ResourceUri = setCimInstance.ResourceUri;
}
Code cleanup: Add space after closing brace where needed (#8530) * Update TestService * Update WebListener * Update Controllers * Update ExpTest * Update MyApp * Update Logic * Update Logic * Update MyApp * Update Microsoft.Management.Infrastructure.CimCmdlets * Update Microsoft.PowerShell.Commands.Diagnostics * Update Microsoft.PowerShell.ScheduledJob * Update Microsoft.WSMan.Management * Update Microsoft.WSMan.Runtime * Update ResGen * Update TypeCatalogGen * Update commands * Update Eventing * Update Reader * Update utility * Update ShowCommand * Update trace * Update WebCmdlet * Update Common * Update CoreCLR * Update common * Update format-object * Update format-wide * Update out-file * Update out-printer * Update out-string * Update OutGridView * Update LocalAccounts * Update Commands * Update security * Update CoreCLR * Update DscSupport * Update engine * Update help * Update logging * Update namespaces * Update security * Update utils * Update config * Update perfCounters * Update tracing * Update cmdletization * Update other * Update cim * Update xml * Update CoreCLR * Update common * Update DefaultFormatters * Update out-console * Update out-textInterface * Update DisplayDatabase * Update Utilities * Update COM * Update ComInterop * Update CommandCompletion * Update debugger * Update ExperimentalFeature * Update hostifaces * Update interpreter * Update lang * Update Modules * Update parser * Update runtime * Update client * Update commands * Update common * Update fanin * Update server * Update WireDataFormat * Update Binding * Update Operations * Update interface * Update cmdletization * Update cim * Update management * Update WindowsTaskbarJumpList * Update msh
2018-12-24 07:20:06 +01:00
CimSetCimInstanceContext context = new CimSetCimInstanceContext(
ConstValue.GetNamespace(setCimInstance.Namespace),
setCimInstance.Property,
proxy,
cmdlet.ParameterSetName,
setCimInstance.PassThru);
proxy.ContextObject = context;
}
}
/// <summary>
/// <para>
/// Create <see cref="CimSessionProxy"/> and set properties.
/// </para>
/// </summary>
/// <param name="computerName"></param>
/// <param name="cmdlet"></param>
/// <returns></returns>
protected CimSessionProxy CreateSessionProxy(
string computerName,
CimBaseCommand cmdlet)
{
CimSessionProxy proxy = CreateCimSessionProxy(computerName);
SetSessionProxyProperties(ref proxy, cmdlet);
return proxy;
}
/// <summary>
/// <para>
/// Create <see cref="CimSessionProxy"/> and set properties.
/// </para>
/// </summary>
/// <param name="computerName"></param>
/// <param name="cimInstance"></param>
/// <param name="cmdlet"></param>
/// <returns></returns>
protected CimSessionProxy CreateSessionProxy(
string computerName,
CimInstance cimInstance,
CimBaseCommand cmdlet,
bool passThru)
{
CimSessionProxy proxy = CreateCimSessionProxy(computerName, cimInstance, passThru);
SetSessionProxyProperties(ref proxy, cmdlet);
return proxy;
}
/// <summary>
/// Create <see cref="CimSessionProxy"/> and set properties.
/// </summary>
/// <param name="session"></param>
/// <param name="cmdlet"></param>
/// <returns></returns>
protected CimSessionProxy CreateSessionProxy(
CimSession session,
CimBaseCommand cmdlet)
{
CimSessionProxy proxy = CreateCimSessionProxy(session);
SetSessionProxyProperties(ref proxy, cmdlet);
return proxy;
}
/// <summary>
/// <para>
/// Create <see cref="CimSessionProxy"/> and set properties
/// </para>
/// </summary>
/// <param name="computerName"></param>
/// <param name="cimInstance"></param>
/// <param name="cmdlet"></param>
/// <returns></returns>
protected CimSessionProxy CreateSessionProxy(
string computerName,
CimInstance cimInstance,
CimBaseCommand cmdlet)
{
CimSessionProxy proxy = CreateCimSessionProxy(computerName, cimInstance);
SetSessionProxyProperties(ref proxy, cmdlet);
return proxy;
}
/// <summary>
/// Create <see cref="CimSessionProxy"/> and set properties.
/// </summary>
/// <param name="session"></param>
/// <param name="cmdlet"></param>
/// <returns></returns>
protected CimSessionProxy CreateSessionProxy(
CimSession session,
CimBaseCommand cmdlet,
bool passThru)
{
CimSessionProxy proxy = CreateCimSessionProxy(session, passThru);
SetSessionProxyProperties(ref proxy, cmdlet);
return proxy;
}
/// <summary>
/// Set <see cref="IObjectPreProcess"/> object to proxy to pre-process
/// the result object if necessary.
/// </summary>
/// <param name="proxy"></param>
/// <param name="cmdlet"></param>
private void SetPreProcess(CimSessionProxy proxy, GetCimInstanceCommand cmdlet)
{
if (cmdlet.KeyOnly || (cmdlet.SelectProperties != null))
{
proxy.ObjectPreProcess = new FormatPartialCimInstance();
}
}
#endregion
#region const strings
/// <summary>
/// Wql query format with where clause.
/// </summary>
private const string queryWithWhere = @"SELECT {0} FROM {1} WHERE {2}";
/// <summary>
/// Wql query format without where clause.
/// </summary>
private const string queryWithoutWhere = @"SELECT {0} FROM {1}";
#endregion
}
}