我通過創建總部設在巧克力味的命令非常簡單的腳本解決了這個問題(腳本安裝放浪,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)環境中測試安裝過程。 –