Powershell: Crash when attempting to run Invoke-Command on Linux

Created on 21 Oct 2016  路  2Comments  路  Source: PowerShell/PowerShell

Steps to reproduce

  1. Execute the following: powershell -Command 'Invoke-Command -ComputerName localhost -ScriptBlock {$PSVersionTable}'

    Expected behavior

Powershell to give out an error if the cmdlet is not supported

Actual behavior

Powershell crashes

GNU gdb (Ubuntu 7.11.1-0ubuntu1~16.04) 7.11.1
Copyright (C) 2016 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /opt/utilities/microsoft/powershell/6.0.0-alpha.11/powershell...(no debugging symbols found)...done.
(gdb) run -Command '$PSVersionTable'
Starting program: /opt/utilities/microsoft/powershell/6.0.0-alpha.11/powershell -Command '$PSVersionTable'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff54cb700 (LWP 1287)]
[New Thread 0x7ffff4cca700 (LWP 1289)]
[New Thread 0x7ffff44c9700 (LWP 1291)]
[New Thread 0x7ffff394f700 (LWP 1292)]
[New Thread 0x7ffff0561700 (LWP 1295)]
[New Thread 0x7fffefd60700 (LWP 1296)]
[New Thread 0x7fffef55f700 (LWP 1297)]
[New Thread 0x7fffeed5e700 (LWP 1298)]
[New Thread 0x7fff57ffd700 (LWP 1299)]
[New Thread 0x7fff577fc700 (LWP 1300)]
[New Thread 0x7fff567bb700 (LWP 1301)]

Name                           Value                                          
----                           -----                                          
PSVersion                      6.0.0-alpha                                    
PSEdition                      Core                                           
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                        
BuildVersion                   3.0.0.0                                        
GitCommitId                    v6.0.0-alpha.11                                
CLRVersion                                                                    
WSManStackVersion              3.0                                            
PSRemotingProtocolVersion      2.3                                            
SerializationVersion           1.1.0.1                                        


[Thread 0x7fff567bb700 (LWP 1301) exited]
[New Thread 0x7fff567bb700 (LWP 1302)]
[Thread 0x7fff567bb700 (LWP 1302) exited]
[Thread 0x7fff577fc700 (LWP 1300) exited]
[Thread 0x7fff57ffd700 (LWP 1299) exited]
[Thread 0x7fffeed5e700 (LWP 1298) exited]
[Thread 0x7fffef55f700 (LWP 1297) exited]
[Thread 0x7fffefd60700 (LWP 1296) exited]
[Thread 0x7ffff0561700 (LWP 1295) exited]
[Thread 0x7ffff394f700 (LWP 1292) exited]
[Thread 0x7ffff44c9700 (LWP 1291) exited]
[Thread 0x7ffff4cca700 (LWP 1289) exited]
[Thread 0x7ffff54cb700 (LWP 1287) exited]
[Inferior 1 (process 1283) exited normally]
(gdb) run -Command 'Invoke-Command -ComputerName localhost -ScriptBlock {$PSVersionTable}'
Starting program: /opt/utilities/microsoft/powershell/6.0.0-alpha.11/powershell -Command 'Invoke-Command -ComputerName localhost -ScriptBlock {$PSVersionTable}'
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff54cb700 (LWP 1309)]
[New Thread 0x7ffff4cca700 (LWP 1310)]
[New Thread 0x7ffff44c9700 (LWP 1311)]
[New Thread 0x7ffff394f700 (LWP 1312)]
[New Thread 0x7ffff0561700 (LWP 1313)]
[New Thread 0x7fffefd60700 (LWP 1314)]
[New Thread 0x7fffef55f700 (LWP 1315)]
[New Thread 0x7fffeed5e700 (LWP 1316)]
[New Thread 0x7fff57ffd700 (LWP 1319)]
[New Thread 0x7fff577fc700 (LWP 1320)]
[New Thread 0x7fff5674d700 (LWP 1321)]

Thread 5 "powershell" received signal SIGSEGV, Segmentation fault.
[Switching to Thread 0x7ffff394f700 (LWP 1312)]
0x00007fff7fa1e328 in ?? ()
(gdb) bt
#0  0x00007fff7fa1e328 in ?? ()
#1  0x00007ffff394e970 in ?? ()
#2  0x00007fff582c65e0 in ?? ()
#3  0x0000000000000000 in ?? ()

Environment data

> $PSVersionTable
Name                           Value                                          
----                           -----                                          
PSVersion                      6.0.0-alpha                                    
PSEdition                      Core                                           
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}                        
BuildVersion                   3.0.0.0                                        
GitCommitId                    v6.0.0-alpha.11                                
CLRVersion                                                                    
WSManStackVersion              3.0                                            
PSRemotingProtocolVersion      2.3                                            
SerializationVersion           1.1.0.1                                        
> uname -a
Linux somebody-lubuntu 4.4.0-31-generic #50-Ubuntu SMP Wed Jul 13 00:07:12 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
> cat /etc/lsb-release
DISTRIB_ID=Ubuntu
DISTRIB_RELEASE=16.04
DISTRIB_CODENAME=xenial
DISTRIB_DESCRIPTION="Ubuntu 16.04.1 LTS"
OS-Linux Resolution-Answered WG-Engine

Most helpful comment

This no longer crashes, as least in Alpha 14

Instead, we get MI_RESULT_ACCESS_DENIED, which is possibly obscure but correct given the lack of WinRM.

PS /> powershell -Command 'Invoke-Command -ComputerName localhost -ScriptBlock {$PSVersionTable}'
Invoke-Command : MI_RESULT_ACCESS_DENIED
At line:1 char:1
+ Invoke-Command -ComputerName localhost -ScriptBlock {$PSVersionTable}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Invoke-Command], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.InvokeCommandCommand    

All 2 comments

This no longer crashes, as least in Alpha 14

Instead, we get MI_RESULT_ACCESS_DENIED, which is possibly obscure but correct given the lack of WinRM.

PS /> powershell -Command 'Invoke-Command -ComputerName localhost -ScriptBlock {$PSVersionTable}'
Invoke-Command : MI_RESULT_ACCESS_DENIED
At line:1 char:1
+ Invoke-Command -ComputerName localhost -ScriptBlock {$PSVersionTable}
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [Invoke-Command], PSInvalidOperationException
+ FullyQualifiedErrorId : InvalidOperation,Microsoft.PowerShell.Commands.InvokeCommandCommand    

No longer repros

Was this page helpful?
0 / 5 - 0 ratings