diff --git a/lib/msf/core/post/file.rb b/lib/msf/core/post/file.rb index 093eded5be..a06fe282c7 100644 --- a/lib/msf/core/post/file.rb +++ b/lib/msf/core/post/file.rb @@ -305,7 +305,7 @@ module Msf::Post::File end return !!stat elsif session.type == 'powershell' - return cmd_exec("[System.IO.File]::Exists( \"#{path}\")")&.include?('True') + return cmd_exec("Test-Path \"#{path}\"")&.include?('True') else if session.platform == 'windows' f = cmd_exec("cmd.exe /C IF exist \"#{path}\" ( echo true )")