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

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

    Scheduled Pinned Locked Moved IT Discussion
    powershellsshget-commandwindows 10windowswindows 10 1809
    25 Posts 7 Posters 11.0k Views
    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.
    • ObsolesceO
      Obsolesce @scottalanmiller
      last edited by

      @scottalanmiller said in Remote PowerShell Error: Running the Get-Command command in a remote session reported the following error: Win32 internal error "Access is denied" 0x5 occurred while reading the console output buffer. Contact Microsoft Customer Support Services..:

      Using a script that has worked for a long time. It has been being used for a year, no issues. The one day, it just stopped. The script will still run fine when executed locally, but when called over SSH it gives this error:

      Running the Get-Command command in a remote session reported the following error: Win32 internal 
      error "Access is denied" 0x5 occurred while reading the console output buffer. Contact Microsoft Customer Support 
      Services..
      

      A quick search on the error doesn't result in anything. We are functional, but not nearly as functional as we were before whatever update was done that breaks PowerShell yet again.

      Can't see the script that's causing the error?

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

        @Obsolesce script coming....

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

          First the call...

          $ ssh user@machine '@powershell c:\scripts\connection_test2.ps1'
          
          1 Reply Last reply Reply Quote 0
          • scottalanmillerS
            scottalanmiller
            last edited by scottalanmiller

            And then here is the test script. This is just enough to set up the connection. All unneeded parts are stripped out, but this is what I'm using to test the error. Only thing not shown here are the variables....

                Write-Host -NoNewLine "Beginning Test"
            
            # Setup Connection
                Import-Module MsOnline -DisableNameChecking
                Connect-MsolService -Credential $credential 
                $Session = New-PSSession -ConfigurationName Microsoft.Exchange -ConnectionUri https://outlook.office365.com/powershell-liveid/ -Credential $credential -Authentication Basic -AllowRedirection 
                Import-PSSession -Session $Session 
            
            1 Reply Last reply Reply Quote 0
            • scottalanmillerS
              scottalanmiller
              last edited by

              The error triggers when we "Import-PSSession".

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

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

                The error triggers when we "Import-PSSession".

                This error is common enough with this command that if you type this command into Google it auto-completes for this error!

                1 Reply Last reply Reply Quote 0
                • OsvaldoO
                  Osvaldo
                  last edited by

                  just the obvious contact MS or maybe was "Netsh" done? to take control

                  scottalanmillerS 1 Reply Last reply Reply Quote 0
                  • dafyreD
                    dafyre
                    last edited by

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

                    Import-PSSession -Session $Session

                    What if you try...

                    Import-PSSession -Session $Session -AllowClobber ?

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

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

                      just the obvious contact MS or maybe was "Netsh" done? to take control

                      MS does not provide support, that's not how MS works. Netsh doesn't apply in this case.

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

                        @dafyre 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:

                        Import-PSSession -Session $Session

                        What if you try...

                        Import-PSSession -Session $Session -AllowClobber ?

                        No luck. Identical error.

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

                          Seems like some kind of permissions or elevation error with how you are running or calling the script.

                          Any more details to add?

                          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:

                            Seems like some kind of permissions or elevation error with how you are running or calling the script.

                            Any more details to add?

                            What details would you like? Nothing has changed in elevation in a year. And it should not need elevation. It should run as a user. And when run locally, it does. It's the same user local or remote.

                            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:

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

                              Seems like some kind of permissions or elevation error with how you are running or calling the script.

                              Any more details to add?

                              What details would you like? Nothing has changed in elevation in a year. And it should not need elevation. It should run as a user. And when run locally, it does. It's the same user local or remote.

                              Is that user ID a local Admin?

                              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:

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

                                Seems like some kind of permissions or elevation error with how you are running or calling the script.

                                Any more details to add?

                                What details would you like? Nothing has changed in elevation in a year. And it should not need elevation. It should run as a user. And when run locally, it does. It's the same user local or remote.

                                Is that user ID a local Admin?

                                It is, yes.

                                1 Reply Last reply Reply Quote 0
                                • EddieJenningsE
                                  EddieJennings @scottalanmiller
                                  last edited by

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

                                  Using a script that has worked for a long time. It has been being used for a year, no issues. The one day, it just stopped. The script will still run fine when executed locally, but when called over SSH it gives this error:

                                  Running the Get-Command command in a remote session reported the following error: Win32 internal 
                                  error "Access is denied" 0x5 occurred while reading the console output buffer. Contact Microsoft Customer Support 
                                  Services..
                                  

                                  A quick search on the error doesn't result in anything. We are functional, but not nearly as functional as we were before whatever update was done that breaks PowerShell yet again.

                                  When was the last time Windows updates were installed? If this broke right after the install, it might be time to start uninstalling one by one to see what broke.

                                  1 Reply Last reply Reply Quote 0
                                  • J
                                    JasGot
                                    last edited by JasGot

                                    When local, can you run "Enable-PSRemoting -Force" to make sure something didn't inadvertently turn off remote PS execution.

                                    Try this also, when you are local:

                                    "Get-PSSessionConfiguration | Format-Table -Property Name, Permission -Auto"

                                    See what it says about your permissions.

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

                                    scottalanmillerS 3 Replies 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:

                                      When local, can you run "Enable-PSRemoting -Force" to make sure something didn't inadvertently turn off remote PS execution.

                                      Seemed like we were getting somewhere. Clearly a connection had set itself to Public when it should have been Private. But after fixing that, still doesn't work.

                                      Screenshot from 2019-04-12 00-20-25.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:

                                        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
                                            • 1
                                            • 2
                                            • 1 / 2
                                            • First post
                                              Last post