
if ($NewPlayerAlias.Length -gt 10) {
    $NewPlayerAlias = $NewPlayerAlias.Substring(0, 10);
}

$NetworkPrefsFormattedName = ""

foreach ($character in $NewPlayerAlias.ToCharArray()) {
    $NetworkPrefsFormattedName = $NetworkPrefsFormattedName + $character + "_00"
}

$NetworkPrefsIni = @"
Rts:PrimarySort = 4
Rts:SecondarySort = 8
UserName = $NetworkPrefsFormattedName
"@

New-Item -ItemType Directory -Force -Path "$($env:APPDATA)\My The Lord of the Rings, The Rise of the Witch-king Files"

Set-Content "$($env:APPDATA)\My The Lord of the Rings, The Rise of the Witch-king Files\NetworkPref.ini" $NetworkPrefsIni