From 07692ff2414afe42d5c979b6f5bd95a205ae519c Mon Sep 17 00:00:00 2001 From: bwatters-r7 Date: Wed, 23 Jul 2025 09:40:35 -0500 Subject: [PATCH 1/2] Remove errant write_log call and swap to the all-in-one psh_exec rather than execute_script --- .../post/windows/manage/powershell/exec_powershell.rb | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/modules/post/windows/manage/powershell/exec_powershell.rb b/modules/post/windows/manage/powershell/exec_powershell.rb index 71bbfdb58ef49..c1bff350ea537 100644 --- a/modules/post/windows/manage/powershell/exec_powershell.rb +++ b/modules/post/windows/manage/powershell/exec_powershell.rb @@ -118,15 +118,8 @@ def run # Execute the powershell script print_status('Executing the script.') - cmd_out, running_pids, open_channels = execute_script(script, datastore['TIMEOUT']) - - # Write output to log - print_status("Logging output to #{log_file}.") - write_to_log(cmd_out, log_file, eof) - - # Clean up - print_status('Cleaning up residual objects and processes.') - clean_up(datastore['SCRIPT'], eof, running_pids, open_channels, env_suffix) + cmd_out = psh_exec(script) + print_status(cmd_out.to_s) # That's it print_good('Finished!') From dcfa448cf8941c27d46c7b573f51d0354e3d0094 Mon Sep 17 00:00:00 2001 From: bwatters-r7 Date: Wed, 23 Jul 2025 10:40:24 -0500 Subject: [PATCH 2/2] Remove now unused timeout --- modules/post/windows/manage/powershell/exec_powershell.rb | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/modules/post/windows/manage/powershell/exec_powershell.rb b/modules/post/windows/manage/powershell/exec_powershell.rb index c1bff350ea537..eb18f51f1b631 100644 --- a/modules/post/windows/manage/powershell/exec_powershell.rb +++ b/modules/post/windows/manage/powershell/exec_powershell.rb @@ -59,8 +59,7 @@ def initialize(info = {}) [ OptString.new('SUBSTITUTIONS', [false, 'Script subs in gsub format - original,sub;original,sub' ]), OptBool.new('DELETE', [false, 'Delete file after execution', false ]), - OptBool.new('DRY_RUN', [false, 'Only show what would be done', false ]), - OptInt.new('TIMEOUT', [false, 'Execution timeout', 15]), + OptBool.new('DRY_RUN', [false, 'Only show what would be done', false ]) ] ) end