$Documents = [Environment]::GetFolderPath("MyDocuments")
# Bounds are accessible by $Display.Bounds.Width and $Display.Bounds.Height
$Display = Get-PrimaryDisplay
$X = $Display.Bounds.Width
$Y = $Display.Bounds.Height
Copy-Item -Path "$InstallDirectory\ProfileTemplate" -Destination "$Documents\My Games\OpenMW" -Recurse
# Use regex to replace text within a file. Quotes are escaped by double quoting ("")
Write-ReplaceContentInFile -Pattern '^resolution x = (.+)' -Substitution "resolution x = $X" -FilePath "$Documents\My Games\OpenMW\settings.cfg"
Write-ReplaceContentInFile -Pattern '^resolution y = (.+)' -Substitution "resolution y = $Y" -FilePath "$Documents\My Games\OpenMW\settings.cfg"
Write-ReplaceContentInFile -Pattern '^data="(.+)"' -Substitution "data=""$InstallDirectory\morrowind\Data Files""" -FilePath "$Documents\My Games\OpenMW\settings.cfg"