How do i retrieve the version of an executable file using Winexe and WMIC on a remote window's machine from a linux machine?

1

I am currently trying to retrieve the file version of an executable file on a remote host windows machine. I am doing this on a linux machine. The command I've tried is the following:

winexe -U administrator%password //0.0.0.0 "wmic datafile where name=\'C:\\Windows\\System32\\vmms.exe\' get Version /value

The result i got back is the following:

Node - MACHINENAME
ERROR:
Description = Invalid query



None

Any help would be much appreciated. I feel like i am formatting the file path incorrectly, but i've tried almost every possible solution. The result I'm expecting to get back is:

Version
10.0.16299.15

Thank you!

Avenger

Posted 2019-07-05T15:40:29.553

Reputation: 11

Answers

0

You are missing one pair of double-quotes (").

The executed command should look like:

wmic datafile where "name='path'" get version /value

This is my attempt at getting these pesky quotes right:

winexe -U administrator%password //0.0.0.0 "wmic datafile where \"name=\'C:\\Windows\\System32\\vmms.exe\'\" get Version /value"

harrymc

Posted 2019-07-05T15:40:29.553

Reputation: 306 093

Still getting the same "Invalid Query" issue – Avenger – 2019-07-05T16:11:43.633

Might still be a problem with the quotes, but I can't test. I suggest starting with simple commands and to build up to this one to get it right. Maybe first try with remote desktop directly on the Windows target computer, and after it works add the quotes for winexe. – harrymc – 2019-07-05T16:36:31.150