Пример #1
0
        public DtoBoolResponse RestartPrintSpooler()
        {
            var result = new ServiceSystemService().RestartPrintSpooler();

            return(new DtoBoolResponse {
                Value = result
            });
        }
Пример #2
0
        public bool Run(DtoImagePrepOptions imagePrepOptions)
        {
            if (imagePrepOptions == null)
            {
                AppendLogText("Image Prep Cancelled.");
                return(false);
            }

            if (imagePrepOptions.RunSysprep && string.IsNullOrEmpty(imagePrepOptions.SysprepAnswerPath))
            {
                AppendLogText("A Sysprep Answer File Was Not Defined.  Image Prep Cancelled");
                return(false);
            }

            AppendLogText("Preparing Computer For Image: ");
            AppendLogText("Checking Toec Service");
            var servResult = new ServiceSystemService().StopToec();

            if (!servResult)
            {
                AppendLogText("Toec Service Must Be Stopped Before Preparing Image.");
                return(false);
            }

            _imagePrepOptions = imagePrepOptions;

            DisableHibernation();
            AddDriverRegistry();
            EnableWinLogonBackground();
            CreateSetupComplete();
            ResetToec();
            RunSysprep();

            File.Create($"{Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles)}\\Toec\\image_prepped");
            AppendLogText("Prepare Image Finished");
            return(true);
        }