Advertisement
willysec_id

Create Windows Template

Oct 27th, 2023
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. Step 1. Get Ubuntu 22.04 VPS
  2. -----------------------------
  3. Create DigitalOcean Droplet using
  4. Ubuntu 22.04
  5. 4GB of Memory
  6. root example password f75q21w9Gx
  7.  
  8.  
  9. Step 2. In web console : Install XFCE Desktop, XRDP & QEMU
  10. -----------------------------------------------------------
  11. apt-get update && apt-get upgrade -y
  12. apt-get install xfce4 firefox xrdp gzip -y
  13. apt-get install qemu qemu-utils qemu-system-x86 -y
  14. echo xfce4-session >~/.xsession
  15.  
  16. Then reboot
  17.  
  18.  
  19. Step 3. In RDP : Download Windows & Virtio Drivers ISOs
  20. -----------------------------------------------------------
  21. get virtio iso - google "windows download virtio drivers"
  22. get windows iso - google "windows iso download"
  23. Fill in qemu-system-x86_64 statement lower down, with names of ISO files
  24. reboot
  25.  
  26.  
  27. Step 4. In Web Console : Start Windows Install in QEMU
  28. --------------------------------------------------------------
  29. qemu-img create -f raw harddisk.raw 24G
  30.  
  31. qemu-system-x86_64 \
  32. -m 3000M \
  33. -cpu host \
  34. -enable-kvm \
  35. -boot order=d \
  36. -usbdevice tablet \
  37. -drive file=harddisk.raw,format=raw,if=virtio \
  38. -drive file=/root/Downloads/{downloaded-windows}.iso,media=cdrom \
  39. -drive file=/root/Downloads/{downloaded virtio}.iso,media=cdrom \
  40. -vnc :55555
  41.  
  42. via a VNC Viewer eg. RealVNC {Droplet IP Address}:61455
  43. (Note:5900+55555=61455)
  44.  
  45.  
  46. Step 5. In VNC : Install & Configure Windows
  47. --------------------------------------------------------------
  48. On VirtIO CD Select {windows version}\amd64 folder for ;
  49. a) Balloon - VirtIO Balloon Driver
  50. b) NetKVM - Red Hat Virtio Ethernet Adapter
  51. c) vioRNG - Random Number Generator
  52. d) VioSCSI - Red Hat Virtio SCSI Pass-through contoller
  53. e) VioStor - Red Hat Virtio ScSI Controller
  54.  
  55. Windows user password eg. G6t4r3e2i9m8
  56.  
  57. Configuration - When on Desktop :
  58. 1) Enable Remote Desktop
  59. 2) Change RDP Port from 3389 to 19529
  60. Start the registry editor. ...
  61. In REGEDIT Navigate to the following registry subkey: HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp.
  62. Find PortNumber.
  63. Click Edit, Modify, and then click Decimal.
  64. Type the new port number, and then click OK.
  65. 3) In [Windows Defender Firewall with Advanced Security]
  66. Add New [inbound rule]
  67. to Allow TCP Port 19529 thru Domain, Private & Public Profiles
  68. called "Rule 19529 for RDP"
  69. Disable ALL other INCOMMING RULES
  70. 4) IF Current User is called "Administrator", rename to "WinAdmin"
  71. 4) Windows Update & restart
  72. 5) Clean up C Drive
  73. 6) Finally Shut Down
  74.  
  75.  
  76. Step 6. In web Console : Gzip Windows Harddisk
  77. -----------------------------------------------
  78. ls -la
  79. df
  80. dd if=harddisk.raw status=progress | gzip | dd of=win_[winversion].gz
  81. (Wait until finished in about 15 minutes)
  82.  
  83. ls -l
  84. rm harddisk.raw
  85. reboot
  86.  
  87.  
  88. Step 7. - Example deploy to a VPS Provider
  89. ------------------------------------------
  90. In the Destination VM :
  91. lsblk
  92. sudo ssh root@[IP address of Droplet] dd if=win_[winversion].gz | gunzip | sudo dd of=/dev/[sda/vda] status=progress
  93.  
  94.  
  95.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement