diff --git a/modules/post/windows/manage/run_as.rb b/modules/post/windows/manage/run_as.rb index 50195b8d0f..6d0e91b431 100644 --- a/modules/post/windows/manage/run_as.rb +++ b/modules/post/windows/manage/run_as.rb @@ -102,9 +102,8 @@ class Metasploit3 < Msf::Post # execute command and get output with a poor mans pipe if priv_check print_status("Executing CreateProcessAsUserA...we are SYSTEM") - begin - pi = create_process_as_user(domain, user, password, nil, cmdstr) - ensure + pi = create_process_as_user(domain, user, password, nil, cmdstr) + if pi session.railgun.kernel32.CloseHandle(pi[:process_handle]) session.railgun.kernel32.CloseHandle(pi[:thread_handle]) end