PowerShell: Running the Get-Command command in a remote session reported the following error
-
At least it tells you what to do. "Contact Microsoft Customer Support Services.."
-
@EddieJennings 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..:
At least it tells you what to do. "Contact Microsoft Customer Support Services.."
Ha ha ha
-
@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?
-
@Obsolesce script coming....
-
First the call...
$ ssh user@machine '@powershell c:\scripts\connection_test2.ps1'
-
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
-
The error triggers when we "Import-PSSession".
-
@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!
-
just the obvious contact MS or maybe was "Netsh" done? to take control
-
@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
? -
@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.
-
@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.
-
Seems like some kind of permissions or elevation error with how you are running or calling the script.
Any more details to add?
-
@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.
-
@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?
-
@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.
-
@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.
-
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?
-
@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.
-
@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...