private string GetExeFileCommandLineArguments(CodeActivityContext context) { string doNotDeleteArgument = "-enableRule:DoNotDeleteRule"; string computerNameArgument = string.Format("computerName='{0}',", ComputerName.Get(context)); string userNameArgument = string.Format("userName='******',", Username.Get(context)); string passwordArgument = string.Format("password='******',", Password.Get(context)); string webApplicationArgument = string.Format("-setParam:'IIS Web Application Name'='{0}'", IISWebApplication.Get(context)); string msdeployArguments = (Test.Get(context) ? "-whatif" : ""); msdeployArguments += " -source:package='{0}' -dest:auto,{1}{2}{3}authtype='Basic',includeAcls='False' -verb:sync -disableLink:AppPoolExtension -disableLink:ContentExtension -disableLink:CertificateExtension -setParamFile:\"{4}\" {5} {6} {7} {8}"; msdeployArguments = string.Format(msdeployArguments, Path.GetFullPath(ZipPackageFilename.Get(context)), (string.IsNullOrEmpty(ComputerName.Get(context)) ? "" : computerNameArgument), (string.IsNullOrEmpty(Username.Get(context)) ? "" : userNameArgument), (string.IsNullOrEmpty(Password.Get(context)) ? "" : passwordArgument), Path.GetFullPath(ParamFilename.Get(context)), (string.IsNullOrEmpty(IISWebApplication.Get(context)) ? "" : webApplicationArgument), (DoNotDeleteFiles.Get(context) ? doNotDeleteArgument : ""), (AllowUntrustedSSLConnection.Get(context) ? "-allowUntrusted" : ""), (!string.IsNullOrEmpty(CommandLineParams.Get(context)) ? CommandLineParams.Get(context) : "")).Trim(); return(msdeployArguments); }
// 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 System.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 (Authentication.Expression != null) { targetCommand.AddParameter("Authentication", Authentication.Get(context)); } if ((ComputerName.Expression != null) && (PSRemotingBehavior.Get(context) != RemotingBehavior.Custom)) { targetCommand.AddParameter("ComputerName", ComputerName.Get(context)); } if (Port.Expression != null) { targetCommand.AddParameter("Port", Port.Get(context)); } if (UseSSL.Expression != null) { targetCommand.AddParameter("UseSSL", UseSSL.Get(context)); } if (ApplicationName.Expression != null) { targetCommand.AddParameter("ApplicationName", ApplicationName.Get(context)); } if (Credential.Expression != null) { targetCommand.AddParameter("Credential", Credential.Get(context)); } if (CertificateThumbprint.Expression != null) { targetCommand.AddParameter("CertificateThumbprint", CertificateThumbprint.Get(context)); } if (GetIsComputerNameSpecified(context) && (PSRemotingBehavior.Get(context) == RemotingBehavior.Custom)) { targetCommand.AddParameter("ComputerName", PSComputerName.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
// 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((ComputerName.Expression != null) && (PSRemotingBehavior.Get(context) != RemotingBehavior.Custom)) { targetCommand.AddParameter("ComputerName", ComputerName.Get(context)); } if(GetIsComputerNameSpecified(context) && (PSRemotingBehavior.Get(context) == RemotingBehavior.Custom)) { targetCommand.AddParameter("ComputerName", PSComputerName.Get(context)); } return new ActivityImplementationContext() { PowerShellInstance = invoker }; }
private string GetCmdFileCommandLineArguments(CodeActivityContext context) { string doNotDeleteArgument = "-enableRule:DoNotDeleteRule"; string computerNameArgument = string.Format("/M:{0}", ComputerName.Get(context)); string userNameArgument = string.Format("/U:{0}", Username.Get(context)); string passwordArgument = string.Format("/P:{0}", Password.Get(context)); string webApplicationArgument = string.Format("\"-setParam:'IIS Web Application Name'='{0}'\"", IISWebApplication.Get(context)); string msdeployArguments = (Test.Get(context) ? "/t" : "/y"); msdeployArguments += " {0} {1} {2} {3} {4} {5} {6}"; msdeployArguments = string.Format(msdeployArguments, (!string.IsNullOrEmpty(IISWebApplication.Get(context)) ? webApplicationArgument : ""), (DoNotDeleteFiles.Get(context) ? doNotDeleteArgument : ""), (!string.IsNullOrEmpty(ComputerName.Get(context)) ? computerNameArgument : ""), (!string.IsNullOrEmpty(Username.Get(context)) ? userNameArgument : ""), (!string.IsNullOrEmpty(Password.Get(context)) ? passwordArgument : ""), (AllowUntrustedSSLConnection.Get(context) ? "-allowUntrusted" : ""), (!string.IsNullOrEmpty(CommandLineParams.Get(context)) ? CommandLineParams.Get(context) : "")).Trim(); return(msdeployArguments); }
// 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 System.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 (ApplicationName.Expression != null) { targetCommand.AddParameter("ApplicationName", ApplicationName.Get(context)); } if (BasePropertiesOnly.Expression != null) { targetCommand.AddParameter("BasePropertiesOnly", BasePropertiesOnly.Get(context)); } if ((ComputerName.Expression != null) && (PSRemotingBehavior.Get(context) != RemotingBehavior.Custom)) { targetCommand.AddParameter("ComputerName", ComputerName.Get(context)); } if (ConnectionURI.Expression != null) { targetCommand.AddParameter("ConnectionURI", ConnectionURI.Get(context)); } if (Dialect.Expression != null) { targetCommand.AddParameter("Dialect", Dialect.Get(context)); } if (Enumerate.Expression != null) { targetCommand.AddParameter("Enumerate", Enumerate.Get(context)); } if (Filter.Expression != null) { targetCommand.AddParameter("Filter", Filter.Get(context)); } if (Fragment.Expression != null) { targetCommand.AddParameter("Fragment", Fragment.Get(context)); } if (OptionSet.Expression != null) { targetCommand.AddParameter("OptionSet", OptionSet.Get(context)); } if (Port.Expression != null) { targetCommand.AddParameter("Port", Port.Get(context)); } if (Associations.Expression != null) { targetCommand.AddParameter("Associations", Associations.Get(context)); } if (ResourceURI.Expression != null) { targetCommand.AddParameter("ResourceURI", ResourceURI.Get(context)); } if (ReturnType.Expression != null) { targetCommand.AddParameter("ReturnType", ReturnType.Get(context)); } if (SelectorSet.Expression != null) { targetCommand.AddParameter("SelectorSet", SelectorSet.Get(context)); } if (SessionOption.Expression != null) { targetCommand.AddParameter("SessionOption", SessionOption.Get(context)); } if (Shallow.Expression != null) { targetCommand.AddParameter("Shallow", Shallow.Get(context)); } if (UseSSL.Expression != null) { targetCommand.AddParameter("UseSSL", UseSSL.Get(context)); } if (Credential.Expression != null) { targetCommand.AddParameter("Credential", Credential.Get(context)); } if (Authentication.Expression != null) { targetCommand.AddParameter("Authentication", Authentication.Get(context)); } if (CertificateThumbprint.Expression != null) { targetCommand.AddParameter("CertificateThumbprint", CertificateThumbprint.Get(context)); } if (GetIsComputerNameSpecified(context) && (PSRemotingBehavior.Get(context) == RemotingBehavior.Custom)) { targetCommand.AddParameter("ComputerName", PSComputerName.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
// 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 System.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 (Arguments.Expression != null) { targetCommand.AddParameter("Arguments", Arguments.Get(context)); } if (PutType.Expression != null) { targetCommand.AddParameter("PutType", PutType.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 }); }
// 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 System.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 (ComputerName.Expression != null) { targetCommand.AddParameter("ComputerName", ComputerName.Get(context)); } if (ApplicationName.Expression != null) { targetCommand.AddParameter("ApplicationName", ApplicationName.Get(context)); } if (ConnectionUri.Expression != null) { targetCommand.AddParameter("ConnectionUri", ConnectionUri.Get(context)); } if (ConfigurationName.Expression != null) { targetCommand.AddParameter("ConfigurationName", ConfigurationName.Get(context)); } if (AllowRedirection.Expression != null) { targetCommand.AddParameter("AllowRedirection", AllowRedirection.Get(context)); } if (Name.Expression != null) { targetCommand.AddParameter("Name", Name.Get(context)); } if (InstanceId.Expression != null) { targetCommand.AddParameter("InstanceId", InstanceId.Get(context)); } if (Credential.Expression != null) { targetCommand.AddParameter("Credential", Credential.Get(context)); } if (Authentication.Expression != null) { targetCommand.AddParameter("Authentication", Authentication.Get(context)); } if (CertificateThumbprint.Expression != null) { targetCommand.AddParameter("CertificateThumbprint", CertificateThumbprint.Get(context)); } if (Port.Expression != null) { targetCommand.AddParameter("Port", Port.Get(context)); } if (UseSSL.Expression != null) { targetCommand.AddParameter("UseSSL", UseSSL.Get(context)); } if (ThrottleLimit.Expression != null) { targetCommand.AddParameter("ThrottleLimit", ThrottleLimit.Get(context)); } if (State.Expression != null) { targetCommand.AddParameter("State", State.Get(context)); } if (SessionOption.Expression != null) { targetCommand.AddParameter("SessionOption", SessionOption.Get(context)); } if (PSSessionId.Expression != null) { targetCommand.AddParameter("Id", PSSessionId.Get(context)); } if (ContainerId.Expression != null) { targetCommand.AddParameter("ContainerId", ContainerId.Get(context)); } if (VMId.Expression != null) { targetCommand.AddParameter("VMId", VMId.Get(context)); } if (VMName.Expression != null) { targetCommand.AddParameter("VMName", VMName.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
// 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 (AsJob.Expression != null) { targetCommand.AddParameter("AsJob", AsJob.Get(context)); } if (DcomAuthentication.Expression != null) { targetCommand.AddParameter("DcomAuthentication", DcomAuthentication.Get(context)); } if (WsmanAuthentication.Expression != null) { targetCommand.AddParameter("WsmanAuthentication", WsmanAuthentication.Get(context)); } if (Protocol.Expression != null) { targetCommand.AddParameter("Protocol", Protocol.Get(context)); } if (BufferSize.Expression != null) { targetCommand.AddParameter("BufferSize", BufferSize.Get(context)); } if (ComputerName.Expression != null) { targetCommand.AddParameter("ComputerName", ComputerName.Get(context)); } if (Count.Expression != null) { targetCommand.AddParameter("Count", Count.Get(context)); } if (Credential.Expression != null) { targetCommand.AddParameter("Credential", Credential.Get(context)); } if (Source.Expression != null) { targetCommand.AddParameter("Source", Source.Get(context)); } if (Impersonation.Expression != null) { targetCommand.AddParameter("Impersonation", Impersonation.Get(context)); } if (ThrottleLimit.Expression != null) { targetCommand.AddParameter("ThrottleLimit", ThrottleLimit.Get(context)); } if (TimeToLive.Expression != null) { targetCommand.AddParameter("TimeToLive", TimeToLive.Get(context)); } if (Delay.Expression != null) { targetCommand.AddParameter("Delay", Delay.Get(context)); } if (Quiet.Expression != null) { targetCommand.AddParameter("Quiet", Quiet.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }
// 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 System.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 (Namespace.Expression != null) { targetCommand.AddParameter("Namespace", Namespace.Get(context)); } if (Credential.Expression != null) { targetCommand.AddParameter("Credential", Credential.Get(context)); } if (ComputerName.Expression != null) { targetCommand.AddParameter("ComputerName", ComputerName.Get(context)); } if (Class.Expression != null) { targetCommand.AddParameter("Class", Class.Get(context)); } if (Query.Expression != null) { targetCommand.AddParameter("Query", Query.Get(context)); } if (Timeout.Expression != null) { targetCommand.AddParameter("Timeout", Timeout.Get(context)); } if (SourceIdentifier.Expression != null) { targetCommand.AddParameter("SourceIdentifier", SourceIdentifier.Get(context)); } if (Action.Expression != null) { targetCommand.AddParameter("Action", Action.Get(context)); } if (MessageData.Expression != null) { targetCommand.AddParameter("MessageData", MessageData.Get(context)); } if (SupportEvent.Expression != null) { targetCommand.AddParameter("SupportEvent", SupportEvent.Get(context)); } if (Forward.Expression != null) { targetCommand.AddParameter("Forward", Forward.Get(context)); } if (MaxTriggerCount.Expression != null) { targetCommand.AddParameter("MaxTriggerCount", MaxTriggerCount.Get(context)); } return(new ActivityImplementationContext() { PowerShellInstance = invoker }); }