mirror of
https://github.com/aphrody-labs/PowerShell.git
synced 2026-10-17 12:45:47 +00:00
215 lines
7.3 KiB
C#
215 lines
7.3 KiB
C#
//
|
|
// Copyright (C) Microsoft. All rights reserved.
|
|
//
|
|
using Microsoft.PowerShell.Activities;
|
|
using System.Management.Automation;
|
|
using System.Activities;
|
|
using System.Collections.Generic;
|
|
using System.ComponentModel;
|
|
|
|
|
|
namespace Microsoft.PowerShell.Management.Activities
|
|
{
|
|
/// <summary>
|
|
/// Activity to invoke the Microsoft.PowerShell.Management\Remove-WmiObject command in a Workflow.
|
|
/// </summary>
|
|
[System.CodeDom.Compiler.GeneratedCode("Microsoft.PowerShell.Activities.ActivityGenerator.GenerateFromName", "3.0")]
|
|
public sealed class RemoveWmiObject : PSRemotingActivity
|
|
{
|
|
/// <summary>
|
|
/// Gets the display name of the command invoked by this activity.
|
|
/// </summary>
|
|
public RemoveWmiObject()
|
|
{
|
|
this.DisplayName = "Remove-WmiObject";
|
|
}
|
|
|
|
/// <summary>
|
|
/// Gets the fully qualified name of the command invoked by this activity.
|
|
/// </summary>
|
|
public override string PSCommandName { get { return "Microsoft.PowerShell.Management\\Remove-WmiObject"; } }
|
|
|
|
// Arguments
|
|
|
|
/// <summary>
|
|
/// Provides access to the InputObject parameter.
|
|
/// </summary>
|
|
[ParameterSpecificCategory]
|
|
[DefaultValue(null)]
|
|
public InArgument<System.Management.ManagementObject> InputObject { get; set; }
|
|
|
|
/// <summary>
|
|
/// Provides access to the Path parameter.
|
|
/// </summary>
|
|
[ParameterSpecificCategory]
|
|
[DefaultValue(null)]
|
|
public InArgument<System.String> Path { get; set; }
|
|
|
|
/// <summary>
|
|
/// Provides access to the Class parameter.
|
|
/// </summary>
|
|
[ParameterSpecificCategory]
|
|
[DefaultValue(null)]
|
|
public InArgument<System.String> Class { get; set; }
|
|
|
|
/// <summary>
|
|
/// Provides access to the AsJob parameter.
|
|
/// </summary>
|
|
[ParameterSpecificCategory]
|
|
[DefaultValue(null)]
|
|
public InArgument<System.Management.Automation.SwitchParameter> AsJob { get; set; }
|
|
|
|
/// <summary>
|
|
/// Provides access to the Impersonation parameter.
|
|
/// </summary>
|
|
[ParameterSpecificCategory]
|
|
[DefaultValue(null)]
|
|
public InArgument<System.Management.ImpersonationLevel> Impersonation { get; set; }
|
|
|
|
/// <summary>
|
|
/// Provides access to the Authentication parameter.
|
|
/// </summary>
|
|
[ParameterSpecificCategory]
|
|
[DefaultValue(null)]
|
|
public InArgument<System.Management.AuthenticationLevel> Authentication { get; set; }
|
|
|
|
/// <summary>
|
|
/// Provides access to the Locale parameter.
|
|
/// </summary>
|
|
[ParameterSpecificCategory]
|
|
[DefaultValue(null)]
|
|
public InArgument<System.String> Locale { get; set; }
|
|
|
|
/// <summary>
|
|
/// Provides access to the EnableAllPrivileges parameter.
|
|
/// </summary>
|
|
[ParameterSpecificCategory]
|
|
[DefaultValue(null)]
|
|
public InArgument<System.Management.Automation.SwitchParameter> EnableAllPrivileges { get; set; }
|
|
|
|
/// <summary>
|
|
/// Provides access to the Authority parameter.
|
|
/// </summary>
|
|
[ParameterSpecificCategory]
|
|
[DefaultValue(null)]
|
|
public InArgument<System.String> Authority { get; set; }
|
|
|
|
/// <summary>
|
|
/// Provides access to the Credential parameter.
|
|
/// </summary>
|
|
[ParameterSpecificCategory]
|
|
[DefaultValue(null)]
|
|
public InArgument<System.Management.Automation.PSCredential> Credential { get; set; }
|
|
|
|
/// <summary>
|
|
/// Provides access to the ThrottleLimit parameter.
|
|
/// </summary>
|
|
[ParameterSpecificCategory]
|
|
[DefaultValue(null)]
|
|
public InArgument<System.Int32> ThrottleLimit { get; set; }
|
|
|
|
/// <summary>
|
|
/// Provides access to the ComputerName parameter.
|
|
/// </summary>
|
|
[ParameterSpecificCategory]
|
|
[DefaultValue(null)]
|
|
public InArgument<System.String[]> ComputerName { get; set; }
|
|
|
|
/// <summary>
|
|
/// Provides access to the Namespace parameter.
|
|
/// </summary>
|
|
[ParameterSpecificCategory]
|
|
[DefaultValue(null)]
|
|
public InArgument<System.String> Namespace { get; set; }
|
|
|
|
|
|
// Module defining this command
|
|
|
|
|
|
// Optional custom code for this activity
|
|
|
|
|
|
/// <summary>
|
|
/// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run.
|
|
/// </summary>
|
|
/// <param name="context">The NativeActivityContext for the currently running activity.</param>
|
|
/// <returns>A populated instance of Sytem.Management.Automation.PowerShell</returns>
|
|
/// <remarks>The infrastructure takes responsibility for closing and disposing the PowerShell instance returned.</remarks>
|
|
protected override ActivityImplementationContext GetPowerShell(NativeActivityContext context)
|
|
{
|
|
System.Management.Automation.PowerShell invoker = global::System.Management.Automation.PowerShell.Create();
|
|
System.Management.Automation.PowerShell targetCommand = invoker.AddCommand(PSCommandName);
|
|
|
|
// Initialize the arguments
|
|
|
|
if(InputObject.Expression != null)
|
|
{
|
|
targetCommand.AddParameter("InputObject", InputObject.Get(context));
|
|
}
|
|
|
|
if(Path.Expression != null)
|
|
{
|
|
targetCommand.AddParameter("Path", Path.Get(context));
|
|
}
|
|
|
|
if(Class.Expression != null)
|
|
{
|
|
targetCommand.AddParameter("Class", Class.Get(context));
|
|
}
|
|
|
|
if(AsJob.Expression != null)
|
|
{
|
|
targetCommand.AddParameter("AsJob", AsJob.Get(context));
|
|
}
|
|
|
|
if(Impersonation.Expression != null)
|
|
{
|
|
targetCommand.AddParameter("Impersonation", Impersonation.Get(context));
|
|
}
|
|
|
|
if(Authentication.Expression != null)
|
|
{
|
|
targetCommand.AddParameter("Authentication", Authentication.Get(context));
|
|
}
|
|
|
|
if(Locale.Expression != null)
|
|
{
|
|
targetCommand.AddParameter("Locale", Locale.Get(context));
|
|
}
|
|
|
|
if(EnableAllPrivileges.Expression != null)
|
|
{
|
|
targetCommand.AddParameter("EnableAllPrivileges", EnableAllPrivileges.Get(context));
|
|
}
|
|
|
|
if(Authority.Expression != null)
|
|
{
|
|
targetCommand.AddParameter("Authority", Authority.Get(context));
|
|
}
|
|
|
|
if(Credential.Expression != null)
|
|
{
|
|
targetCommand.AddParameter("Credential", Credential.Get(context));
|
|
}
|
|
|
|
if(ThrottleLimit.Expression != null)
|
|
{
|
|
targetCommand.AddParameter("ThrottleLimit", ThrottleLimit.Get(context));
|
|
}
|
|
|
|
if(ComputerName.Expression != null)
|
|
{
|
|
targetCommand.AddParameter("ComputerName", ComputerName.Get(context));
|
|
}
|
|
|
|
if(Namespace.Expression != null)
|
|
{
|
|
targetCommand.AddParameter("Namespace", Namespace.Get(context));
|
|
}
|
|
|
|
|
|
return new ActivityImplementationContext() { PowerShellInstance = invoker };
|
|
}
|
|
}
|
|
}
|