Skip to content

Instantly share code, notes, and snippets.

@glombard
Last active January 11, 2023 03:14
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save glombard/7572322 to your computer and use it in GitHub Desktop.
Save glombard/7572322 to your computer and use it in GitHub Desktop.
Create Windows XP image on Hyper-V
# Enable RDP on host:
Set-ItemProperty -Path "HKLM:\System\CurrentControlSet\Control\Terminal Server" -Name fDenyTSConnections -Type DWord -Value 0
netsh advfirewall firewall set rule group="remote desktop" new enable=Yes
# Get sublime text editor:
$c=new-object Net.WebClient
$c.DownloadFile('http://c758482.r82.cf2.rackcdn.com/Sublime%20Text%20Build%203047%20x64%20Setup.exe',"$env:TEMP\sublime.exe")
cd $env:TEMP
.\sublime.exe /SILENT
# Get Windows XP Hyper-V image from modern.ie:
# http://www.modern.ie/en-us/virtualization-tools#downloads
$c.DownloadFile('https://az412801.vo.msecnd.net/vhd/IEKitV1_Final/2008R2SP1/IE8_XP/IE8.WinXP.For.WindowsHyperV.exe', '$env:TEMP\IE8.WinXP.For.WindowsHyperV.exe')
.\IE8.WinXP.For.WindowsHyperV.exe -dC:\Hyper-V\ -s
Get-NetAdapter -Name Ethernet | New-VMSwitch -Name 'ExternalSwitch'
New-VM -Name WinXP -Path C:\Hyper-V -MemoryStartupBytes 1GB -VHDPath 'C:\Hyper-V\Virtual Hard Disks\TestXP.vhd' -SwitchName ExternalSwitch
Start-VM -Name WinXP
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment