$Display = Get-PrimaryDisplay
$VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE"
New-Item -Path "$VirtualStore\WOW6432Node\LucasArts"
New-Item -Path "$VirtualStore\WOW6432Node\LucasArts\Star Wars Battlefront"
New-Item -Path "$VirtualStore\WOW6432Node\LucasArts\Star Wars Battlefront\1.0"
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts\Star Wars Battlefront\1.0" -Name "Installed" -Value 1 -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts\Star Wars Battlefront\1.0" -Name "Magic" -Value 599929 -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts\Star Wars Battlefront\1.0" -Name "BestOfPC" -Value 20061010 -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts\Star Wars Battlefront\1.0" -Name "ExePath" -Value "$InstallDirectory\GameData\Battlefront.exe" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts\Star Wars Battlefront\1.0" -Name "InstallPath" -Value "$InstallDirectory" -Force
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts\Star Wars Battlefront\1.0" -Name "CD Key" -Value "7267-3427-4328-4039-9984" -Force
New-Item -Path "registry::\HKEY_CURRENT_USER\SOFTWARE\LucasArts\"
New-Item -Path "registry::\HKEY_CURRENT_USER\SOFTWARE\LucasArts\Star Wars Battlefront"
New-Item -Path "registry::\HKEY_CURRENT_USER\SOFTWARE\LucasArts\Star Wars Battlefront\1.0"
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\SOFTWARE\LucasArts\Star Wars Battlefront\1.0" -Name "LastResX" -Value $Display.Bounds.Width -Force
New-ItemProperty -Path "registry::\HKEY_CURRENT_USER\SOFTWARE\LucasArts\Star Wars Battlefront\1.0" -Name "LastResY" -Value $Display.Bounds.Height -Force
$VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE"
Remove-Item -Path "$VirtualStore\WOW6432Node\LucasArts\Star Wars Battlefront" -Recurse
Remove-Item -Path "registry::\HKEY_CURRENT_USER\SOFTWARE\LucasArts\Star Wars Battlefront" -Recurse
$VirtualStore = "registry::\HKEY_CURRENT_USER\Software\Classes\VirtualStore\MACHINE\SOFTWARE"
New-Item -Path "$VirtualStore\WOW6432Node\LucasArts"
New-Item -Path "$VirtualStore\WOW6432Node\LucasArts\Star Wars Battlefront"
New-Item -Path "$VirtualStore\WOW6432Node\LucasArts\Star Wars Battlefront\1.0"
New-ItemProperty -Path "$VirtualStore\WOW6432Node\LucasArts\Star Wars Battlefront\1.0" -Name "CD Key" -Value "$AllocatedKey" -Force