Beispiel #1
0
        public async Task <Either <PowershellFailure, Unit> > RunAsync(PsCommandBuilder builder, Func <int, Task> reportProgress = null)
        {
            using (var ps = CreateShell())
            {
                builder.Build(ps);

                InitializeAsyncProgressReporting(ps, reportProgress);
                return(await ps.RunAsync().ConfigureAwait(false));
            }
        }
Beispiel #2
0
        public async Task <Either <PowershellFailure, Seq <TypedPsObject <T> > > > GetObjectsAsync <T>(PsCommandBuilder builder, Func <int, Task> reportProgress = null)
        {
            using (var ps = CreateShell())
            {
                builder.Build(ps);
                InitializeAsyncProgressReporting(ps, reportProgress);

                return(await ps.GetObjectsAsync <T>().ConfigureAwait(false));
            }
        }
Beispiel #3
0
        public Either <PowershellFailure, Unit> Run(PsCommandBuilder builder, Action <int> reportProgress = null)
        {
            using (var ps = CreateShell())
            {
                builder.Build(ps);

                InitializeProgressReporting(ps, reportProgress);
                return(ps.Run());
            }
        }
Beispiel #4
0
        public Either <PowershellFailure, Seq <TypedPsObject <T> > > GetObjects <T>(PsCommandBuilder builder, Action <int> reportProgress = null)
        {
            using (var ps = CreateShell())
            {
                builder.Build(ps);

                InitializeProgressReporting(ps, reportProgress);
                return(ps.GetObjects <T>());
            }
        }