ML
    • Recent
    • Categories
    • Tags
    • Popular
    • Users
    • Groups
    • Register
    • Login

    PowerShell: Running the Get-Command command in a remote session reported the following error

    IT Discussion
    powershell ssh get-command windows 10 windows windows 10 1809
    7
    25
    10.5k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • scottalanmillerS
      scottalanmiller @JasGot
      last edited by

      @JasGot said in PowerShell: Running the Get-Command command in a remote session reported the following error:

      Try this also, when you are local:
      "Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Auto"
      See what it says about your permissions.

      Seems good...

      Screenshot from 2019-04-12 00-22-27.png

      1 Reply Last reply Reply Quote 0
      • scottalanmillerS
        scottalanmiller @JasGot
        last edited by

        @JasGot said in PowerShell: Running the Get-Command command in a remote session reported the following error:

        and lastly, is WinRM running? or need to be restarted?

        Was running. But restarted just in case, but no change.

        ObsolesceO 1 Reply Last reply Reply Quote 0
        • ObsolesceO
          Obsolesce @scottalanmiller
          last edited by

          @scottalanmiller said in PowerShell: Running the Get-Command command in a remote session reported the following error:

          @JasGot said in PowerShell: Running the Get-Command command in a remote session reported the following error:

          and lastly, is WinRM running? or need to be restarted?

          Was running. But restarted just in case, but no change.

          Is it just one PC it's not working on? Does it work on others?

          scottalanmillerS 1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller @Obsolesce
            last edited by

            @Obsolesce said in PowerShell: Running the Get-Command command in a remote session reported the following error:

            @scottalanmiller said in PowerShell: Running the Get-Command command in a remote session reported the following error:

            @JasGot said in PowerShell: Running the Get-Command command in a remote session reported the following error:

            and lastly, is WinRM running? or need to be restarted?

            Was running. But restarted just in case, but no change.

            Is it just one PC it's not working on? Does it work on others?

            Only one to run it on. I'll have to find another machine to test against. It exists only for that machine.

            T 1 Reply Last reply Reply Quote 0
            • T
              TomSnauwaert @scottalanmiller
              last edited by

              @scottalanmiller I realise this is an old topic, but I've been fighting something similar all day. As it turns out, the implementation of PTY (and also TTY) has changed in recent versions of OpenSSH for windows. When the SSH session is built from within a script, the new OpenSSH implementation detects that the session is not setup from an interactive terminal, and therefore does not assign a PTY to the session, which results in the unability of the Get-Command command to send its output to STDOUT, hence the access denied error. Solution is (at least in the situation I am in) to use the -t (or even -tt) flag with the ssh command to set up the session

              1 Reply Last reply Reply Quote 1
              • 1
              • 2
              • 2 / 2
              • First post
                Last post