/// <summary>
        /// Installs any dependent software via a DOS command file before executing the configured file list.
        /// </summary>
        /// <param name="executionData"></param>
        public void Setup(PluginExecutionData executionData)
        {
            _activityData = executionData?.GetMetadata <ExecutorActivityData>();

            if (!string.IsNullOrEmpty(_activityData?.SetupFileName))
            {
                SystemSetup.Run(_activityData.SetupFileName, string.Empty, executionData?.Credential, _activityData.CopyDirectory);
            }
        }
Пример #2
0
        /// <summary>
        /// Selects all of the Printing activities from the manifest and determines which (if any) use local print queues.
        /// Certificates are installed for each local print queue.
        /// </summary>
        protected virtual void InstallPrintingCertficates()
        {
            if (_manifest.ActivityPrintQueues.Values.OfType <DynamicLocalPrintQueueInfo>().Any())
            {
                NetworkCredential adminCredential = new NetworkCredential();
                adminCredential.UserName = GlobalSettings.Items[Setting.DomainAdminUserName];
                adminCredential.Password = GlobalSettings.Items[Setting.DomainAdminPassword];
                adminCredential.Domain   = Environment.UserDomainName;

                SystemSetup.Run(GlobalDataStore.Manifest.Settings[Framework.Settings.Setting.PrintingCertsInstaller], adminCredential, true);
            }
        }
Пример #3
0
        /// <summary>
        /// Iterates through the list of installers to be executed.
        /// If a reboot is required, the location of the last executed installer is persisted to the registry.
        /// Upon restart, cycles through the list until the installer startup index is found,
        /// then resumes installation.
        /// </summary>
        protected virtual void InstallClientSoftware()
        {
            bool reboot = false;
            NetworkCredential adminCredential = null;

            if (_manifest.SoftwareInstallers.Count > 0)
            {
                TraceFactory.Logger.Debug("StartIndex: {0}".FormatWith(_installerStartIndex));
                adminCredential          = new NetworkCredential();
                adminCredential.UserName = GlobalSettings.Items[Setting.DomainAdminUserName];
                adminCredential.Password = GlobalSettings.Items[Setting.DomainAdminPassword];
                adminCredential.Domain   = Environment.UserDomainName;
            }
            else //No Installers.  Return immediately.
            {
                return;
            }

            // Execute the installers
            int index = -1;

            foreach (SoftwareInstallerDetail installer in _manifest.SoftwareInstallers.OrderBy(i => i.InstallOrderNumber))
            {
                index++;
                if (index >= _installerStartIndex)
                {
                    // Install the specified software, but send a status message back periodically to ensure
                    // the dispatcher doesn't think the client is hung and then tries to reboot it.

                    _installerMessage = "Installing {0}".FormatWith(installer.Description);
                    SendStatusMessage(_installerMessage);

                    using (System.Timers.Timer installerTimer = new System.Timers.Timer(TimeSpan.FromMinutes(1).TotalMilliseconds))
                    {
                        try
                        {
                            installerTimer.Elapsed += installerTimer_Elapsed;
                            installerTimer.Start();
                            SystemSetup.Run(installer.Path, installer.Arguments, adminCredential, installer.CopyDirectory);
                        }
                        finally
                        {
                            installerTimer.Stop();
                        }
                    }

                    reboot = RebootRequired(installer.RebootMode);
                    if (installer.RebootMode == RebootMode.Immediate)
                    {
                        break;
                    }
                }
            }

            //Check to see if we need to reboot
            //We may be rebooting because of an immediate reboot, or because we're finished and a deferred reboot was found.
            if (reboot)
            {
                SendStatusMessage("Install complete - rebooting");
                SetStartupRegistryValue(index);
                Reboot();
            }
        }