Home > Net >  Invoke-Command is giving NativeCommandError
Invoke-Command is giving NativeCommandError

Time:09-06

I am using Invoke-Command { & "powershell.exe" } -NoNewScope and getting error as belove.

powershell.exe : Loading personal and system profiles took 1761ms.
At line:1 char:18
  Invoke-Command { & "powershell.exe" } -NoNewScope
                   ~~~~~~~~~~~~~~~~~~
      CategoryInfo          : NotSpecified: (Loading persona...es took 1761ms.:String 
   ) [], RemoteException
      FullyQualifiedErrorId : NativeCommandError

enter image description here

... you must use New PowerShell Tab option, to get a new session and your profile will load there.

enter image description here

You can use the shortcut key of course. CRTL T

enter image description here

Differences between the ISE and PowerShell console - PowerShell Team

Console Application (Non) Support in the ISE

$psUnsupportedConsoleApplications
# Results
<#
wmic
wmic.exe
cmd
cmd.exe
diskpart
diskpart.exe
edit.com
netsh
netsh.exe
nslookup
nslookup.exe
powershell
powershell.exe
ssh-keygen
ssh-keygen.exe
#>

PowerShell- Running Executables - TechNet Articles - United States (English) - TechNet Wiki

  • Related