// // 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.Core.Activities { /// /// Activity to invoke the Microsoft.PowerShell.Core\Set-PSSessionConfiguration command in a Workflow. /// [System.CodeDom.Compiler.GeneratedCode("Microsoft.PowerShell.Activities.ActivityGenerator.GenerateFromName", "3.0")] public sealed class SetPSSessionConfiguration : PSRemotingActivity { /// /// Gets the display name of the command invoked by this activity. /// public SetPSSessionConfiguration() { this.DisplayName = "Set-PSSessionConfiguration"; } /// /// Gets the fully qualified name of the command invoked by this activity. /// public override string PSCommandName { get { return "Microsoft.PowerShell.Core\\Set-PSSessionConfiguration"; } } // Arguments /// /// Provides access to the Name parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Name { get; set; } /// /// Provides access to the AssemblyName parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument AssemblyName { get; set; } /// /// Provides access to the ApplicationBase parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument ApplicationBase { get; set; } /// /// Provides access to the ConfigurationTypeName parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument ConfigurationTypeName { get; set; } /// /// Provides access to the RunAsCredential parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument RunAsCredential { get; set; } /// /// Provides access to the ThreadApartmentState parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument ThreadApartmentState { get; set; } /// /// Provides access to the ThreadOptions parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument ThreadOptions { get; set; } /// /// Provides access to the AccessMode parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument AccessMode { get; set; } /// /// Provides access to the UseSharedProcess parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument UseSharedProcess { get; set; } /// /// Provides access to the StartupScript parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument StartupScript { get; set; } /// /// Provides access to the MaximumReceivedDataSizePerCommandMB parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument> MaximumReceivedDataSizePerCommandMB { get; set; } /// /// Provides access to the MaximumReceivedObjectSizeMB parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument> MaximumReceivedObjectSizeMB { get; set; } /// /// Provides access to the SecurityDescriptorSddl parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument SecurityDescriptorSddl { get; set; } /// /// Provides access to the ShowSecurityDescriptorUI parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument ShowSecurityDescriptorUI { get; set; } /// /// Provides access to the Force parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Force { get; set; } /// /// Provides access to the NoServiceRestart parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument NoServiceRestart { get; set; } /// /// Provides access to the PSVersion parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument PSVersion { get; set; } /// /// Provides access to the SessionTypeOption parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument SessionTypeOption { get; set; } /// /// Provides access to the TransportOption parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument TransportOption { get; set; } /// /// Provides access to the ModulesToImport parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument ModulesToImport { get; set; } /// /// Provides access to the Path parameter. /// [ParameterSpecificCategory] [DefaultValue(null)] public InArgument Path { 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 Sytem.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(Name.Expression != null) { targetCommand.AddParameter("Name", Name.Get(context)); } if(AssemblyName.Expression != null) { targetCommand.AddParameter("AssemblyName", AssemblyName.Get(context)); } if(ApplicationBase.Expression != null) { targetCommand.AddParameter("ApplicationBase", ApplicationBase.Get(context)); } if(ConfigurationTypeName.Expression != null) { targetCommand.AddParameter("ConfigurationTypeName", ConfigurationTypeName.Get(context)); } if(RunAsCredential.Expression != null) { targetCommand.AddParameter("RunAsCredential", RunAsCredential.Get(context)); } if(ThreadApartmentState.Expression != null) { targetCommand.AddParameter("ThreadApartmentState", ThreadApartmentState.Get(context)); } if(ThreadOptions.Expression != null) { targetCommand.AddParameter("ThreadOptions", ThreadOptions.Get(context)); } if(AccessMode.Expression != null) { targetCommand.AddParameter("AccessMode", AccessMode.Get(context)); } if(UseSharedProcess.Expression != null) { targetCommand.AddParameter("UseSharedProcess", UseSharedProcess.Get(context)); } if(StartupScript.Expression != null) { targetCommand.AddParameter("StartupScript", StartupScript.Get(context)); } if(MaximumReceivedDataSizePerCommandMB.Expression != null) { targetCommand.AddParameter("MaximumReceivedDataSizePerCommandMB", MaximumReceivedDataSizePerCommandMB.Get(context)); } if(MaximumReceivedObjectSizeMB.Expression != null) { targetCommand.AddParameter("MaximumReceivedObjectSizeMB", MaximumReceivedObjectSizeMB.Get(context)); } if(SecurityDescriptorSddl.Expression != null) { targetCommand.AddParameter("SecurityDescriptorSddl", SecurityDescriptorSddl.Get(context)); } if(ShowSecurityDescriptorUI.Expression != null) { targetCommand.AddParameter("ShowSecurityDescriptorUI", ShowSecurityDescriptorUI.Get(context)); } if(Force.Expression != null) { targetCommand.AddParameter("Force", Force.Get(context)); } if(NoServiceRestart.Expression != null) { targetCommand.AddParameter("NoServiceRestart", NoServiceRestart.Get(context)); } if(PSVersion.Expression != null) { targetCommand.AddParameter("PSVersion", PSVersion.Get(context)); } if(SessionTypeOption.Expression != null) { targetCommand.AddParameter("SessionTypeOption", SessionTypeOption.Get(context)); } if(TransportOption.Expression != null) { targetCommand.AddParameter("TransportOption", TransportOption.Get(context)); } if(ModulesToImport.Expression != null) { targetCommand.AddParameter("ModulesToImport", ModulesToImport.Get(context)); } if(Path.Expression != null) { targetCommand.AddParameter("Path", Path.Get(context)); } return new ActivityImplementationContext() { PowerShellInstance = invoker }; } } }