I currently have some problems with the azure commandline in a Web App. I get following error:
[10/28/2015 20:22:33 > 37539e: ERR ] New-Item : The Win32 internal error "The handle is invalid" 0x6 occurred while
[10/28/2015 20:22:33 > 37539e: ERR ] getting the console mode. Contact Microsoft Customer Support Services.
This occurred on New-Item and Remove-Item. It happens in the Kudo Powershell console and using Powershell-Scripts ina WebJob.
Instead of New-Item file
I have successfully used echo 3 >> file
. This worked without problems. The only thing I found was that there is a problem using Invoke-WebRequst
and that it will be fixed using
$ProgressPreference="SilentlyContinue"
Unfortunately this didn't helped.
Did someone experienced something similar?
Thanks in advance.
For me, setting $ProgressPreference="SilentlyContinue"
does solve the issue.
(Using the PowerShell Console of the Kudu site of an Azure App Service.)
$null | (…) > $null
also prevents the error, but that also suppresses the return value, which I don't want.
Background: Apparently Invoke-WebRequest
tries to display a progress bar, which Kudu's PowerShell does not support. (source)
Some cmdlets may attempt to read the console mode of the standard input or standard output streams if it is attached to the console. This can be avoided by setting them explicitly to null.
# Prevent the progress meter from trying to access the console mode
$ProgressPreference = "SilentlyContinue"
# Set the input and output streams to $null
$null | Invoke-WebRequest -UseBasicParsing http://www.example.com/ > $null
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With