Skip to content

Commit 9c84bc3

Browse files
martintoreillyGod-damnit-all
authored andcommitted
Read .pol file with -AsBytestream flag in PS v6+
1 parent 9025e6b commit 9c84bc3

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

GPRegistryPolicyParser.psm1

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,12 @@ Function Import-PolFile
185185
$index = 0
186186

187187
[string] $policyContents = Get-Content $Path -Raw
188-
[byte[]] $policyContentInBytes = Get-Content $Path -Raw -Encoding Byte
188+
189+
if ($psversiontable.PSVersion.Major -lt 6) {
190+
[byte[]] $policyContentInBytes = Get-Content $Path -Raw -Encoding Byte
191+
} else {
192+
[byte[]] $policyContentInBytes = Get-Content $Path -AsByteStream
193+
}
189194

190195
# 4 bytes are the signature PReg
191196
$signature = [System.Text.Encoding]::ASCII.GetString($policyContents[0..3])

0 commit comments

Comments
 (0)