5

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
1

4 Answers 4

1

Try

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

1
  • That doesn't seem to make any difference.
    – javanix
    Jun 21, 2013 at 17:58
0

The easiest way is to run the command directly using single quote. For example listing the processes can be done as follows:

winexe -U "Domain\PC-Name" //IP Address 'powershell.exe Get-Process'
0

Powershell seems a "Windows Gui Program", which tries to interact with the desktop. Obviously this is not possible, if connected from remote (maybe in Windows XP). To be interactive and connect the input of the powershell to stdin use "-Command -".

Which lets the powershell interact with stdin. You can type commands and see the output, but you do not get the prompt from powershell.

1
  • 1
    no, powershell is a console tool. It can be called from cmd just like bash
    – phuclv
    Nov 19, 2016 at 5:08
0

Winexe sounds quite outdated and does not state supporting Windows Server 2008 and newer versions of Windows.

PowerShell went open source, you can download Ubuntu 14.04 and 16.04 .deb packages from GitHub:
https://github.com/PowerShell/PowerShell

After installing it you can remotely connect to the Windows Server 2012 machine with the Enter-PSSession PowerShell cmdlet.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .