// // 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 { /// /// Activity to invoke the Microsoft.PowerShell.Management\Remove-WmiObject command in a Workflow. /// [System.CodeDom.Compiler.GeneratedCode("Microsoft.PowerShell.Activities.ActivityGenerator.GenerateFromName", "3.0")] public sealed class RemoveWmiObject : PSRemotingActivity { /// /// Gets the display name of the command invoked by this activity. /// public RemoveWmiObject() { this.DisplayName = "Remove-WmiObject"; } /// /// Gets the fully qualified name of the command invoked by this activity. /// public override string PSCommandName { get { return "Microsoft.PowerShell.Management\\Remove-WmiObject"; } } // Arguments /// /// Provides access to the InputObject parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument InputObject { get; set; } /// /// Provides access to the Path parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Path { get; set; } /// /// Provides access to the Class parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Class { get; set; } /// /// Provides access to the AsJob parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument AsJob { get; set; } /// /// Provides access to the Impersonation parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Impersonation { get; set; } /// /// Provides access to the Authentication parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Authentication { get; set; } /// /// Provides access to the Locale parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Locale { get; set; } /// /// Provides access to the EnableAllPrivileges parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument EnableAllPrivileges { get; set; } /// /// Provides access to the Authority parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Authority { get; set; } /// /// Provides access to the Credential parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Credential { get; set; } /// /// Provides access to the ThrottleLimit parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument ThrottleLimit { get; set; } /// /// Provides access to the ComputerName parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument ComputerName { get; set; } /// /// Provides access to the Namespace parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Namespace { get; set; } // Module defining this command // Optional custom code for this activity /// /// Returns a configured instance of System.Management.Automation.PowerShell, pre-populated with the command to run. /// /// The NativeActivityContext for the currently running activity. /// A populated instance of System.Management.Automation.PowerShell /// The infrastructure takes responsibility for closing and disposing the PowerShell instance returned. 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 }; } } }