-
Notifications
You must be signed in to change notification settings - Fork 10
Open
Description
I would expect this pipeline to work. It would output some junk but still work. I'm working on Windows 11 and PowerShell 7.5.4.
Error
# Must Run as Admin on Windows
Get-SecureBootUEFI db | ConvertFrom-ByteArrayToBase64 | ConvertTo-StringWorkaround No Module
The below works "correctly" and doesn't fail. I think there may be a failure in the interop rust layer.
[System.Text.Encoding]::UTF8.GetString((Get-SecureBootUEFI db).Bytes)Stacktrace
Here is the Get-Error.
Type : System.Management.Automation.ActionPreferenceStopException
ErrorRecord :
Exception :
Type : System.Management.Automation.RuntimeException
ErrorRecord :
Exception :
Type : System.Management.Automation.ParentContainsErrorRecordException
Message : Invalid UTF-8 bytes: invalid utf-8 sequence of 1 bytes from index 0
HResult : -2146233087
CategoryInfo : NotSpecified: (:) [], ParentContainsErrorRecordException
FullyQualifiedErrorId : RuntimeException
WasThrownFromThrowStatement : True
Message : Invalid UTF-8 bytes: invalid utf-8 sequence of 1 bytes from index 0
HResult : -2146233087
TargetObject : Invalid UTF-8 bytes: invalid utf-8 sequence of 1 bytes from index 0
CategoryInfo : OperationStopped: (Invalid UTF-8 bytes… bytes from index 0:String) [Write-Error], RuntimeException
FullyQualifiedErrorId : Invalid UTF-8 bytes: invalid utf-8 sequence of 1 bytes from index 0,ConvertFrom-Base64ToString
InvocationInfo :
MyCommand : ConvertFrom-Base64ToString
ScriptLineNumber : 2396
OffsetInLine : 28
HistoryId : 1007
ScriptName : C:\Users\matt\OneDrive - My Company\Documents\PowerShell\Modules\Convert\2.0.0\Convert.psm1
Line : $InputObject | & $Function @splat -ErrorAction $userErrorActionPreference
Statement : & $Function @splat -ErrorAction $userErrorActionPreference
PositionMessage : At C:\Users\matt\OneDrive - My Company\Documents\PowerShell\Modules\Convert\2.0.0\Convert.psm1:2396 char:28
+ … putObject | & $Function @splat -ErrorAction $userErrorActionPreferenc …
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PSScriptRoot : C:\Users\matt\OneDrive - My Company\Documents\PowerShell\Modules\Convert\2.0.0
PSCommandPath : C:\Users\matt\OneDrive - My Company\Documents\PowerShell\Modules\Convert\2.0.0\Convert.psm1
InvocationName : &
CommandOrigin : Internal
ScriptStackTrace : at ConvertFrom-Base64ToString<Process>, C:\Users\matt\OneDrive - My Company\Documents\PowerShell\Modules\Convert\2.0.0\Convert.psm1: line 2962
at ConvertTo-String<Process>, C:\Users\matt\OneDrive - My Company\Documents\PowerShell\Modules\Convert\2.0.0\Convert.psm1: line 2396
at ConvertPtrToString, C:\Users\matt\OneDrive - My Company\Documents\PowerShell\Modules\Convert\2.0.0\Convert.psm1: line 3072
at ConvertFrom-ByteArrayToBase64<Process>, C:\Users\matt\OneDrive - My Company\Documents\PowerShell\Modules\Convert\2.0.0\Convert.psm1: line 2057
at <ScriptBlock>, C:\Users\matt\scoop\apps\gsudo\current\Invoke-gsudo.ps1: line 206
at <ScriptBlock>, C:\Users\matt\scoop\apps\gsudo\current\Invoke-gsudo.ps1: line 187
at <ScriptBlock>, <No file>: line 1
PipelineIterationInfo :
1
1
TargetSite :
Name : Invoke
DeclaringType : [System.Management.Automation.Runspaces.PipelineBase]
MemberType : Method
Module : System.Management.Automation.dll
Message : The running command stopped because the preference variable "ErrorActionPreference" or common parameter is set to Stop: Invalid UTF-8 bytes: invalid utf-8 sequence of 1 bytes from index 0
Data : System.Collections.ListDictionaryInternal
Source : System.Management.Automation
HResult : -2146233087
StackTrace :
at System.Management.Automation.Runspaces.PipelineBase.Invoke(IEnumerable input)
at Microsoft.PowerShell.Executor.ExecuteCommandHelper(Pipeline tempPipeline, Exception& exceptionThrown, ExecutionOptions options)
Workaround With Module
ConvertFrom-ByteArrayToMemoryStream (Get-SecureBootUEFI db).Bytes | ConvertFrom-MemoryStreamToStringNotes
If one has scoop install gsudo, then one can
Invoke-Gsudo { ConvertFrom-ByteArrayToMemoryStream (Get-SecureBootUEFI db).Bytes | ConvertFrom-MemoryStreamToString }Metadata
Metadata
Assignees
Labels
No labels