Linux Windows command Execution RRS feed

  • Question

  • Hi,

    I want to execute windows command from Linux.

    I know using winexe we can do so, but i have no idea how winexe communicate with windows machine, So can anyone provide some info regarding this will be helpful

    Is there any winRM client(winrs equivalent) for Linux or can we write a java code for winRM client 

    If there is any other method, please let me know

    Thank You

    • Edited by thunderblue Wednesday, June 10, 2015 10:21 AM
    Wednesday, June 10, 2015 10:21 AM

All replies

  • Hello thunderblue

    Thank you for contacting Microsoft Support. You can certainly implement client side of winrs\winrm and we request you to kindly refer following specifications supported by my team -

    MS-WSMV (

    MS-PSRP (

    MS-WSMV (

    If you have any queries on these specifications, please feel free to reach us through this forum or dochelp at microsoft dot com.

    Regarding 'any existing winrm client for linux' - Following technet article refers few implementations in More Info section - but we are not sure how up to date these implementations are.


    Tarun Chopra | Escalation Engineer | Open Specifications Support Team

    Wednesday, June 10, 2015 4:38 PM
  • Hi Tarun,

    I went through above link but i have one doubt, above protocol are for Windows Vista and Windows Server 2003 so if I write a client using above protocol will it be compatible with Windows Server 2012 R2

    Thank You

    • Edited by thunderblue Thursday, June 11, 2015 5:58 AM
    Thursday, June 11, 2015 5:58 AM
  • Hello thunderblue

    Thanks for the information.

    MS-WSMAN is NOT but rest 2 protocols (MS-PSRP and MS-WSMV) are supported on windows 2012R2. I agree that the names are confusing but as per protocol template, section 7 lists all the OS (SKUs) on which these protocols are supported. As an example refer this link for the list of OS on which MS-WSMV protocol is supported -

    I'm pretty sure that you have to implement only MS-WSMV and it's dependencies as listed in section 1.4 ( for your scenario.


    Tarun Chopra | Escalation Engineer | Open Specifications Support Team

    Thursday, June 11, 2015 4:33 PM
  • Hi Tarun,

    Above Link solves all my problems but,

    The wsdl ( is incorrect

    Can you provide any reference to correct wsdl file

    without this wsdl file I can't proceeds with my java code

    Thank You 

    Friday, June 12, 2015 8:37 AM
  • Hello thunderblue

    With WSDL incorrect, I assume you are facing compilation issues. I'll compile it early next week for windows executable and update you. It will help, if can you please send me a mail at  ---- dochelp at Microsoft dot com ----- explaining in detail what actual issues you are facing with WSDL.

    In the meantime, please refer this blog post (it has source code enclosed at the end) to get started- I've used this code multiple times as synthetic client to send custom queries to windows server.


    Tarun Chopra | Escalation Engineer | Open Specifications Support Team

    Friday, June 12, 2015 5:10 PM
  • Hi Tarun ,

    I am trying to import wsdl in SOAP UI , there it says wsdl file is incorrect.

    • Edited by thunderblue Saturday, June 13, 2015 4:11 AM
    Saturday, June 13, 2015 4:11 AM
  • Hello thunderblue - 

    I'll check with windows utility and get back.


    Tarun Chopra | Escalation Engineer | Open Specifications Support Team

    Monday, June 15, 2015 4:00 PM
  • Hi,

    I tried to write a Java code but got a response code 500  can you specify all the header which are required.

    One  more question, why are using network credentials ?? when we are using basic authorization.

    I my Java code I just use basic authorization but got response code as 411,400 and 500

    Thank You

    Tuesday, June 16, 2015 2:38 PM
  • Hello Thunderblue -

    I'm not sure if have configured your server to accept winrm traffic. If not, please refer following article -

    I'd suggest you to configure your server and then use information given in above or below link to ensure you have proper connectivity -


    Tarun Chopra | Escalation Engineer | Open Specifications Support Team

    Wednesday, June 17, 2015 12:09 AM
  • Hi,

    I wrote my Java-Client and It works fine but now I want to extend it to use HTTPS instead of HTTP

    so any pointer in this regard will be helpful

    Did you recompile/modify wsdl file ?? as you said in above comment

    Can you share corrected wsdl file with me


    Friday, June 19, 2015 8:35 AM
  • Hello thunderblue

    We are working on fixing WSDL. If you can drop me a mail at dochelp at Microsoft dot com, I'll be able to share partial WSDL which compiles fine and should help you out.


    Tarun Chopra | Escalation Engineer | Open Specifications Support Team

    Friday, June 19, 2015 3:40 PM
  • Hi,

    I was wondering can i use winRM to upload a file, I mean is there any inbuilt functionality to upload file using winRM


    Monday, June 29, 2015 11:53 AM
  • Hi thunderblue,

    I need also to develop a Java client for MS-PSRP, is you development shared (Github,....?) If not could you share it?

    Which way you used to develop it?

    Thanks for your help

    Tuesday, August 23, 2016 8:28 AM
  • Hi 

    I can not share my code with you. But you can refer this Here you can find working code with basic functionality. It is written in C# .


    Tuesday, August 23, 2016 11:55 AM
  • Hi,

    The issue i have is that this post is not using MS-PSRP but MS-WSMV.

    It's calling powershell from cmd.exe not directly powershell.

    But maybe i have misunderstood.

    Tuesday, August 23, 2016 12:00 PM
  • Hi Aurélien,

    I see that you also posted a question via the dochelp alias.  An engineer will contact you in that thread and work with you.

    Bryan S. Burgin Senior Escalation Engineer Microsoft Protocol Open Specifications Team

    Tuesday, August 23, 2016 3:12 PM