예제 #1
0
        public LocalTopshelfTask(string exeName, string location, string instanceName, string username, string password)
        {
            string args = string.IsNullOrEmpty(instanceName)
                              ? ""
                              : " /instance:" + instanceName;

            if (username != null && password != null)
            {
                var user = username;
                var pass = password;
                if (username.ShouldPrompt())
                {
                    user = _prompt.Prompt("Win Service '{0}' UserName".FormatWith(exeName));
                }
                if (password.ShouldPrompt())
                {
                    pass = _prompt.Prompt("Win Service '{0}' For User '{1}' Password".FormatWith(exeName, username));
                }

                args += " /username:{0} /password:{1}".FormatWith(user, pass);
            }

            _task = new LocalCommandLineTask(new DotNetPath(), exeName)
            {
                Args = "install " + args,
                ExecutableIsLocatedAt = location,
                WorkingDirectory      = location
            };
        }
예제 #2
0
        public override DeploymentResult Execute()
        {
            var result = new DeploymentResult();

            if (UserName.ShouldPrompt())
            {
                UserName = _prompt.Prompt("Win Service '{0}' UserName".FormatWith(ServiceName));
            }

            if (Password.ShouldPrompt())
            {
                Password = _prompt.Prompt("Win Service '{0}' For User '{1}' Password".FormatWith(ServiceName, UserName));
            }

            ServiceReturnCode returnCode = WmiService.Create(MachineName, ServiceName, ServiceDisplayName, ServiceLocation,
                                                             StartMode, UserName, Password, Dependencies);

            if (returnCode != ServiceReturnCode.Success)
            {
                result.AddAlert("Create service returned {0}".FormatWith(returnCode.ToString()));
            }
            else
            {
                result.AddGood("Create service succeeded.");
            }

            return(result);
        }
예제 #3
0
        public RemoteNServiceBusInstallTask(string exeName, string location, string instanceName, PhysicalServer site, string username, string password,
                                            string serviceName, string displayName, string description, bool startManually)
        {
            StringBuilder args = new StringBuilder("/install ");

            if (username != null && password != null)
            {
                var user = username;
                var pass = password;
                if (username.ShouldPrompt())
                {
                    user = _prompt.Prompt("Win Service '{0}' UserName".FormatWith(exeName));
                }
                if (password.ShouldPrompt())
                {
                    pass = _prompt.Prompt("Win Service '{0}' For User '{1}' Password".FormatWith(exeName, username));
                }

                args.Append(" /username:{0} /password:{1}".FormatWith(user, pass));
            }

            if (!string.IsNullOrEmpty(instanceName))
            {
                args.AppendFormat(" /instanceName:{0}", instanceName);
            }
            if (!string.IsNullOrEmpty(serviceName))
            {
                args.AppendFormat(" /serviceName:{0}", serviceName);
            }
            if (!string.IsNullOrEmpty(displayName))
            {
                args.AppendFormat(" /displayName:{0}", displayName);
            }
            if (!string.IsNullOrEmpty(description))
            {
                args.AppendFormat(" /description:{0}", description);
            }
            if (startManually)
            {
                args.Append(" /startManually");
            }

            _task = new RemoteCommandLineTask(exeName)
            {
                Args = args.ToString(),
                ExecutableIsLocatedAt = location,
                Machine          = site.Name,
                WorkingDirectory = location
            };
        }
예제 #4
0
        public RemoteNServiceBusHostTask(string exeName, string location, string instanceName, PhysicalServer site, string username, string password, string serviceName, string displayName, string description, string profiles)
        {
            string args = string.IsNullOrEmpty(instanceName)
                            ? ""
                            : " /instance:\"{0}\"".FormatWith(instanceName);

            if (username != null && password != null)
            {
                var user = username;
                var pass = password;
                if (username.ShouldPrompt())
                {
                    user = _prompt.Prompt("Win Service '{0}' UserName".FormatWith(exeName));
                }
                if (shouldPromptForPassword(username, password))
                {
                    pass = _prompt.Prompt("Win Service '{0}' For User '{1}' Password".FormatWith(exeName, username));
                }

                args += " /userName:\"{0}\" /password:\"{1}\"".FormatWith(user, pass);
            }

            if (!string.IsNullOrEmpty(serviceName))
            {
                args += " /serviceName:\"{0}\"".FormatWith(serviceName);
            }

            if (!string.IsNullOrEmpty(displayName))
            {
                args += " /displayName:\"{0}\"".FormatWith(displayName);
            }

            if (!string.IsNullOrEmpty(description))
            {
                args += " /description:\"{0}\"".FormatWith(description);
            }

            if (!string.IsNullOrEmpty(profiles))
            {
                args += " {0}".FormatWith(profiles);
            }

            _task = new RemoteCommandLineTask(exeName)
            {
                Args = "/install" + args,
                ExecutableIsLocatedAt = location,
                Machine          = site.Name,
                WorkingDirectory = location
            };
        }
예제 #5
0
        protected override void ExecuteCore(Document document)
        {
            PromptService prompt = document.GetService <PromptService>();

            settings.Document = document;

            if (PromptResult.Ok == prompt.Prompt(settings))
            {
                ExecuteDataFunction(settings);
            }
            else
            {
                MessageBox.Show("Tool execution canceled.");
            }
        }