protected override void ProcessRecord() { var psPath = SessionState.Path.GetUnresolvedProviderPathFromPSPath(UnattendFile, out _, out _); var details = ServiceControlNewInstance.Load(psPath); details.ServiceAccount = ServiceAccount; details.ServiceAccountPwd = Password; var zipfolder = Path.GetDirectoryName(MyInvocation.MyCommand.Module.Path); var logger = new PSLogger(Host); var installer = new UnattendServiceControlInstaller(logger, zipfolder); try { logger.Info("Installing Service Control instance..."); if (installer.Add(details, PromptToProceed)) { var instance = InstanceFinder.FindServiceControlInstance(details.Name); if (instance != null) { WriteObject(PsServiceControl.FromInstance(instance)); } else { throw new Exception("Unknown error creating instance"); } } } catch (Exception ex) { ThrowTerminatingError(new ErrorRecord(ex, null, ErrorCategory.NotSpecified, null)); } }
protected override void ProcessRecord() { var details = new ServiceControlNewInstance { InstallPath = InstallPath, LogPath = LogPath, DBPath = DBPath, Name = Name, DisplayName = string.IsNullOrWhiteSpace(DisplayName) ? Name : DisplayName, ServiceDescription = Description, ServiceAccount = ServiceAccount, ServiceAccountPwd = ServiceAccountPassword, HostName = HostName, Port = Port, DatabaseMaintenancePort = DatabaseMaintenancePort, VirtualDirectory = VirtualDirectory, AuditQueue = AuditQueue, ErrorQueue = ErrorQueue, AuditLogQueue = string.IsNullOrWhiteSpace(AuditLogQueue) ? null : AuditLogQueue, ErrorLogQueue = string.IsNullOrWhiteSpace(ErrorLogQueue) ? null : ErrorLogQueue, ForwardAuditMessages = ForwardAuditMessages.ToBool(), ForwardErrorMessages = ForwardErrorMessages.ToBool(), AuditRetentionPeriod = AuditRetentionPeriod, ErrorRetentionPeriod = ErrorRetentionPeriod, ConnectionString = ConnectionString, TransportPackage = ServiceControlCoreTransports.All.First(t => t.Matches(Transport)), SkipQueueCreation = SkipQueueCreation }; var zipfolder = Path.GetDirectoryName(MyInvocation.MyCommand.Module.Path); var logger = new PSLogger(Host); var installer = new UnattendServiceControlInstaller(logger, zipfolder); try { logger.Info("Installing Service Control instance..."); if (installer.Add(details, PromptToProceed)) { var instance = InstanceFinder.FindServiceControlInstance(details.Name); if (instance != null) { WriteObject(PsServiceControl.FromInstance(instance)); } else { throw new Exception("Unknown error creating instance"); } } } catch (Exception ex) { ThrowTerminatingError(new ErrorRecord(ex, null, ErrorCategory.NotSpecified, null)); } }
protected override void ProcessRecord() { var details = new MonitoringNewInstance { InstallPath = InstallPath, LogPath = LogPath, Name = Name, DisplayName = string.IsNullOrWhiteSpace(DisplayName) ? Name : DisplayName, ServiceDescription = Description, ServiceAccount = ServiceAccount, ServiceAccountPwd = ServiceAccountPassword, HostName = HostName, Port = Port, ErrorQueue = ErrorQueue, ConnectionString = ConnectionString, TransportPackage = MonitoringTransports.All.First(t => t.Matches(Transport)), SkipQueueCreation = SkipQueueCreation }; var zipfolder = Path.GetDirectoryName(MyInvocation.MyCommand.Module.Path); var logger = new PSLogger(Host); var installer = new UnattendMonitoringInstaller(logger, zipfolder); try { logger.Info("Installing Monitoring instance..."); if (installer.Add(details, PromptToProceed)) { var instance = InstanceFinder.FindMonitoringInstance(details.Name); if (instance != null) { WriteObject(PsMonitoringService.FromInstance(instance)); } else { throw new Exception("Unknown error creating instance"); } } } catch (Exception ex) { ThrowTerminatingError(new ErrorRecord(ex, null, ErrorCategory.NotSpecified, null)); } }