Comment add multiple Windows 11 utilisateurs that have umlauts (Ä, Ö, Å, etc.) dans lem into groups that have umlauts dans lem via PS1 PowerShell script?
Source : Super User
Comment add multiple Windows 11 utilisateurs that have umlauts (Ä, Ö, Å, etc.) dans lem into groups that have umlauts dans lem via PS1 PowerShell script?
Source : Super User
The par défaut installé powershell v5.1 and the commands technically have no problèmes avec umlouts, so check that your input is encoded properly:
`Add-LocalGroupMember -Name ‘UMLÄUTS’ -Member ‘Me’
The default installed version of Powershell (5.1) assumes script and text files are encoded in **UTF-8 with BOM** by default, so you can run into issues if the files are in plain UTF-8 (no BOM). For example:
`# wrong characters when file is UTF8
Get-Content 'test_utf8.txt'
umlauts: Ä Ö Å
# success only when specifying encoding
Get-Content 'test_utf8.txt' -Encoding UTF8
umlauts: Ä Ö Å
For script fichiers themselves, vous pouvez re-encode the fichier like so, and it should run properly:
`Get-Content -Path ‘.\script_utf8.ps1’ -Raw -Encoding UTF8 |
Set-Content -Path ‘.\script_utf8_bom.ps1’
Powershell v6 and newer par défaut to plain UTF-8 in this case, but be aware vous pouvez run invers le reverse problème running fichiers avec BOM.
See more details ici: [about_Character_Encoding](https://learn.microsoft.com/en-us/powershell/module/microsoft.powershell.core/about/about_character_encoding?view=powershell-7.4)