diff --git a/ActiveDirectoryQuerier/PowerShell/PSExecutor.cs b/ActiveDirectoryQuerier/PowerShell/PSExecutor.cs index 02ef166..9385912 100644 --- a/ActiveDirectoryQuerier/PowerShell/PSExecutor.cs +++ b/ActiveDirectoryQuerier/PowerShell/PSExecutor.cs @@ -21,23 +21,6 @@ public PSExecutor() _powerShell.Commands.Clear(); } - private void AssembleFullCommand(Command psCommand, OutputFormat outputFormat) - { - ArgumentNullException.ThrowIfNull(psCommand); - - _powerShell.Commands.AddCommand(psCommand.CommandText); - - foreach (var parameter in psCommand.Parameters) - { - _powerShell.Commands.AddParameter(parameter.Name, parameter.Value); - } - - if (outputFormat == OutputFormat.Csv) - { - _powerShell.Commands.AddCommand("ConvertTo-Csv").AddParameter("NoTypeInformation"); - } - } - public PSOutput Execute(Command psCommand, OutputFormat outputFormat = OutputFormat.Text) { try @@ -71,6 +54,23 @@ public async Task ExecuteAsync(Command command, OutputFormat outputFor return HandleExecutionException(exception); } } + + private void AssembleFullCommand(Command psCommand, OutputFormat outputFormat) + { + ArgumentNullException.ThrowIfNull(psCommand); + + _powerShell.Commands.AddCommand(psCommand.CommandText); + + foreach (var parameter in psCommand.Parameters) + { + _powerShell.Commands.AddParameter(parameter.Name, parameter.Value); + } + + if (outputFormat == OutputFormat.Csv) + { + _powerShell.Commands.AddCommand("ConvertTo-Csv").AddParameter("NoTypeInformation"); + } + } private PSOutput ProcessExecutionResults(IEnumerable results) {