Beispiel #1
0
        private static async Task <Result <PendingRebootInfo> > GetCbsRebootPending()
        {
            var rebootPendingRegistryKeyPath = @"SOFTWARE\Microsoft\Windows\CurrentVersion\Component Based Servicing\RebootPending";

            Logging.DefaultLogger.Debug($@"Checking if Component Based Servicing has a pending reboot (Check if key exists: '{rebootPendingRegistryKeyPath}').");
            var rebootIsPending = RegistryOperations.RegistryKeyExists(Registry.LocalMachine, rebootPendingRegistryKeyPath);
            var rebootSource    = rebootIsPending ? new List <RebootSource> {
                RebootSource.Cbs
            } : new List <RebootSource>();
            var pendingRebootInfo = new PendingRebootInfo {
                RebootIsPending = rebootIsPending, Sources = rebootSource
            };

            Logging.DefaultLogger.Info($@"Component Based Servicing (CBS) pending reboot check result: {pendingRebootInfo.ObjectToString()}");
            return(await Task.FromResult(new Result <PendingRebootInfo>(pendingRebootInfo)).ConfigureAwait(false));
        }