Run powershell through winexe/psexec

7,204

Try

winexe --interactive=1 --user<USER> --password <SERVER> //SERVER powershell.exe

Share:
7,204

Related videos on Youtube

javanix
Author by

javanix

Linux software engineer.

Updated on September 18, 2022

Comments

  • javanix
    javanix over 1 year

    I'm trying to connect to a Windows 2012 server from Ubuntu.

    winexe --user <USER> --password <SERVER> //SERVER cmd.exe 
    

    works just fine.

    However,

    winexe --user <USER> --password <SERVER> //SERVER powershell.exe`
    

    just hangs.

    It displays:

    Windows PowerShell
    Copyright (C) 2012 Microsoft Corporation. All rights reserved.
    

    but after that it just hangs and won't respond to keypresses.

    Is there a parameter I need to pass to powershell to get it to run in interactive mode or anything?

    EDIT

    If I run the above command through strace, it seems to be waiting for the server to send something back.

    epoll_wait(4, {}, 1, 10)                = 0
    epoll_wait(4, {}, 1, 10)                = 0
    epoll_wait(4, {}, 1, 10)                = 0
    
  • javanix
    javanix almost 11 years
    That doesn't seem to make any difference.
  • phuclv
    phuclv over 7 years
    no, powershell is a console tool. It can be called from cmd just like bash