Don't ask why I have to call remotely using winexe -- it's a customer requirement ;-)
Logged onto the Linux shell, the following command (to a standard powershell) is successful as a test to receive Forest details:
/usr/bin/winexe -U dallasray/administrator%somePassword //10.0.1.6 "powershell.exe \"Get-AdForest 'dallasray' | ConvertTo-JSON\""
But I need to call an Exchange Management Shell in order to auto export various mailboxes. To ensure my command works I ran the shell on the server and issued with success the following:
New-MailboxExportRequest -Mailbox "my_testuser" -FilePath "\\server\share\my_testuser.pst"
So my initial attempt to combine these 2 techniques fails. The failed command follows:
/usr/bin/winexe -U dallasray/administrator%somePassword //10.0.1.6 "powershell.exe -noexit -command \". \'C:\Program Files\Microsoft\Exchange Server\V15\bin\RemoteExchange.ps1\'; Connect-ExchangeServer -auto -ClientApplication:ManagementShell New-MailboxExportRequest -Mailbox \"my_testuser\" -FilePath \"\\server\share\my_testuser.pst\""
Specifically the error returned is:
ERROR: Cannot open control pipe - NT_STATUS_INVALID_PARAMETER