├── .editorconfig ├── .gitattributes ├── .gitignore ├── .gitmodules ├── README.md ├── packer ├── README.md ├── floppy │ ├── Autounattend.xml │ ├── disablewinupdate.bat │ ├── fixnetwork.ps1 │ ├── install-winrm.cmd │ ├── misc.bat │ ├── oracle-cert.cer │ └── zz-start-sshd.cmd ├── iso │ └── .gitignore ├── script │ ├── compact.bat │ └── vm-guest-tools.bat ├── vagrantfile-windows-10.tpl └── windows_10.json ├── setup ├── Default.preset ├── R15.md ├── TurnOffMonitor.cmd ├── desktop_icons.ps1 ├── msys2.md ├── openssh.md ├── python.md ├── rust.md ├── scoop.md ├── set_strawberry.pl └── win7_default_share.reg └── vm └── .gitignore /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig is awesome: http://EditorConfig.org 2 | 3 | # top-most EditorConfig file 4 | root = true 5 | 6 | [*] 7 | charset = utf-8 8 | indent_style = space 9 | indent_size = 4 10 | # end_of_line = lf 11 | trim_trailing_whitespace = true 12 | insert_final_newline = true 13 | 14 | [*.json] 15 | indent_size = 2 16 | 17 | [*.yml] 18 | indent_size = 2 19 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | # Detect text files automatically 2 | * text=auto 3 | 4 | # Force Unix-style line endings on these files 5 | *.sh eol=lf 6 | ks.cfg eol=lf 7 | preseed.cfg eol=lf 8 | 9 | # Force CRLF line endings on these files 10 | *.bat text eol=crlf 11 | *.cmd text eol=crlf 12 | *.ps1 text eol=crlf 13 | Autounattend.xml text eol=crlf 14 | 15 | # These files are binary 16 | *.cer binary 17 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | #----------------------------# 2 | # IDE 3 | #----------------------------# 4 | .idea 5 | 6 | #----------------------------# 7 | # macOS 8 | #----------------------------# 9 | 10 | # General 11 | .DS_Store 12 | .AppleDouble 13 | .LSOverride 14 | 15 | # Icon must end with two \r 16 | Icon 17 | 18 | 19 | # Thumbnails 20 | ._* 21 | 22 | # Files that might appear in the root of a volume 23 | .DocumentRevisions-V100 24 | .fseventsd 25 | .Spotlight-V100 26 | .TemporaryItems 27 | .Trashes 28 | .VolumeIcon.icns 29 | .com.apple.timemachine.donotpresent 30 | 31 | # Directories potentially created on remote AFP share 32 | .AppleDB 33 | .AppleDesktop 34 | Network Trash Folder 35 | Temporary Items 36 | .apdisk 37 | 38 | #----------------------------# 39 | # Linux 40 | #----------------------------# 41 | 42 | *~ 43 | 44 | # temporary files which can be created if a process still has a handle open of a deleted file 45 | .fuse_hidden* 46 | 47 | # KDE directory preferences 48 | .directory 49 | 50 | # Linux trash folder which might appear on any partition or disk 51 | .Trash-* 52 | 53 | # .nfs files are created when an open file is removed but is still being accessed 54 | .nfs* 55 | 56 | #----------------------------# 57 | # Windows 58 | #----------------------------# 59 | 60 | # Windows thumbnail cache files 61 | Thumbs.db 62 | ehthumbs.db 63 | ehthumbs_vista.db 64 | 65 | # Dump file 66 | *.stackdump 67 | 68 | # Folder config file 69 | [Dd]esktop.ini 70 | 71 | # Recycle Bin used on file shares 72 | $RECYCLE.BIN/ 73 | 74 | # Windows Installer files 75 | *.cab 76 | *.msi 77 | *.msix 78 | *.msm 79 | *.msp 80 | 81 | # Windows shortcuts 82 | *.lnk 83 | 84 | #----------------------------# 85 | # This project 86 | #----------------------------# 87 | 88 | # iso images and vagrant boxes 89 | *.iso 90 | *.box 91 | *.ova 92 | *.ovf 93 | *.vdi 94 | *.vmdk 95 | 96 | # packer and vagrant 97 | packer_cache/ 98 | .vagrant 99 | output-* 100 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "setup/Win10-Initial-Setup-Script"] 2 | path = setup/Win10-Initial-Setup-Script 3 | url = https://github.com/Disassembler0/Win10-Initial-Setup-Script 4 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Setting-up scripts for Windows 11 2 | 3 | This document provides step-by-step instructions for setting up a new Windows 11 system, including 4 | essential configurations, development environment setup, and recommended software installations. 5 | 6 | 7 | * [Setting-up scripts for Windows 11](#setting-up-scripts-for-windows-11) 8 | * [Get ISO](#get-iso) 9 | * [Install, active and update Windows](#install-active-and-update-windows) 10 | * [Enable some optional features of Windows](#enable-some-optional-features-of-windows) 11 | * [WSL 2](#wsl-2) 12 | * [Ubuntu 20.04](#ubuntu-2004) 13 | * [`systemd`](#systemd) 14 | * [Symlinks](#symlinks) 15 | * [`winget` and `Windows Terminal`](#winget-and-windows-terminal) 16 | * [Optional: Adjusting Windows](#optional-adjusting-windows) 17 | * [Disable MPO](#disable-mpo) 18 | * [Windows Defender exclusions](#windows-defender-exclusions) 19 | * [Optional: Packages Managements](#optional-packages-managements) 20 | * [Built-in Package Manager (winget)](#built-in-package-manager-winget) 21 | * [Cross-platform Binary Package manager (cbp)](#cross-platform-binary-package-manager-cbp) 22 | * [Alternative Package Managers](#alternative-package-managers) 23 | * [Optional: Rust and C/C++](#optional-rust-and-cc) 24 | * [Optional: sysinternals](#optional-sysinternals) 25 | * [Optional: QuickLook Plugins](#optional-quicklook-plugins) 26 | * [Optional: Fonts](#optional-fonts) 27 | * [Directory Organization](#directory-organization) 28 | 29 | 30 | 31 | Most commands in this document should be executed in `PowerShell`. 32 | 33 | ## Get ISO 34 | 35 | Requirements: 36 | 37 | * Windows 11 38 | * Build 22000 or later 39 | * English or Chinese Simplified 40 | * 64-bit 41 | * `winget` and `Windows Terminal` are included by default 42 | 43 | Download: 44 | 45 | * Windows 11 Business Edition (22H2, Jan 2023 Update) 46 | * [Magnet Link](magnet:?xt=urn:btih:01f5fe67f19cf107330490f658836c6037054f65&dn=zh-cn_windows_11_business_editions_version_22h2_updated_jan_2023_x64_dvd_82450200.iso&xl=5628721152) 47 | 48 | ## Install, active and update Windows 49 | 50 | Basic system setup steps to get Windows 11 ready for use. 51 | 52 | * Enable Virtualization in BIOS or VM 53 | 54 | * Active Windows via KMS, 55 | or 56 | 57 | * Update Windows and then check system info 58 | 59 | ```powershell 60 | # simple 61 | winver 62 | 63 | # details 64 | systeminfo 65 | 66 | ``` 67 | 68 | After Windows updating, the Windows version is 22621.1265 as my current date. 69 | 70 | ## Enable some optional features of Windows 71 | 72 | * Mount Windows ISO to D: (or others) 73 | 74 | * Open PowerShell as an Administrator 75 | 76 | ```powershell 77 | # .Net 2.5 and 3 78 | DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:D:\sources\sxs /NoRestart 79 | 80 | # Online 81 | # DISM /Online /Enable-Feature /FeatureName:NetFx3 /All /NoRestart 82 | 83 | # SMB 1 84 | Enable-WindowsOptionalFeature -Online -FeatureName SMB1Protocol -All -NoRestart 85 | 86 | # Telnet 87 | DISM /Online /Enable-Feature /FeatureName:TelnetClient /NoRestart 88 | 89 | ``` 90 | 91 | ## WSL 2 92 | 93 | Windows Subsystem for Linux (WSL) 2 allows you to run Linux distributions natively on Windows. 94 | 95 | * Follow instructions of [this page](https://docs.microsoft.com/en-us/windows/wsl/wsl2-install) 96 | 97 | * Open an elevated PowerShell 98 | 99 | ```powershell 100 | # HyperV 101 | Enable-WindowsOptionalFeature -Online -FeatureName VirtualMachinePlatform -NoRestart 102 | Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All -NoRestart 103 | 104 | # # WSL 105 | # Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux -NoRestart 106 | 107 | ``` 108 | 109 | Install the GA version of [WSL](https://www.microsoft.com/store/productId/9P9TQF7MRM4R) from the 110 | Windows store. 111 | 112 | Restart then set WSL 2 as default. 113 | 114 | ```powershell 115 | wsl.exe --install 116 | 117 | wsl --set-default-version 2 118 | 119 | ``` 120 | 121 | ## Ubuntu 20.04 122 | 123 | Search `bash` in Microsoft Store or use the following command lines. 124 | 125 | ```powershell 126 | if (!(Test-Path Ubuntu.appx -PathType Leaf)) 127 | { 128 | Invoke-WebRequest -Uri https://aka.ms/wslubuntu2004 -OutFile Ubuntu2004.appx -UseBasicParsing 129 | } 130 | Add-AppxPackage .\Ubuntu2004.appx 131 | 132 | ``` 133 | 134 | Launch the distro from the Start menu, wait for a minute or two for the installation to complete, 135 | and set up a new Linux user account. 136 | 137 | The following command verifies the status of WSL: 138 | 139 | ```powershell 140 | wsl -l -v 141 | 142 | ``` 143 | 144 | ### `systemd` 145 | 146 | https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/ 147 | 148 | ### Symlinks 149 | 150 | * WSL: reduce the space occupied by virtual disks 151 | 152 | ```shell 153 | cd 154 | 155 | rm -fr Script data 156 | 157 | ln -s /mnt/c/Users/wangq/Scripts/ ~/Scripts 158 | 159 | ln -s /mnt/d/data/ ~/data 160 | 161 | ``` 162 | 163 | * Windows: second disk 164 | * Open `cmd.exe` as an Administrator 165 | 166 | ```cmd 167 | cd c:\Users\wangq\ 168 | 169 | mklink /D c:\Users\wangq\data d:\data 170 | 171 | ``` 172 | 173 | ## `winget` and `Windows Terminal` 174 | 175 | `winget` and `Windows Terminal` are now included by Windows 11 176 | 177 | ```powershell 178 | winget install -s winget -e --id Git.Git 179 | 180 | ``` 181 | 182 | Open `Windows Terminal` 183 | 184 | * Set `Default terminal application` to `Windows Terminal`. 185 | 186 | * Set `Interaction` -> `Remove trailing white-space when pasting` to Off 187 | 188 | * Hide unneeded `Profiles`. 189 | 190 | ## Optional: Adjusting Windows 191 | 192 | Works with Windows 10 or 11. 193 | 194 | ```powershell 195 | mkdir -p ~/Scripts 196 | cd ~/Scripts 197 | git clone --recursive https://github.com/wang-q/windows 198 | 199 | cd ~/Scripts/windows/setup 200 | powershell.exe -NoProfile -ExecutionPolicy Bypass ` 201 | -File "Win10-Initial-Setup-Script/Win10.ps1" ` 202 | -include "Win10-Initial-Setup-Script/Win10.psm1" ` 203 | -preset "Default.preset" 204 | 205 | ``` 206 | 207 | Log in to the Microsoft Store and get updates from there. 208 | 209 | * Remove "Home" (主文件夹) from Explorer in Windows 11 210 | 211 | ```cmd 212 | reg add "HKCU\Software\Classes\CLSID\{f874310e-b6b7-47dc-bc84-b9e6b38f5903}" /v System.IsPinnedToNameSpaceTree /d 0 /t REG_DWORD /f 213 | 214 | # manually accessing that view is still possible 215 | explorer.exe shell:::{f874310e-b6b7-47dc-bc84-b9e6b38f5903} 216 | 217 | ``` 218 | 219 | ### Disable MPO 220 | 221 | In some cases, Chrome browser windows may flicker around the edges. This can potentially be improved 222 | by disabling MPO. 223 | 224 | ```powershell 225 | # Backup 226 | reg export "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Dwm" "DwmBackup.reg" 227 | 228 | # Add the key 229 | reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Dwm" /v OverlayTestMode /t REG_DWORD /d 5 /f 230 | 231 | # Delete 232 | reg delete "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\Dwm" /v OverlayTestMode /f 233 | 234 | ``` 235 | 236 | ### Windows Defender exclusions 237 | 238 | ```powershell 239 | Add-MpPreference -ExclusionPath "$HOME\Scripts" 240 | 241 | ``` 242 | 243 | ## Optional: Packages Managements 244 | 245 | ### Built-in Package Manager (winget) 246 | 247 | Windows Package Manager (winget) is the official package manager for Windows. 248 | 249 | ```powershell 250 | # programming 251 | winget install -s winget -e --id Oracle.JavaRuntimeEnvironment 252 | winget install -s winget -e --id Oracle.JDK.18 253 | winget install -s winget -e --id StrawberryPerl.StrawberryPerl 254 | # winget install -e --id Python.Python 255 | winget install -s winget -e --id RProject.R 256 | # winget install -s winget -e --id RProject.Rtools 257 | # winget install -s winget -e --id OpenJS.NodeJS.LTS 258 | winget install -s winget -e --id Posit.RStudio 259 | winget install -s winget -e --id Kitware.CMake 260 | winget install -s winget -e --id Microsoft.PowerShell 261 | 262 | # development 263 | winget install -s winget -e --id GitHub.GitHubDesktop 264 | winget install -s winget -e --id GitHub.cli 265 | winget install -s winget -e --id WinSCP.WinSCP 266 | winget install -s winget -e --id Microsoft.VisualStudioCode 267 | # winget install -s msstore --accept-package-agreements "Visual Studio Code" 268 | winget install -s winget -e --id ScooterSoftware.BeyondCompare.4 269 | # winget install -s winget -e --id ScooterSoftware.BeyondCompare.5 270 | # winget install -s winget -e --id JetBrains.Toolbox 271 | # winget install -s winget -e --id RealVNC.VNCViewer 272 | # winget install -s msstore --accept-package-agreements "Redis Insight" 273 | winget install qishibo.AnotherRedisDesktopManager 274 | winget install -s winget -e --id Memurai.MemuraiDeveloper # Windows port of Redis 275 | # memurai.exe --service-uninstall # I don't need this service 276 | winget install -s winget -e --id Mobatek.MobaXterm 277 | winget install -s winget -e --id ByteDance.Trae 278 | 279 | # winget install -e --id WinFsp.WinFsp 280 | # winget install -e --id SSHFS-Win.SSHFS-Win 281 | # \\sshfs\REMUSER@HOST[\PATH] 282 | 283 | # winget install -e --id Docker.DockerDesktop 284 | # winget install -e --id VMware.WorkstationPlayer 285 | # winget install -s winget -e --id Canonical.Multipass 286 | 287 | # utils 288 | winget install -s winget -e --id voidtools.Everything 289 | winget install -s msstore --accept-package-agreements Bandizip 290 | # winget install -s msstore --accept-package-agreements NanaZip 291 | winget install -s msstore --accept-package-agreements Rufus # need v3.18 or higher 292 | winget install -s winget -e --id QL-Win.QuickLook 293 | winget install -s winget -e --id AntibodySoftware.WizTree 294 | # winget install -s msstore --accept-package-agreements "Microsoft PowerToys" 295 | winget install -s winget -e --id qBittorrent.qBittorrent 296 | winget install -s winget -e --id OlegDanilov.RapidEnvironmentEditor 297 | # winget install -s winget -e --id valinet.ExplorerPatcher 298 | # winget install -s winget -e --id Fndroid.ClashForWindows 299 | winget install --id "CrystalDewWorld.CrystalDiskInfo" 300 | winget install --id "CrystalDewWorld.CrystalDiskMark" 301 | winget install --id RustDesk.RustDesk 302 | 303 | # media 304 | # winget install -s winget -e --id NetEase.CloudMusic 305 | winget install -s winget -e --id HandBrake.HandBrake 306 | winget install -s winget -e --id mpv.net 307 | #winget install -s msstore --accept-package-agreements "iQIYI Windows client app" 308 | # winget install -s winget -e --id IrfanSkiljan.IrfanView 309 | 310 | # apps 311 | # winget install -s winget -e --id Mozilla.Firefox 312 | winget install -s winget -e --id Tencent.WeChat 313 | winget install -s winget -e --id Tencent.TencentMeeting 314 | winget install -s winget -e --id Tencent.QQ 315 | winget install -s winget -e --id Alibaba.DingTalk 316 | winget install -s winget -e --id ByteDance.Feishu 317 | winget install -s winget -e --id Youdao.YoudaoTranslate 318 | winget install -s winget -e --id Baidu.BaiduNetdisk 319 | winget install -s winget -e --id DigitalScholar.Zotero 320 | winget install -s msstore --accept-package-agreements "Microsoft Whiteboard" 321 | winget install -s msstore --accept-package-agreements "Adobe Acrobat Reader DC" 322 | 323 | # upgrading 324 | winget upgrade --all --accept-package-agreements --source winget 325 | 326 | # uninstall 327 | winget uninstall "Windows web experience Pack" 328 | 329 | ``` 330 | 331 | ### Cross-platform Binary Package manager (cbp) 332 | 333 | I have developed a cross-platform package manager called `cbp` that can download prebuilt packages 334 | and install them automatically. 335 | 336 | ```powershell 337 | # Install cbp 338 | # $ENV:ALL_PROXY='socks5h://localhost:7890' 339 | iwr "https://github.com/wang-q/cbp/releases/latest/download/cbp.windows.exe" -OutFile cbp.windows.exe 340 | .\cbp.windows.exe init 341 | 342 | # Restart terminal to apply changes 343 | 344 | # List available packages 345 | cbp avail windows 346 | cbp avail font # font packages 347 | 348 | # Install packages 349 | cbp install curl jq 350 | cbp install bat fd 351 | cbp install sqlite3 352 | 353 | # Manage packages 354 | cbp list # list installed packages 355 | cbp list fd # show package contents 356 | cbp remove fd # remove package 357 | 358 | ``` 359 | 360 | ### Alternative Package Managers 361 | 362 | * [scoop.md](setup/scoop.md): 363 | > Scoop is an installer. 364 | > 365 | > The goal of Scoop is to let you use Unix-y programs in a normal Windows environment. 366 | > 367 | > Scoop focuses on open-source, command-line developer tools. 368 | 369 | * Chocolatey and MSYS2 are other options but not recommended 370 | 371 | ## Optional: Rust and C/C++ 372 | 373 | * [rust.md](setup/rust.md) 374 | 375 | ## Optional: sysinternals 376 | 377 | * Add `$HOME/bin` to Path 378 | 379 | ```powershell 380 | mkdir $HOME/bin 381 | 382 | # Add to Path 383 | [Environment]::SetEnvironmentVariable( 384 | "Path", 385 | [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::User) + ";$HOME\bin", 386 | [EnvironmentVariableTarget]::User) 387 | 388 | ``` 389 | 390 | * Download and extract 391 | 392 | ```powershell 393 | scoop install aria2 unzip 394 | 395 | $array = "DU", "ProcessExplorer", "ProcessMonitor", "RAMMap" 396 | 397 | foreach ($app in $array) 398 | { 399 | iwr "https://download.sysinternals.com/files/$app.zip" -O "$app.zip" 400 | } 401 | 402 | foreach ($app in $array) 403 | { 404 | unzip "$app.zip" -d $HOME/bin -x Eula.txt 405 | } 406 | 407 | rm $HOME/bin/*.chm 408 | rm $HOME/bin/*64.exe 409 | rm $HOME/bin/*64a.exe 410 | 411 | ``` 412 | 413 | ## Optional: QuickLook Plugins 414 | 415 | 416 | 417 | ```powershell 418 | # office 419 | $url = ( 420 | iwr https://api.github.com/repos/QL-Win/QuickLook.Plugin.OfficeViewer/releases/latest | 421 | Select-Object -Expand Content | 422 | jq -r '.assets[0].browser_download_url' 423 | ) 424 | curl.exe -LO $url 425 | 426 | # folder 427 | $url = ( 428 | iwr https://api.github.com/repos/adyanth/QuickLook.Plugin.FolderViewer/releases/latest | 429 | Select-Object -Expand Content | 430 | jq -r '.assets[0].browser_download_url' 431 | ) 432 | curl.exe -LO $url 433 | 434 | ``` 435 | 436 | Select the `qlplugin` file and press `Spacebar` to install the plugin. 437 | 438 | ## Optional: Fonts 439 | 440 | ```powershell 441 | cbp install -t font helvetica 442 | cbp install -t font fira 443 | cbp install -t font jetbrains-mono 444 | 445 | cbp install -t font source-han-sans 446 | cbp install -t font source-han-serif 447 | cbp install -t font lxgw-wenkai 448 | 449 | ``` 450 | 451 | ## Directory Organization 452 | 453 | * [`packer/`](packer/): Scripts for building a Windows 10 box for Parallels. 454 | 455 | * [`setup/`](setup/): Scripts for setting-up Windows. 456 | -------------------------------------------------------------------------------- /packer/README.md: -------------------------------------------------------------------------------- 1 | # A Windows 10 base box 2 | 3 | A Packer build to make a vanilla Windows 10 x64 box for Parallels. 4 | 5 | The building steps contain: 6 | 7 | * Install [Parallels Virtualization SDK](http://www.parallels.com/download/pvsdk/). 8 | * Download a Windows 10 x64 Enterprise trial ISO 9 | * Enable WinRM for packer/vagrant communicate to the VM 10 | * Create a `vagrant:vagrant` user:password with 11 | * Install VM guest additions 12 | * Compact disks 13 | 14 | ## ISO 15 | 16 | * Windows 10 Enterprise 19h1 (x64) 17 | * `18362.30.190401-1528.19h1_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso` 18 | 19 | ```bash 20 | cd ~/Scripts/windows/packer 21 | 22 | wget -N -P iso https://software-download.microsoft.com/download/pr/18362.30.190401-1528.19h1_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso 23 | 24 | openssl sha1 iso/*.iso 25 | 26 | wget -N -P iso http://www.7-zip.org/a/7z920-x64.msi 27 | wget -N -P iso http://downloads.sourceforge.net/project/ultradefrag/stable-release/6.1.0/ultradefrag-portable-6.1.0.bin.amd64.zip 28 | wget -N -P iso http://download.sysinternals.com/files/SDelete.zip 29 | 30 | ``` 31 | 32 | ## Build 33 | 34 | ```bash 35 | cd ~/Scripts/windows/packer 36 | 37 | packer build -only=parallels-iso windows_10.json 38 | 39 | mv windows_10_parallels.box ../vm 40 | 41 | ``` 42 | 43 | ## Up 44 | 45 | ```bash 46 | vagrant box add windows-10 ~/Scripts/windows/vm/windows_10_parallels.box --force 47 | 48 | cp ~/Scripts/windows/packer/vagrantfile-windows-10.tpl ~/Parallels/Vagrantfile 49 | 50 | cd ~/Parallels 51 | # vagrant plugin install vagrant-parallels 52 | vagrant up --provider parallels 53 | 54 | ``` 55 | 56 | ## Other boxes 57 | 58 | And codes also come from these repos. 59 | 60 | * https://github.com/joefitzgerald/packer-windows 61 | * https://github.com/boxcutter/windows 62 | * https://github.com/luciusbono/Packer-Windows10 63 | -------------------------------------------------------------------------------- /packer/floppy/Autounattend.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | en-US 7 | 8 | en-US 9 | en-US 10 | en-US 11 | en-US 12 | 13 | 14 | 15 | 16 | 17 | 18 | 1 19 | Primary 20 | true 21 | 22 | 23 | 24 | 25 | false 26 | NTFS 27 | C 28 | 1 29 | 1 30 | 31 | 32 | 33 | 0 34 | true 35 | 36 | OnError 37 | 38 | 39 | true 40 | Vagrant Administrator 41 | Vagrant Inc. 42 | 43 | NPPR9-FWDCX-D2C8J-H872K-2YT43 44 | Never 45 | 46 | 47 | 48 | 49 | 50 | 0 51 | 1 52 | 53 | OnError 54 | false 55 | 56 | 57 | /IMAGE/NAME 58 | Windows 10 Enterprise Evaluation 59 | 60 | 61 | 62 | 63 | 64 | 65 | 66 | 67 | * 68 | Pacific Standard Time 69 | 70 | 71 | false 72 | 73 | 74 | 75 | 76 | true 77 | Remote Desktop 78 | all 79 | 80 | 81 | 82 | 83 | 0 84 | 85 | 86 | en-US 87 | en-US 88 | en-US 89 | en-US 90 | 91 | 92 | 93 | 94 | 95 | true 96 | vagrant 97 | 98 | vagrant 99 | true</PlainText> 100 | </Password> 101 | </AutoLogon> 102 | <FirstLogonCommands> 103 | <SynchronousCommand wcm:action="add"> 104 | <CommandLine>cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"</CommandLine> 105 | <Description>Set Execution Policy 64 Bit</Description> 106 | <Order>1</Order> 107 | <RequiresUserInput>true</RequiresUserInput> 108 | </SynchronousCommand> 109 | <SynchronousCommand wcm:action="add"> 110 | <CommandLine>C:\Windows\SysWOW64\cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"</CommandLine> 111 | <Description>Set Execution Policy 32 Bit</Description> 112 | <Order>2</Order> 113 | <RequiresUserInput>true</RequiresUserInput> 114 | </SynchronousCommand> 115 | <SynchronousCommand wcm:action="add"> 116 | <CommandLine>reg add HKLM\System\CurrentControlSet\Control\Network\NewNetworkWindowOff</CommandLine> 117 | <Description>Disable the network discovery prompt window</Description> 118 | <Order>3</Order> 119 | <RequiresUserInput>true</RequiresUserInput> 120 | </SynchronousCommand> 121 | <SynchronousCommand wcm:action="add"> 122 | <CommandLine>cmd.exe /c a:\install-winrm.cmd</CommandLine> 123 | <Order>11</Order> 124 | <Description>WinRM</Description> 125 | </SynchronousCommand> 126 | <SynchronousCommand wcm:action="add"> 127 | <CommandLine>cmd.exe /c C:\Windows\System32\WindowsPowerShell\v1.0\powershell.exe -File a:\fixnetwork.ps1</CommandLine> 128 | <Description>Fix network</Description> 129 | <Order>12</Order> 130 | </SynchronousCommand> 131 | <SynchronousCommand wcm:action="add"> 132 | <CommandLine>cmd.exe /c a:\misc.bat</CommandLine> 133 | <Order>13</Order> 134 | <Description>Misc settings</Description> 135 | </SynchronousCommand> 136 | <SynchronousCommand wcm:action="add"> 137 | <CommandLine>cmd.exe /c a:\disablewinupdate.bat</CommandLine> 138 | <Order>14</Order> 139 | <Description>Disable Windows Updates</Description> 140 | </SynchronousCommand> 141 | <SynchronousCommand wcm:action="add"> 142 | <CommandLine>cmd.exe /c a:\zz-start-sshd.cmd</CommandLine> 143 | <Order>22</Order> 144 | <Description>Start openssh</Description> 145 | </SynchronousCommand> 146 | </FirstLogonCommands> 147 | <OOBE> 148 | <NetworkLocation>Work</NetworkLocation> 149 | <ProtectYourPC>3</ProtectYourPC> 150 | <HideEULAPage>true</HideEULAPage> 151 | </OOBE> 152 | <UserAccounts> 153 | <LocalAccounts> 154 | <LocalAccount wcm:action="add"> 155 | <Password> 156 | <Value>vagrant</Value> 157 | <PlainText>true</PlainText> 158 | </Password> 159 | <Description>Vagrant User</Description> 160 | <DisplayName>vagrant</DisplayName> 161 | <Group>Administrators</Group> 162 | <Name>vagrant</Name> 163 | </LocalAccount> 164 | </LocalAccounts> 165 | </UserAccounts> 166 | <TimeZone>GMT Standard Time</TimeZone> 167 | </component> 168 | <component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 169 | <InputLocale>en-US</InputLocale> 170 | <SystemLocale>en-US</SystemLocale> 171 | <UILanguage>en-US</UILanguage> 172 | <UserLocale>en-US</UserLocale> 173 | </component> 174 | </settings> 175 | <settings pass="offlineServicing"> 176 | <component name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 177 | <EnableLUA>false</EnableLUA> 178 | </component> 179 | </settings> 180 | <cpi:offlineImage cpi:source="catalog://winryadkx64/users/misheska/github/box-cutter/windows-vm/wsim/wineval/win81/x64/install_windows 10 enterprise evaluation.clg" xmlns:cpi="urn:schemas-microsoft-com:cpi" /> 181 | </unattend> 182 | -------------------------------------------------------------------------------- /packer/floppy/disablewinupdate.bat: -------------------------------------------------------------------------------- 1 | <!-- : 2 | @echo off 3 | 4 | echo ==^> Enabling updates for other products from Microsoft Update 5 | net stop wuauserv 6 | 7 | reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v EnableFeaturedSoftware /t REG_DWORD /d 1 /f 8 | 9 | reg add "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Auto Update" /v IncludeRecommendedUpdates /t REG_DWORD /d 1 /f 10 | 11 | cscript //nologo "%~f0?.wsf" 12 | 13 | net start wuauserv 14 | exit /b 15 | 16 | ----- Begin wsf script ---> 17 | <job><script language="VBScript"> 18 | Set ServiceManager = CreateObject("Microsoft.Update.ServiceManager") 19 | Set NewUpdateService = ServiceManager.AddService2("7971f918-a847-4430-9279-4a52d1efe18d",7,"") 20 | 21 | Const NOT_CONFIGURED = 0 22 | Const DISABLED = 1 23 | Const PROMPT_TO_APPROVE_BEFORE_DOWNLOAD = 2 24 | Const DOWNLOAD_AUTOMATICALLY = 3 25 | Const SCHEDULED_INSTALLATION = 4 26 | Set AutoUpdate = CreateObject("Microsoft.Update.AutoUpdate") 27 | Set AutoUpdateSettings = AutoUpdate.Settings 28 | AutoUpdateSettings.NotificationLevel = DISABLED 29 | AutoUpdateSettings.Save 30 | AutoUpdateSettings.Refresh 31 | </script></job> 32 | -------------------------------------------------------------------------------- /packer/floppy/fixnetwork.ps1: -------------------------------------------------------------------------------- 1 | # You cannot enable Windows PowerShell Remoting on network connections that are set to Public 2 | # Spin through all the network locations and if they are set to Public, set them to Private 3 | # using the INetwork interface: 4 | # http://msdn.microsoft.com/en-us/library/windows/desktop/aa370750(v=vs.85).aspx 5 | # For more info, see: 6 | # http://blogs.msdn.com/b/powershell/archive/2009/04/03/setting-network-location-to-private.aspx 7 | 8 | # Network location feature was only introduced in Windows Vista - no need to bother with this 9 | # if the operating system is older than Vista 10 | if([environment]::OSVersion.version.Major -lt 6) { return } 11 | 12 | # You cannot change the network location if you are joined to a domain, so abort 13 | if(1,3,4,5 -contains (Get-WmiObject win32_computersystem).DomainRole) { return } 14 | 15 | # Get network connections 16 | $networkListManager = [Activator]::CreateInstance([Type]::GetTypeFromCLSID([Guid]"{DCB00C01-570F-4A9B-8D69-199FDBA5723B}")) 17 | $connections = $networkListManager.GetNetworkConnections() 18 | 19 | $connections |foreach { 20 | Write-Host $_.GetNetwork().GetName()"category was previously set to"$_.GetNetwork().GetCategory() 21 | $_.GetNetwork().SetCategory(1) 22 | Write-Host $_.GetNetwork().GetName()"changed to category"$_.GetNetwork().GetCategory() 23 | } -------------------------------------------------------------------------------- /packer/floppy/install-winrm.cmd: -------------------------------------------------------------------------------- 1 | @setlocal EnableDelayedExpansion EnableExtensions 2 | @if defined PACKER_DEBUG (@echo on) else (@echo off) 3 | 4 | title Enabling Windows Remote Management. Please wait... 5 | 6 | echo ==^> Turning off User Account Control (UAC) 7 | :: see http://www.howtogeek.com/howto/windows-vista/enable-or-disable-uac-from-the-windows-vista-command-line/ 8 | reg ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f 9 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: reg ADD HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System /v EnableLUA /t REG_DWORD /d 0 /f 10 | 11 | title Enabling Windows Remote Management. Please wait... 12 | 13 | echo ==^> Setting the PowerShell ExecutionPolicy to RemoteSigned (64 bit) 14 | powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force" <NUL 15 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force" 16 | 17 | if exist %SystemRoot%\SysWOW64\cmd.exe ( 18 | echo ==^> Setting the PowerShell ExecutionPolicy to RemoteSigned (32 bit) 19 | %SystemRoot%\SysWOW64\cmd.exe /c powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force" <NUL 20 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: powershell -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force" <NUL 21 | ) 22 | 23 | systeminfo 2>nul | findstr /b /c:"OS Name" | findstr /c:"Windows 7" /c:"Windows 10" >nul 24 | if errorlevel 1 goto skip_fixnetwork 25 | 26 | if not exist a:\fixnetwork.ps1 echo ==^> ERROR: File not found: a:\fixnetwork.ps1 27 | 28 | echo ==^> Setting the Network Location to private 29 | :: see http://blogs.msdn.com/b/powershell/archive/2009/04/03/setting-network-location-to-private.aspx 30 | powershell -File a:\fixnetwork.ps1 <NUL 31 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: powershell -File a:\fixnetwork.ps1 32 | 33 | :skip_fixnetwork 34 | 35 | echo ==^> Changing remote UAC account policy 36 | reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f 37 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: reg add HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\system /v LocalAccountTokenFilterPolicy /t REG_DWORD /d 1 /f 38 | 39 | echo ==^> Blocking WinRM port 5985 on the firewall 40 | netsh advfirewall firewall add rule name="winrm" dir=in action=block protocol=TCP localport=5985 41 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall add rule name="winrm" dir=in action=block protocol=TCP localport=5985 42 | 43 | echo ==^> Configuring Windows Remote Management (WinRM) service 44 | 45 | call winrm quickconfig -q 46 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm quickconfig -q 47 | 48 | call winrm quickconfig -transport:http 49 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm quickconfig -transport:http 50 | 51 | call winrm set winrm/config @{MaxTimeoutms="1800000"} 52 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm set winrm/config @{MaxTimeoutms="1800000"} 53 | 54 | call winrm set winrm/config/winrs @{MaxMemoryPerShellMB="800"} 55 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm set winrm/config/winrs @{MaxMemoryPerShellMB="800"} 56 | 57 | call winrm set winrm/config/service @{AllowUnencrypted="true"} 58 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm set winrm/config/service @{AllowUnencrypted="true"} 59 | 60 | call winrm set winrm/config/service/auth @{Basic="true"} 61 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm set winrm/config/service/auth @{Basic="true"} 62 | 63 | call winrm set winrm/config/client/auth @{Basic="true"} 64 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm set winrm/config/client/auth @{Basic="true"} 65 | 66 | call winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"} 67 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: winrm set winrm/config/listener?Address=*+Transport=HTTP @{Port="5985"} 68 | 69 | sc config winrm start= disabled 70 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: sc config winrm start= disabled 71 | 72 | :: wait for winrm service to finish starting 73 | timeout 5 74 | 75 | sc query winrm | findstr "RUNNING" >nul 76 | if errorlevel 1 goto winrm_not_running 77 | 78 | echo ==^> Stopping winrm service 79 | 80 | sc stop winrm 81 | 82 | :is_winrm_running 83 | 84 | timeout 1 85 | 86 | sc query winrm | findstr "STOPPED" >nul 87 | if errorlevel 1 goto is_winrm_running 88 | 89 | :winrm_not_running 90 | 91 | echo ==^> Unblocking WinRM port 5985 on the firewall 92 | netsh advfirewall firewall delete rule name="winrm" 93 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall delete rule name="winrm" 94 | 95 | netsh advfirewall firewall set rule group="remote administration" new enable=yes 96 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall set rule group="remote administration" new enable=yes 97 | 98 | echo ==^> Opening WinRM port 5985 on the firewall 99 | :: see http://social.technet.microsoft.com/Forums/windowsserver/en-US/a1e65f0f-2550-49ae-aee2-56a9bdcfb8fb/windows-7-remote-administration-firewall-group?forum=winserverManagement 100 | netsh advfirewall firewall set rule group="Windows Remote Management" new enable=yes 101 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall set rule group="Windows Remote Management" new enable=yes 102 | 103 | netsh advfirewall firewall add rule name="winrm" dir=in action=allow protocol=TCP localport=5985 104 | @if errorlevel 1 echo ==^> WARNING: Error %ERRORLEVEL% was returned by: netsh advfirewall firewall add rule name="winrm" dir=in action=allow protocol=TCP localport=5985 105 | 106 | :exit0 107 | 108 | ver>nul 109 | 110 | goto :exit 111 | 112 | :exit1 113 | 114 | verify other 2>nul 115 | 116 | :exit 117 | -------------------------------------------------------------------------------- /packer/floppy/misc.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | 3 | title Setting power configuration. Please wait... 4 | 5 | echo ==^> Setting power configuration to High Performance 6 | powercfg -setactive 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c 7 | 8 | echo ==^> Turning off monitor timeout 9 | powercfg -Change -monitor-timeout-ac 0 10 | powercfg -Change -monitor-timeout-dc 0 11 | 12 | ::Disable Hibernation 13 | reg add HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateFileSizePercent /t REG_DWORD /d 0 /f 14 | reg add HKLM\SYSTEM\CurrentControlSet\Control\Power\ /v HibernateEnabled /t REG_DWORD /d 0 /f 15 | 16 | title Disabling automatic machine account password changes. Please wait... 17 | 18 | echo ==^> Disabling automatic machine account password changes 19 | :: http://support.microsoft.com/kb/154501 20 | reg add "HKLM\System\CurrentControlSet\Services\Netlogon\Parameters" /v DisablePasswordChange /t REG_DWORD /d 2 /f 21 | 22 | title Setting time format. Please wait... 23 | 24 | echo ==^> Setting time format to 24 hour time 25 | reg add "HKCU\Control Panel\International" /f /v sShortTime /t REG_SZ /d "HH:mm" 26 | reg add "HKCU\Control Panel\International" /f /v sTimeFormat /t REG_SZ /d "HH:mm:ss" 27 | 28 | echo ==^> Show Run command in Start Menu 29 | reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v Start_ShowRun /t REG_DWORD /d 1 /f 30 | 31 | echo ==^> Show Administrative Tools in Start Menu 32 | reg add HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced\ /v StartMenuAdminTools /t REG_DWORD /d 1 /f 33 | 34 | title Setting folder options. Please wait... 35 | 36 | echo ==^> Setting folder options 37 | echo ==^> Show file extensions 38 | :: Default is 1 - hide file extensions 39 | reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v HideFileExt /t REG_DWORD /d 0 40 | echo ==^> Show hidden files and folders 41 | :: Default is 2 - do not show hidden files and folders 42 | reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v Hidden /t REG_DWORD /d 1 43 | echo ==^> Display Full path 44 | :: Default FullPath 0 and FullPathAddress 0 45 | reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v FullPath /t REG_DWORD /d 1 46 | reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" /f /v FullPathAddress /t REG_DWORD /d 1 47 | 48 | echo ==^> Enabling RDP on port 3389 49 | netsh advfirewall firewall add rule name="Open Port 3389" dir=in action=allow protocol=TCP localport=3389 50 | reg add "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server" /v fDenyTSConnections /t REG_DWORD /d 0 /f 51 | -------------------------------------------------------------------------------- /packer/floppy/oracle-cert.cer: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/wang-q/windows/e41a91b302ce65027abf03e1318f0596c0996c38/packer/floppy/oracle-cert.cer -------------------------------------------------------------------------------- /packer/floppy/zz-start-sshd.cmd: -------------------------------------------------------------------------------- 1 | @setlocal EnableDelayedExpansion EnableExtensions 2 | @if defined PACKER_DEBUG (@echo on) else (@echo off) 3 | 4 | if not defined PACKER_SERVICES set PACKER_SERVICES=opensshd sshd winrm 5 | 6 | title Starting services: %PACKER_SERVICES%. Please wait... 7 | 8 | :: Intentionally named with zz so it runs last by 00-run-all-scripts.cmd so 9 | :: that the Packer winrm/ssh connections is not inadvertently dropped during the 10 | :: Sysprep run 11 | 12 | for %%i in (%PACKER_SERVICES%) do ( 13 | echo ==^> Checking if the %%i service is installed 14 | sc query %%i >nul 2>nul && ( 15 | echo ==^> Configuring %%i service to autostart 16 | sc config %%i start= auto 17 | 18 | echo ==^> Starting the %%i service 19 | sc start %%i 20 | ) 21 | ) 22 | 23 | :exit0 24 | 25 | ver>nul 26 | 27 | goto :exit 28 | 29 | :exit1 30 | 31 | verify other 2>nul 32 | 33 | :exit 34 | -------------------------------------------------------------------------------- /packer/iso/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | 4 | # Except these files 5 | !.gitignore 6 | -------------------------------------------------------------------------------- /packer/script/compact.bat: -------------------------------------------------------------------------------- 1 | if not exist "C:\Windows\Temp\7z920-x64.msi" ( 2 | powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL 3 | ) 4 | msiexec /qb /i C:\Windows\Temp\7z920-x64.msi 5 | 6 | if not exist "C:\Windows\Temp\ultradefrag.zip" ( 7 | powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://downloads.sourceforge.net/project/ultradefrag/stable-release/6.1.0/ultradefrag-portable-6.1.0.bin.amd64.zip', 'C:\Windows\Temp\ultradefrag.zip')" <NUL 8 | ) 9 | 10 | if not exist "C:\Windows\Temp\ultradefrag-portable-6.1.0.amd64\udefrag.exe" ( 11 | cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\ultradefrag.zip -oC:\Windows\Temp" 12 | ) 13 | 14 | if not exist "C:\Windows\Temp\SDelete.zip" ( 15 | powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://download.sysinternals.com/files/SDelete.zip', 'C:\Windows\Temp\SDelete.zip')" <NUL 16 | ) 17 | 18 | if not exist "C:\Windows\Temp\sdelete.exe" ( 19 | cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\SDelete.zip -oC:\Windows\Temp" 20 | ) 21 | 22 | msiexec /qb /x C:\Windows\Temp\7z920-x64.msi 23 | 24 | net stop wuauserv 25 | rmdir /S /Q C:\Windows\SoftwareDistribution\Download 26 | mkdir C:\Windows\SoftwareDistribution\Download 27 | net start wuauserv 28 | 29 | cmd /c C:\Windows\Temp\ultradefrag-portable-6.1.0.amd64\udefrag.exe --optimize --repeat C: 30 | 31 | cmd /c %SystemRoot%\System32\reg.exe ADD HKCU\Software\Sysinternals\SDelete /v EulaAccepted /t REG_DWORD /d 1 /f 32 | cmd /c C:\Windows\Temp\sdelete.exe -q -z C: 33 | -------------------------------------------------------------------------------- /packer/script/vm-guest-tools.bat: -------------------------------------------------------------------------------- 1 | if not exist "C:\Windows\Temp\7z920-x64.msi" ( 2 | powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://www.7-zip.org/a/7z920-x64.msi', 'C:\Windows\Temp\7z920-x64.msi')" <NUL 3 | ) 4 | msiexec /qb /i C:\Windows\Temp\7z920-x64.msi 5 | 6 | if "%PACKER_BUILDER_TYPE%" equ "vmware-iso" goto :vmware 7 | if "%PACKER_BUILDER_TYPE%" equ "virtualbox-iso" goto :virtualbox 8 | if "%PACKER_BUILDER_TYPE%" equ "parallels-iso" goto :parallels 9 | goto :done 10 | 11 | :vmware 12 | 13 | if exist "C:\Users\vagrant\windows.iso" ( 14 | move /Y C:\Users\vagrant\windows.iso C:\Windows\Temp 15 | ) 16 | 17 | if not exist "C:\Windows\Temp\windows.iso" ( 18 | powershell -Command "(New-Object System.Net.WebClient).DownloadFile('http://softwareupdate.vmware.com/cds/vmw-desktop/ws/12.0.0/2985596/windows/packages/tools-windows.tar', 'C:\Windows\Temp\vmware-tools.tar')" <NUL 19 | cmd /c ""C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\vmware-tools.tar -oC:\Windows\Temp" 20 | FOR /r "C:\Windows\Temp" %%a in (VMware-tools-windows-*.iso) DO REN "%%~a" "windows.iso" 21 | rd /S /Q "C:\Program Files (x86)\VMWare" 22 | ) 23 | 24 | cmd /c ""C:\Program Files\7-Zip\7z.exe" x "C:\Windows\Temp\windows.iso" -oC:\Windows\Temp\VMWare" 25 | cmd /c C:\Windows\Temp\VMWare\setup.exe /S /v"/qn REBOOT=R\" 26 | 27 | goto :done 28 | 29 | :virtualbox 30 | 31 | :: There needs to be Oracle CA (Certificate Authority) certificates installed in order 32 | :: to prevent user intervention popups which will undermine a silent installation. 33 | cmd /c certutil -addstore -f "TrustedPublisher" A:\oracle-cert.cer 34 | 35 | move /Y C:\Users\vagrant\VBoxGuestAdditions.iso C:\Windows\Temp 36 | cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\VBoxGuestAdditions.iso -oC:\Windows\Temp\virtualbox 37 | cmd /c C:\Windows\Temp\virtualbox\VBoxWindowsAdditions.exe /S 38 | goto :done 39 | 40 | :parallels 41 | if exist "C:\Users\vagrant\prl-tools-win.iso" ( 42 | move /Y C:\Users\vagrant\prl-tools-win.iso C:\Windows\Temp 43 | cmd /C "C:\Program Files\7-Zip\7z.exe" x C:\Windows\Temp\prl-tools-win.iso -oC:\Windows\Temp\parallels 44 | cmd /C C:\Windows\Temp\parallels\PTAgent.exe /install_silent 45 | ) 46 | 47 | :done 48 | msiexec /qb /x C:\Windows\Temp\7z920-x64.msi 49 | -------------------------------------------------------------------------------- /packer/vagrantfile-windows-10.tpl: -------------------------------------------------------------------------------- 1 | # -*- mode: ruby -*- 2 | # vi: set ft=ruby : 3 | 4 | Vagrant.configure("2") do |config| 5 | config.vm.box = "windows-10" 6 | 7 | # Port forward WinRM and RDP 8 | config.vm.network :forwarded_port, guest: 3389, host: 3389, id: "rdp", auto_correct:true 9 | config.vm.communicator = "winrm" 10 | config.vm.guest = :windows 11 | config.vm.network :forwarded_port, guest: 5985, host: 5985, id: "winrm", auto_correct:true 12 | 13 | config.vm.synced_folder ".", "/vagrant", disabled: true 14 | 15 | config.vm.provider :virtualbox do |v, override| 16 | v.gui = true 17 | v.name = "windows-10" 18 | v.customize ["modifyvm", :id, "--memory", 2048] 19 | v.customize ["modifyvm", :id, "--cpus", 2] 20 | v.customize ["modifyvm", :id, "--vram", "256"] 21 | v.customize ["setextradata", "global", "GUI/MaxGuestResolution", "any"] 22 | v.customize ["setextradata", :id, "CustomVideoMode1", "1024x768x32"] 23 | end 24 | 25 | config.vm.provider :parallels do |v, override| 26 | v.name = "windows-10" 27 | v.customize ["set", :id, "--cpus", 2] 28 | v.customize ["set", :id, "--memsize", 2048] 29 | v.customize ["set", :id, "--videosize", "256"] 30 | end 31 | end 32 | -------------------------------------------------------------------------------- /packer/windows_10.json: -------------------------------------------------------------------------------- 1 | { 2 | "provisioners": [ 3 | { 4 | "type": "file", 5 | "source": "iso/7z920-x64.msi", 6 | "destination": "C:/Windows/Temp/7z920-x64.msi" 7 | }, 8 | { 9 | "type": "file", 10 | "source": "iso/ultradefrag-portable-6.1.0.bin.amd64.zip", 11 | "destination": "C:/Windows/Temp/ultradefrag.zip" 12 | }, 13 | { 14 | "type": "file", 15 | "source": "iso/SDelete.zip", 16 | "destination": "C:/Windows/Temp/SDelete.zip" 17 | }, 18 | { 19 | "scripts": [ 20 | "script/vm-guest-tools.bat", 21 | "script/compact.bat" 22 | ], 23 | "type": "windows-shell" 24 | } 25 | ], 26 | "post-processors": [ 27 | { 28 | "type": "vagrant", 29 | "keep_input_artifact": false, 30 | "output": "windows_10_{{.Provider}}.box", 31 | "vagrantfile_template": "vagrantfile-windows-10.tpl" 32 | } 33 | ], 34 | "builders": [ 35 | { 36 | "boot_wait": "120s", 37 | "communicator": "winrm", 38 | "disk_size": 102400, 39 | "floppy_files": [ 40 | "floppy/Autounattend.xml", 41 | "floppy/install-winrm.cmd", 42 | "floppy/fixnetwork.ps1", 43 | "floppy/disablewinupdate.bat", 44 | "floppy/misc.bat", 45 | "floppy/zz-start-sshd.cmd", 46 | "floppy/oracle-cert.cer" 47 | ], 48 | "guest_os_type": "Windows7_64", 49 | "hard_drive_interface": "sata", 50 | "iso_checksum": "743fc483bb8bf1901c0534a0ae15208a5a72a3c5", 51 | "iso_checksum_type": "sha1", 52 | "iso_url": "iso/18362.30.190401-1528.19h1_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso", 53 | "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", 54 | "type": "virtualbox-iso", 55 | "vboxmanage": [ 56 | [ 57 | "modifyvm", 58 | "{{.Name}}", 59 | "--memory", 60 | "2048" 61 | ], 62 | [ 63 | "modifyvm", 64 | "{{.Name}}", 65 | "--cpus", 66 | "2" 67 | ] 68 | ], 69 | "vm_name": "packer-windows-10", 70 | "winrm_password": "vagrant", 71 | "winrm_timeout": "10000s", 72 | "winrm_username": "vagrant" 73 | }, 74 | { 75 | "boot_wait": "120s", 76 | "communicator": "winrm", 77 | "disk_size": 102400, 78 | "floppy_files": [ 79 | "floppy/Autounattend.xml", 80 | "floppy/install-winrm.cmd", 81 | "floppy/fixnetwork.ps1", 82 | "floppy/disablewinupdate.bat", 83 | "floppy/misc.bat", 84 | "floppy/zz-start-sshd.cmd", 85 | "floppy/oracle-cert.cer" 86 | ], 87 | "guest_os_type": "win-7", 88 | "hard_drive_interface": "sata", 89 | "iso_checksum": "743fc483bb8bf1901c0534a0ae15208a5a72a3c5", 90 | "iso_checksum_type": "sha1", 91 | "iso_url": "iso/18362.30.190401-1528.19h1_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x64FRE_en-us.iso", 92 | "parallels_tools_flavor": "win", 93 | "prlctl": [ 94 | [ 95 | "set", 96 | "{{.Name}}", 97 | "--memsize", 98 | "2048" 99 | ], 100 | [ 101 | "set", 102 | "{{.Name}}", 103 | "--cpus", 104 | "2" 105 | ] 106 | ], 107 | "shutdown_command": "shutdown /s /t 10 /f /d p:4:1 /c \"Packer Shutdown\"", 108 | "type": "parallels-iso", 109 | "vm_name": "packer-windows-10", 110 | "winrm_password": "vagrant", 111 | "winrm_timeout": "10000s", 112 | "winrm_username": "vagrant" 113 | } 114 | ] 115 | } 116 | -------------------------------------------------------------------------------- /setup/Default.preset: -------------------------------------------------------------------------------- 1 | ########## 2 | # Win 10 / Server 2016 / Server 2019 Initial Setup Script - Default preset 3 | # Author: Disassembler <disassembler@dasm.cz> 4 | # Version: v3.10, 2020-07-15 5 | # Source: https://github.com/Disassembler0/Win10-Initial-Setup-Script 6 | ########## 7 | 8 | ### Require administrator privileges ### 9 | RequireAdmin 10 | 11 | ### Privacy Tweaks ### 12 | DisableTelemetry # EnableTelemetry 13 | DisableCortana # EnableCortana 14 | DisableWiFiSense # EnableWiFiSense 15 | # DisableSmartScreen # EnableSmartScreen 16 | # DisableWebSearch # EnableWebSearch 17 | # DisableAppSuggestions # EnableAppSuggestions 18 | # DisableActivityHistory # EnableActivityHistory 19 | # DisableSensors # EnableSensors 20 | # DisableLocation # EnableLocation 21 | # DisableMapUpdates # EnableMapUpdates 22 | DisableFeedback # EnableFeedback 23 | DisableTailoredExperiences # EnableTailoredExperiences 24 | DisableAdvertisingID # EnableAdvertisingID 25 | DisableWebLangList # EnableWebLangList 26 | # DisableBiometrics # EnableBiometrics 27 | # DisableCamera # EnableCamera 28 | # DisableMicrophone # EnableMicrophone 29 | DisableErrorReporting # EnableErrorReporting 30 | # SetP2PUpdateLocal # SetP2PUpdateInternet # SetP2PUpdateDisable 31 | DisableDiagTrack # EnableDiagTrack 32 | DisableWAPPush # EnableWAPPush 33 | # EnableClearRecentFiles # DisableClearRecentFiles 34 | # DisableRecentFiles # EnableRecentFiles 35 | 36 | ### UWP Privacy Tweaks ### 37 | DisableUWPBackgroundApps # EnableUWPBackgroundApps 38 | # DisableUWPVoiceActivation # EnableUWPVoiceActivation 39 | # DisableUWPNotifications # EnableUWPNotifications 40 | # DisableUWPAccountInfo # EnableUWPAccountInfo 41 | # DisableUWPContacts # EnableUWPContacts 42 | # DisableUWPCalendar # EnableUWPCalendar 43 | # DisableUWPPhoneCalls # EnableUWPPhoneCalls 44 | # DisableUWPCallHistory # EnableUWPCallHistory 45 | # DisableUWPEmail # EnableUWPEmail 46 | # DisableUWPTasks # EnableUWPTasks 47 | # DisableUWPMessaging # EnableUWPMessaging 48 | # DisableUWPRadios # EnableUWPRadios 49 | # DisableUWPOtherDevices # EnableUWPOtherDevices 50 | # DisableUWPDiagInfo # EnableUWPDiagInfo 51 | # DisableUWPFileSystem # EnableUWPFileSystem 52 | # DisableUWPSwapFile # EnableUWPSwapFile 53 | 54 | ### Security Tweaks ### 55 | # SetUACLow # SetUACHigh 56 | # EnableSharingMappedDrives # DisableSharingMappedDrives 57 | # DisableAdminShares # EnableAdminShares 58 | # DisableFirewall # EnableFirewall 59 | # HideDefenderTrayIcon # ShowDefenderTrayIcon 60 | # DisableDefender # EnableDefender 61 | # DisableDefenderCloud # EnableDefenderCloud 62 | # EnableCtrldFolderAccess # DisableCtrldFolderAccess 63 | # EnableCIMemoryIntegrity # DisableCIMemoryIntegrity 64 | # EnableDefenderAppGuard # DisableDefenderAppGuard 65 | HideAccountProtectionWarn # ShowAccountProtectionWarn 66 | DisableDownloadBlocking # EnableDownloadBlocking 67 | # DisableScriptHost # EnableScriptHost 68 | # EnableDotNetStrongCrypto # DisableDotNetStrongCrypto 69 | # EnableMeltdownCompatFlag # DisableMeltdownCompatFlag 70 | EnableF8BootMenu # DisableF8BootMenu 71 | DisableBootRecovery # EnableBootRecovery 72 | DisableRecoveryAndReset # EnableRecoveryAndReset 73 | SetDEPOptOut # SetDEPOptIn 74 | 75 | ### Network Tweaks ### 76 | SetCurrentNetworkPrivate # SetCurrentNetworkPublic 77 | # SetUnknownNetworksPrivate # SetUnknownNetworksPublic 78 | # DisableNetDevicesAutoInst # EnableNetDevicesAutoInst 79 | DisableHomeGroups # EnableHomeGroups 80 | # DisableSMB1 # EnableSMB1 81 | # DisableSMBServer # EnableSMBServer 82 | # DisableNetBIOS # EnableNetBIOS 83 | # DisableLLMNR # EnableLLMNR 84 | # DisableLLDP # EnableLLDP 85 | # DisableLLTD # EnableLLTD 86 | # DisableMSNetClient # EnableMSNetClient 87 | # DisableQoS # EnableQoS 88 | # DisableIPv4 # EnableIPv4 89 | # DisableIPv6 # EnableIPv6 90 | # DisableNCSIProbe # EnableNCSIProbe 91 | # DisableConnectionSharing # EnableConnectionSharing 92 | DisableRemoteAssistance # EnableRemoteAssistance 93 | EnableRemoteDesktop # DisableRemoteDesktop 94 | 95 | ### Service Tweaks ### 96 | # DisableUpdateMSRT # EnableUpdateMSRT 97 | # DisableUpdateDriver # EnableUpdateDriver 98 | EnableUpdateMSProducts # DisableUpdateMSProducts 99 | # DisableUpdateAutoDownload # EnableUpdateAutoDownload 100 | DisableUpdateRestart # EnableUpdateRestart 101 | DisableMaintenanceWakeUp # EnableMaintenanceWakeUp 102 | # DisableAutoRestartSignOn # EnableAutoRestartSignOn 103 | DisableSharedExperiences # EnableSharedExperiences 104 | # EnableClipboardHistory # DisableClipboardHistory 105 | DisableAutoplay # EnableAutoplay 106 | DisableAutorun # EnableAutorun 107 | DisableRestorePoints # EnableRestorePoints 108 | # EnableStorageSense # DisableStorageSense 109 | # DisableDefragmentation # EnableDefragmentation 110 | # DisableSuperfetch # EnableSuperfetch 111 | # DisableIndexing # EnableIndexing 112 | # DisableRecycleBin # EnableRecycleBin 113 | EnableNTFSLongPaths # DisableNTFSLongPaths 114 | # DisableNTFSLastAccess # EnableNTFSLastAccess 115 | # SetBIOSTimeUTC # SetBIOSTimeLocal 116 | # EnableHibernation # DisableHibernation 117 | # DisableSleepButton # EnableSleepButton 118 | # DisableSleepTimeout # EnableSleepTimeout 119 | # DisableFastStartup # EnableFastStartup 120 | # DisableAutoRebootOnCrash # EnableAutoRebootOnCrash 121 | 122 | ### UI Tweaks ### 123 | EnableActionCenter # DisableActionCenter 124 | DisableLockScreen # EnableLockScreen 125 | # DisableLockScreenRS1 # EnableLockScreenRS1 126 | # HideNetworkFromLockScreen # ShowNetworkOnLockScreen 127 | # HideShutdownFromLockScreen # ShowShutdownOnLockScreen 128 | DisableLockScreenBlur # EnableLockScreenBlur 129 | # DisableAeroShake # EnableAeroShake 130 | DisableAccessibilityKeys # EnableAccessibilityKeys 131 | ShowTaskManagerDetails # HideTaskManagerDetails 132 | ShowFileOperationsDetails # HideFileOperationsDetails 133 | # EnableFileDeleteConfirm # DisableFileDeleteConfirm 134 | HideTaskbarSearch # ShowTaskbarSearchIcon # ShowTaskbarSearchBox 135 | HideTaskView # ShowTaskView 136 | # ShowSmallTaskbarIcons # ShowLargeTaskbarIcons 137 | SetTaskbarCombineAlways # SetTaskbarCombineNever # SetTaskbarCombineWhenFull 138 | HideTaskbarPeopleIcon # ShowTaskbarPeopleIcon 139 | # ShowTrayIcons # HideTrayIcons 140 | # ShowSecondsInTaskbar # HideSecondsFromTaskbar 141 | DisableSearchAppInStore # EnableSearchAppInStore 142 | DisableNewAppPrompt # EnableNewAppPrompt 143 | # HideRecentlyAddedApps # ShowRecentlyAddedApps 144 | # HideMostUsedApps # ShowMostUsedApps 145 | # SetWinXMenuPowerShell # SetWinXMenuCmd 146 | # SetControlPanelSmallIcons # SetControlPanelLargeIcons # SetControlPanelCategories 147 | DisableShortcutInName # EnableShortcutInName 148 | # HideShortcutArrow # ShowShortcutArrow 149 | SetVisualFXAppearance # SetVisualFXPerformance 150 | # EnableTitleBarColor # DisableTitleBarColor 151 | # SetAppsDarkMode # SetAppsLightMode 152 | # SetSystemLightMode # SetSystemDarkMode 153 | # AddENKeyboard # RemoveENKeyboard 154 | # EnableNumlock # DisableNumlock 155 | # DisableEnhPointerPrecision # EnableEnhPointerPrecision 156 | # SetSoundSchemeNone # SetSoundSchemeDefault 157 | # DisableStartupSound # EnableStartupSound 158 | # DisableChangingSoundScheme # EnableChangingSoundScheme 159 | # EnableVerboseStatus # DisableVerboseStatus 160 | DisableF1HelpKey # EnableF1HelpKey 161 | 162 | ### Explorer UI Tweaks ### 163 | # ShowExplorerTitleFullPath # HideExplorerTitleFullPath 164 | ShowKnownExtensions # HideKnownExtensions 165 | # ShowHiddenFiles # HideHiddenFiles 166 | # ShowSuperHiddenFiles # HideSuperHiddenFiles 167 | # ShowEmptyDrives # HideEmptyDrives 168 | # ShowFolderMergeConflicts # HideFolderMergeConflicts 169 | EnableNavPaneExpand # DisableNavPaneExpand 170 | # ShowNavPaneAllFolders # HideNavPaneAllFolders 171 | # ShowNavPaneLibraries # HideNavPaneLibraries 172 | # EnableFldrSeparateProcess # DisableFldrSeparateProcess 173 | # EnableRestoreFldrWindows # DisableRestoreFldrWindows 174 | # ShowEncCompFilesColor # HideEncCompFilesColor 175 | # DisableSharingWizard # EnableSharingWizard 176 | # HideSelectCheckboxes # ShowSelectCheckboxes 177 | # HideSyncNotifications # ShowSyncNotifications 178 | HideRecentShortcuts # ShowRecentShortcuts 179 | SetExplorerThisPC # SetExplorerQuickAccess 180 | ShowQuickAccess # HideQuickAccess 181 | # HideRecycleBinFromDesktop # ShowRecycleBinOnDesktop 182 | ShowThisPCOnDesktop # HideThisPCFromDesktop 183 | # ShowUserFolderOnDesktop # HideUserFolderFromDesktop 184 | # ShowControlPanelOnDesktop # HideControlPanelFromDesktop 185 | # ShowNetworkOnDesktop # HideNetworkFromDesktop 186 | # HideDesktopIcons # ShowDesktopIcons 187 | # ShowBuildNumberOnDesktop # HideBuildNumberFromDesktop 188 | HideDesktopFromThisPC # ShowDesktopInThisPC 189 | # HideDesktopFromExplorer # ShowDesktopInExplorer 190 | HideDocumentsFromThisPC # ShowDocumentsInThisPC 191 | # HideDocumentsFromExplorer # ShowDocumentsInExplorer 192 | HideDownloadsFromThisPC # ShowDownloadsInThisPC 193 | # HideDownloadsFromExplorer # ShowDownloadsInExplorer 194 | HideMusicFromThisPC # ShowMusicInThisPC 195 | # HideMusicFromExplorer # ShowMusicInExplorer 196 | HidePicturesFromThisPC # ShowPicturesInThisPC 197 | # HidePicturesFromExplorer # ShowPicturesInExplorer 198 | HideVideosFromThisPC # ShowVideosInThisPC 199 | # HideVideosFromExplorer # ShowVideosInExplorer 200 | Hide3DObjectsFromThisPC # Show3DObjectsInThisPC 201 | # Hide3DObjectsFromExplorer # Show3DObjectsInExplorer 202 | # HideNetworkFromExplorer # ShowNetworkInExplorer 203 | # HideIncludeInLibraryMenu # ShowIncludeInLibraryMenu 204 | # HideGiveAccessToMenu # ShowGiveAccessToMenu 205 | # HideShareMenu # ShowShareMenu 206 | # DisableThumbnails # EnableThumbnails 207 | DisableThumbnailCache # EnableThumbnailCache 208 | DisableThumbsDBOnNetwork # EnableThumbsDBOnNetwork 209 | 210 | ### Application Tweaks ### 211 | # DisableOneDrive # EnableOneDrive 212 | # UninstallOneDrive # InstallOneDrive 213 | UninstallMsftBloat # InstallMsftBloat 214 | UninstallThirdPartyBloat # InstallThirdPartyBloat 215 | # UninstallWindowsStore # InstallWindowsStore 216 | DisableXboxFeatures # EnableXboxFeatures 217 | # DisableFullscreenOptims # EnableFullscreenOptims 218 | DisableAdobeFlash # EnableAdobeFlash 219 | DisableEdgePreload # EnableEdgePreload 220 | DisableEdgeShortcutCreation # EnableEdgeShortcutCreation 221 | DisableIEFirstRun # EnableIEFirstRun 222 | DisableFirstLogonAnimation # EnableFirstLogonAnimation 223 | DisableMediaSharing # EnableMediaSharing 224 | # DisableMediaOnlineAccess # EnableMediaOnlineAccess 225 | # EnableDeveloperMode # DisableDeveloperMode 226 | # UninstallMediaPlayer # InstallMediaPlayer 227 | # UninstallInternetExplorer # InstallInternetExplorer 228 | # UninstallWorkFolders # InstallWorkFolders 229 | # UninstallHelloFace # InstallHelloFace 230 | UninstallMathRecognizer # InstallMathRecognizer 231 | # UninstallPowerShellV2 # InstallPowerShellV2 232 | UninstallPowerShellISE # InstallPowerShellISE 233 | # InstallLinuxSubsystem # UninstallLinuxSubsystem 234 | # InstallHyperV # UninstallHyperV 235 | # UninstallSSHClient # InstallSSHClient 236 | # InstallSSHServer # UninstallSSHServer 237 | # InstallTelnetClient # UninstallTelnetClient 238 | # InstallNET23 # UninstallNET23 239 | # SetPhotoViewerAssociation # UnsetPhotoViewerAssociation 240 | # AddPhotoViewerOpenWith # RemovePhotoViewerOpenWith 241 | # UninstallPDFPrinter # InstallPDFPrinter 242 | UninstallXPSPrinter # InstallXPSPrinter 243 | RemoveFaxPrinter # AddFaxPrinter 244 | # UninstallFaxAndScan # InstallFaxAndScan 245 | 246 | ### Server Specific Tweaks ### 247 | # HideServerManagerOnLogin # ShowServerManagerOnLogin 248 | # DisableShutdownTracker # EnableShutdownTracker 249 | # DisablePasswordPolicy # EnablePasswordPolicy 250 | # DisableCtrlAltDelLogin # EnableCtrlAltDelLogin 251 | # DisableIEEnhancedSecurity # EnableIEEnhancedSecurity 252 | # EnableAudio # DisableAudio 253 | 254 | ### Unpinning ### 255 | # UnpinStartMenuTiles 256 | # UnpinTaskbarIcons 257 | 258 | ### Auxiliary Functions ### 259 | WaitForKey 260 | Restart 261 | -------------------------------------------------------------------------------- /setup/R15.md: -------------------------------------------------------------------------------- 1 | # 30 轮 R15 2 | 3 | <https://www.zhihu.com/question/384773491> 4 | 5 | 将下面代码保存为批处理文件 6 | 7 | ```bat 8 | for /l %%x in (1, 1, 30) do ( 9 | "CINEBENCH Windows 64 Bit.exe" -cb_cpux >>"cpu_output.txt" 10 | ) 11 | 12 | ``` 13 | 14 | [转换](https://api.1996wz.cn/html/test) 15 | 16 | 17 | -------------------------------------------------------------------------------- /setup/TurnOffMonitor.cmd: -------------------------------------------------------------------------------- 1 | @echo off 2 | powershell (Add-Type '[DllImport(\"user32.dll\")]^public static extern int SendMessage(int hWnd, int hMsg, int wParam, int lParam);' -Name a -Pas)::SendMessage(-1,0x0112,0xF170,2) 3 | -------------------------------------------------------------------------------- /setup/desktop_icons.ps1: -------------------------------------------------------------------------------- 1 | #----------------------------------------------------------# 2 | # This PC in desktop 3 | #----------------------------------------------------------# 4 | 5 | # https://gallery.technet.microsoft.com/scriptcenter/How-to-show-This-PC-or-7cbcfe7b 6 | 7 | # Registry key path 8 | $path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\HideDesktopIcons\NewStartPanel" 9 | 10 | # Property name 11 | $name = "{20D04FE0-3AEA-1069-A2D8-08002B30309D}" 12 | 13 | # check if the property exists 14 | $item = Get-ItemProperty -Path $path -Name $name -ErrorAction SilentlyContinue 15 | if ($item) { 16 | #set property value 17 | Set-ItemProperty -Path $path -name $name -Value 0 18 | } 19 | Else { 20 | #create a new property 21 | New-ItemProperty -Path $path -Name $name -Value 0 -PropertyType DWORD | Out-Null 22 | } 23 | -------------------------------------------------------------------------------- /setup/msys2.md: -------------------------------------------------------------------------------- 1 | # [MSYS2](http://msys2.github.io/) 2 | 3 | * Install MSYS2 to get a working Gtk+3 4 | 5 | ## Install 6 | 7 | 1. Download [msys2 installer](http://repo.msys2.org/distrib/i686/msys2-i686-20190524.exe) and install it. 8 | 9 | 2. Update the system packages. 10 | 11 | ```bash 12 | # Start c:\msys32\msys2_shell.bat 13 | pacman -Syu 14 | pacman -Sy --needed bash pacman pacman-mirrors msys2-runtime 15 | 16 | ``` 17 | 18 | 3. Other packages. 19 | 20 | ```bash 21 | # msys itself 22 | pacman -S --needed --noconfirm base-devel 23 | pacman -S --needed --noconfirm msys2-devel 24 | pacman -S --needed --noconfirm xz zip unzip 25 | 26 | # 32bit mingw 27 | # pacman -S mingw32/mingw-w64-i686-toolchain 28 | 29 | # gtk3 30 | pacman -S --needed --noconfirm mingw32/mingw-w64-i686-gtk3 31 | pacman -S --needed --noconfirm mingw32/mingw-w64-i686-gobject-introspection 32 | 33 | # others 34 | # pacman -S mingw32/mingw-w64-i686-imagemagick 35 | 36 | # fix .pc files 37 | find /mingw32/lib/pkgconfig -name "*.pc" | 38 | sort | 39 | xargs perl -i -nlp -e '/^prefix/ and $_ = q{prefix=${pcfiledir}/../..}; /msys64/ and s/msys64/msys32/g' 40 | 41 | ``` 42 | 43 | ## Pacman常用命令 44 | 45 | ```bash 46 | # 列出所有安装包 47 | pacman -Sl 48 | 49 | # 搜索安装包 50 | pacman -Ss 安装包名称 51 | pacman -Sl | grep 安装包名称 52 | 53 | # 卸载安装包 54 | # 删除单个软件包,保留其全部已经安装的依赖关系 55 | pacman -R 安装包名称 56 | 57 | # 删除指定软件包,及其所有没有被其他已安装软件包使用的依赖关系 58 | pacman -Rs 安装包名称 59 | 60 | # 要删除软件包和所有依赖这个软件包的程序 61 | pacman -Rsc 安装包名称 62 | 63 | # 查看安装包 64 | # 特定软件包 65 | pacman -Q 安装包名称 66 | 67 | # 列出所有已安装的软件包 68 | pacman -Q 69 | 70 | # 升级 71 | # 更新软件包数据库 72 | pacman -Sy 73 | # 升级系统 74 | pacman -Su 75 | 76 | # 清理缓存 77 | # 仅在确定当前安装的软件包足够稳定且不需要降级时才执行清理。旧版本的软件包能在系统更新崩溃时派上用场 78 | pacman -Sc 79 | # 清理所有缓存,但这样 pacman 在重装软件包时就只能重新下载了。除非空间不足,否则不应这么做 80 | pacman -Scc 81 | 82 | ``` 83 | -------------------------------------------------------------------------------- /setup/openssh.md: -------------------------------------------------------------------------------- 1 | # Optional: OpenSSH Server 2 | 3 | Microsoft ported OpenSSH to Windows after 4 | [the 1809 release](https://docs.microsoft.com/zh-cn/windows-server/administration/openssh/openssh_install_firstuse), 5 | but I got some errors while trying this approach. 6 | 7 | So use the old way. 8 | 9 | * [Ref 1](https://github.com/PowerShell/Win32-OpenSSH/wiki/Install-Win32-OpenSSH) 10 | * [Ref 2](http://chrisarges.net/2019/07/16/openssh-install-on-windows.html) 11 | 12 | ```powershell 13 | if (!(Test-Path OpenSSH-Win64.zip -PathType Leaf)) { 14 | Invoke-WebRequest 'https://github.com/PowerShell/Win32-OpenSSH/releases/download/v8.1.0.0p1-Beta/OpenSSH-Win64.zip' -OutFile 'OpenSSH-Win64.zip' 15 | } 16 | sudo Expand-Archive -Path OpenSSH-Win64.zip -DestinationPath 'C:\Program Files\' 17 | 18 | cd 'C:\Program Files\OpenSSH-Win64\' 19 | sudo .\install-sshd.ps1 20 | 21 | # Firewall 22 | sudo netsh advfirewall firewall add rule name=sshd dir=in action=allow protocol=TCP localport=22 23 | 24 | # Start Service 25 | sudo net start sshd 26 | sudo Set-Service sshd -StartupType Automatic 27 | 28 | ``` 29 | 30 | There is a bug when transfer [large files](https://github.com/PowerShell/Win32-OpenSSH/issues/1395) 31 | via sftp to Windows, be careful. 32 | 33 | # Optional: ssh-copy-id 34 | 35 | 36 | ```powershell 37 | ssh-keygen -f $env:USERPROFILE/.ssh/id_rsa 38 | 39 | type $env:USERPROFILE/.ssh/id_rsa.pub | ssh wangq@202.119.37.251 "cat >> .ssh/authorized_keys" 40 | 41 | ``` 42 | -------------------------------------------------------------------------------- /setup/python.md: -------------------------------------------------------------------------------- 1 | 2 | ```shell 3 | # pytorch 4 | pip install pysocks 5 | # $ENV:ALL_PROXY='socks5h://localhost:10808' 6 | 7 | pip uninstall torch 8 | pip cache purge 9 | pip install torch -f https://download.pytorch.org/whl/torch_stable.html 10 | 11 | pip install -U openai-whisper 12 | 13 | whisper --language Japanese --task translate --output_format srt sakura.wav 14 | 15 | ``` 16 | -------------------------------------------------------------------------------- /setup/rust.md: -------------------------------------------------------------------------------- 1 | # Rust and C/C++ 2 | 3 | ## [C++ Build Tools](https://visualstudio.microsoft.com/visual-cpp-build-tools/) 4 | 5 | Select `Desktop development with C++` and Language packs English/Chinese 6 | 7 | ## docs from Microsoft 8 | 9 | https://docs.microsoft.com/en-us/windows/dev-environment/rust/setup 10 | 11 | ## [`rustup`](https://rustup.rs/) 12 | 13 | ```powershell 14 | # rustup 15 | rustup self update 16 | rustup update 17 | rustup component add clippy rust-analysis rust-src rustfmt 18 | 19 | cargo install cargo-expand 20 | cargo install cargo-release 21 | cargo install cargo-binstall 22 | cargo install cargo-tarpaulin 23 | 24 | cargo install intspan 25 | cargo install nwr 26 | 27 | ``` 28 | 29 | * vscode extensions 30 | 31 | ```powershell 32 | # code --install-extension rust-lang.rust 33 | # code --install-extension matklad.rust-analyzer 34 | # code --install-extension bungcip.better-toml 35 | 36 | ``` 37 | 38 | > Due to it's design IO between the host (Windows) and virtual machine (distro inside WSL2) is slow and the latency is enormous. 39 | > With WSL2 you should be always compiling your project from Linux filesystem and not from Windows mounted directories 40 | 41 | https://github.com/rust-lang/rust/issues/55684#issuecomment-734433698 42 | 43 | ## [`vcpkg`](https://github.com/microsoft/vcpkg) 44 | 45 | * Install vcpkg. Open PowerShell as an Administrator 46 | 47 | ```powershell 48 | scoop install cmake 49 | 50 | cd c:/ 51 | git clone https://github.com/Microsoft/vcpkg.git 52 | 53 | cd c:/vcpkg 54 | ./bootstrap-vcpkg.bat 55 | 56 | ./vcpkg integrate install 57 | 58 | # Add to Path 59 | [Environment]::SetEnvironmentVariable( 60 | "Path", 61 | [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine) + ";C:\vcpkg", 62 | [EnvironmentVariableTarget]::Machine) 63 | 64 | ``` 65 | 66 | * Install some packages 67 | 68 | ```powershell 69 | vcpkg install zlib curl sqlite3 70 | 71 | ``` 72 | -------------------------------------------------------------------------------- /setup/scoop.md: -------------------------------------------------------------------------------- 1 | # Scoop 2 | 3 | ## Install Scoop 4 | 5 | ```powershell 6 | Set-ExecutionPolicy RemoteSigned -Scope CurrentUser 7 | 8 | # $ENV:ALL_PROXY='socks5h://localhost:10808' 9 | # $ENV:HTTP_PROXY='http://localhost:10809' 10 | # $ENV:HTTPS_PROXY='http://localhost:10809' 11 | 12 | irm get.scoop.sh | iex 13 | 14 | scoop bucket add main 15 | scoop bucket add extras 16 | scoop bucket add versions 17 | 18 | scoop install 7zip 19 | scoop install dark innounp 20 | 21 | ``` 22 | 23 | ## Install packages 24 | 25 | ```powershell 26 | # downloading tools 27 | scoop install aria2 wget 28 | 29 | scoop config aria2-enabled false 30 | 31 | # gnu 32 | scoop install gzip unzip grep 33 | scoop install sed 34 | 35 | scoop install pup 36 | 37 | # extra 38 | scoop install sqlitestudio 39 | 40 | # scoop install proxychains 41 | 42 | # List installed packages 43 | scoop list 44 | 45 | ``` 46 | -------------------------------------------------------------------------------- /setup/set_strawberry.pl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/perl 2 | use strict; 3 | use warnings; 4 | 5 | use List::MoreUtils qw(uniq); 6 | use Win32; 7 | use Win32::Env; 8 | 9 | # check admin rights 10 | # On Windows vista and 7, you should run this script as Administrator 11 | print Win32::GetOSDisplayName(), "\n\n"; 12 | if ( Win32::IsAdminUser() ) { 13 | print "Got admin rights, continue.\n\n"; 14 | } 15 | else { 16 | print "Your should get admin rights first to run this script.\n\n"; 17 | exit 1; 18 | } 19 | 20 | # INCLUDE, LIB and PATH 21 | my $add = { 22 | INCLUDE => [ 23 | qw{ 24 | C:\strawberry\c\include 25 | C:\strawberry\gtk\include 26 | C:\strawberry\perl\lib\CORE 27 | } 28 | ], 29 | LIB => [ 30 | qw{ 31 | C:\strawberry\c\lib 32 | C:\strawberry\gtk\lib 33 | C:\strawberry\perl\bin 34 | } 35 | ], 36 | PATH => [ 37 | qw{ 38 | C:\strawberry\c\bin 39 | C:\strawberry\gtk\bin 40 | C:\strawberry\perl\bin 41 | C:\strawberry\perl\site\bin 42 | } 43 | ], 44 | PKG_CONFIG_PATH => [ 45 | qw{ 46 | C:\strawberry\c\lib\pkgconfig 47 | C:\strawberry\gtk\lib\pkgconfig 48 | } 49 | ], 50 | GTK_BASEPATH => qw{ C:\strawberry\gtk }, 51 | }; 52 | 53 | # Misc variables 54 | # See the follow link for details 55 | # http://win32.perl.org/wiki/index.php?title=Environment_Variables 56 | my $add_misc = { 57 | HOME => $ENV{HOMEDRIVE} . $ENV{HOMEPATH}, 58 | PGPLOT_FONT => 59 | qw{ C:\strawberry\perl\site\lib\PGPLOT\pgplot_supp\grfont.dat }, 60 | PLPLOT_LIB => qw{ c:\strawberry\perl\site\lib\PDL\plplot_supp }, 61 | PROJ_LIB => qw{ c:\strawberry\perl\site\lib\PDL\proj_supp }, 62 | }; 63 | 64 | # Other bin paths 65 | my $add_others = { 66 | PATH => [ 67 | qw{ 68 | c:\Python27 69 | c:\Python27\Scripts 70 | } 71 | ], 72 | }; 73 | 74 | # Actually do things 75 | add($add) and print "Set INCLUDE, LIB and PATH\n"; 76 | add($add_misc) and print "Set misc variables\n"; 77 | add($add_others) and print "Set other bin paths\n"; 78 | 79 | # Associate .pl with perl 80 | system('ASSOC .pl=PerlScript'); 81 | system('FTYPE PerlScript=C:\strawberry\perl\bin\perl.exe %1 %*'); 82 | 83 | # Pass a hashref to this sub. 84 | # The key-value pairs are env keys and values. 85 | # When the value is an arrayref, the content will be appended to existing 86 | # values. When the value is a string, the content will be write directly to 87 | # the env variable, overwriting existing one. 88 | sub add { 89 | my $dispatch = shift; 90 | 91 | for my $key ( sort keys %$dispatch ) { 92 | my $value = $dispatch->{$key}; 93 | if ( ref $value eq 'ARRAY' ) { 94 | my @exists; 95 | eval { @exists = split /;/, GetEnv( ENV_SYSTEM, $key ); }; 96 | print $@, "\n" if $@; 97 | for my $add (@$value) { 98 | @exists = grep { lc $add ne lc $_ } @exists; 99 | push @exists, $add; 100 | } 101 | @exists = uniq(@exists); 102 | SetEnv( ENV_SYSTEM, $key, join( ';', @exists ) ); 103 | } 104 | else { 105 | SetEnv( ENV_SYSTEM, $key, $value ); 106 | } 107 | } 108 | 109 | return 1; 110 | } 111 | 112 | __END__ 113 | -------------------------------------------------------------------------------- /setup/win7_default_share.reg: -------------------------------------------------------------------------------- 1 | Windows Registry Editor Version 5.00 2 | 3 | [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System] 4 | "LocalAccountTokenFilterPolicy"=dword:00000001 5 | -------------------------------------------------------------------------------- /vm/.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore everything in this directory 2 | * 3 | 4 | # Except these files 5 | !.gitignore 6 | --------------------------------------------------------------------------------