我通过创建总部设在巧克力味的命令非常简单的脚本解决了这个问题(脚本安装放浪,VirtualBox的,复制,我需要的文件,创建文件夹,我需要):
# Set PowerShell policy to Unrestricted
Set-ExecutionPolicy Unrestricted -Force
# Install Chocolatey
iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex
# Turn off confirmation in Chocolatey
chocolatey feature enable -n=allowGlobalConfirmation
# Install Vagrant
choco install vagrant
# Install VirutalBox
choco install virtualbox
# Create folder where Vagrant box will be placed
New-Item -ItemType directory -Path "D:\VagrantBoxes\Win8"
# Create folder where release will be placed
New-Item -ItemType directory -Path "D:\Release"
# Map network drive (release folder)
New-PSDrive –Name “B” –PSProvider FileSystem –Root
“\\r\P\A\OS\D B\R 2\x64” –Persist
# Map network drive (vagrant boxes folder)
New-PSDrive –Name “B” –PSProvider FileSystem –Root
“\\r\P\A\A\V M\V m” –Persist
# Copy Vagrant box from network folder
Copy-Item -Path
"B:\windows_81x64-enterprise_virtualbox_15.07.17.box" -Destination "D:\VagrantBoxes\Win8"
# Copy newest build from network folder to remote machine
Get-ChildItem "B:\" -Filter '*.exe' | Where Name -NotMatch '.*NoDB\.exe$' | Sort LastWriteTime -Descending | Select -First 1 | Copy-Item -Destination 'D:\'
# Navigate to folder where Vagrant file will be placed
CD "D:\VagrantBoxes\Win8"
# Mount Windows box
vagrant init windows_81x64-enterprise_virtualbox_15.07.17.box
# Run Vagrant
vagrant up
第二个脚本是Windows机器内部软件的安装过程(我不能在这里发布这个代码)。
使用FileZilla,Hyper-V,VMWare或类似的方式部署Windows映像是否可行? –
当然,为什么不呢。我正在从零开始构建一切,为什么不尝试所有可能的解决方案?除了VMWare。我选择了Vagrant + PowerShell,因为它很容易创建Windows虚拟机和PowerShell,因为我有用PS编写的脚本(带有静默安装选项)。基本上,我需要在Windows(8.1和10)环境中测试安装过程。 –