none
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 (https://msdn.microsoft.com/en-us/library/cc251526.aspx)

    MS-PSRP (https://msdn.microsoft.com/en-us/library/dd357801.aspx)

    MS-WSMV (https://msdn.microsoft.com/en-us/library/cc251395.aspx)

    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 - http://blogs.technet.com/b/otto/archive/2007/02/09/sample-vista-ws-man-winrm-commands.aspx but we are not sure how up to date these implementations are.

    Regards


    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 - https://msdn.microsoft.com/en-us/library/cc251762.aspx

    I'm pretty sure that you have to implement only MS-WSMV and it's dependencies as listed in section 1.4 (https://msdn.microsoft.com/en-us/library/cc251533.aspx) for your scenario.

    Thanks


    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 (https://msdn.microsoft.com/en-us/library/dd366131.aspx) 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- http://blogs.msdn.com/b/wmi/archive/2011/01/25/using-ws-man-to-invoke-a-powershell-cmdlet.aspx. I've used this code multiple times as synthetic client to send custom queries to windows server.

    Thanks.


    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.
     Thanks



    • 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.

    Regards.


    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 - http://blogs.technet.com/b/jonjor/archive/2009/01/09/winrm-windows-remote-management-troubleshooting.aspx.

    I'd suggest you to configure your server and then use information given in above or below link to ensure you have proper connectivity - http://blogs.msdn.com/b/wmi/archive/2011/01/25/using-ws-man-to-invoke-a-powershell-cmdlet.aspx

    Thanks.


    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

    Thanks 



    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.

    Regards.


    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

    Thanks



    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 https://blogs.msdn.microsoft.com/wmi/2011/01/24/using-ws-man-to-invoke-a-powershell-cmdlet/. Here you can find working code with basic functionality. It is written in C# .

    sunil

    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
    Moderator