exchange12rocks / PSGPPreferences

A way to manage Group Policy Preferences through PowerShell
MIT License
35 stars 2 forks source link

GPMC doesn't show SYSVOL version for a GPO modified with the module #28

Closed exchange12rocks closed 2 years ago

exchange12rocks commented 2 years ago

This happens because GPT.INI has BOM and, apparentely, GPMC does not work with UTF-8 with BOM files.

We use the PsIni module to work with GPT.INI, so it should be fixed there, ideally. Currently there is not way to tell Out-IniFile to not write BOM when using UTF-8.

Removing BOM separately proved to be not an easy task, because regular Set-Content returns access violation errors often - possibly it happens because once Out-IniFile updates file's content, DFS-R replicates it and locks the file for that period.

exchange12rocks commented 2 years ago

Since this ini file is quite simple, I think here we can use plain Set-Content, manually forming the file's content.