# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = Get-PrimaryDisplay
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^"screenwidth" "(.+)"' -Substitution """screenwidth"" ""$($Display.Bounds.Width)""" -FilePath "$InstallDirectory\autoexec.cfg"
Write-ReplaceContentInFile -Pattern '^"screenheight" "(.+)"' -Substitution """screenheight"" ""$($Display.Bounds.Height)""" -FilePath "$InstallDirectory\autoexec.cfg"
Write-ReplaceContentInFile -Pattern '^"NetPlayerName" "(.+)"' -Substitution """NetPlayerName"" ""$NewPlayerAlias""" -FilePath "$InstallDirectory\autoexec.cfg"