2016-06-11 35 views
0

我所拥有的:我需要安装的流浪,桌面应用程序(Windows应用程序(exe)),在企业网络中共享的文件夹(应用程序构建被保存)。在Vagrant中自动安装桌面应用程序的可能性

我需要做的:

  1. 安装放浪(现在我做手工) - 完成;
  2. 安装Windows 8.1和Windows 10盒(现在我手动完成) - 完成;
  3. 从企业网络中共享的文件夹(该文件夹中有多个文件)获取应用程序(.exe文件)的最新版本,将其放入Vagrant机器(例如Win 8)并以静默方式安装在。

所有的过程应尽可能自动化。

但我不能将Vagrant和复制/安装应用程序结合到Vagrant机器上。我在PowerShell中挖掘 - 但没有运气......我有用于无提示安装的PowerShell脚本,但也许有能力为所有这些操作(例如PowerShell)创建一个脚本?我知道我可以使用巧克力,但我需要一个脚本,可以一步一步的行动。

+0

使用FileZilla,Hyper-V,VMWare或类似的方式部署Windows映像是否可行? –

+0

当然,为什么不呢。我正在从零开始构建一切,为什么不尝试所有可能的解决方案?除了VMWare。我选择了Vagrant + PowerShell,因为它很容易创建Windows虚拟机和PowerShell,因为我有用PS编写的脚本(带有静默安装选项)。基本上,我需要在Windows(8.1和10)环境中测试安装过程。 –

回答

0

我通过创建总部设在巧克力味的命令非常简单的脚本解决了这个问题(脚本安装放浪,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机器内部软件的安装过程(我不能在这里发布这个代码)。

相关问题