GPRegistryPolicy
GPRegistryPolicy copied to clipboard
Read .pol file with -AsBytestream flag in PS v6+
As of Powershell version 6, reading the contents of a file using Get-Content <path-to-file> -Raw -Encoding Byte no longer works. Get-Content <path-to-file> -AsByteStream should be used instead.
See https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.management/get-content?view=powershell-6#parameters
It might be better for my check to be the other way round (check if version is greater than or equal to v6) as it seems psversiontable only exists from Powershell v2 according to https://stackoverflow.com/questions/1825585/determine-installed-powershell-version