I tried to execute these commands to install .exe file inside Vagrant box
# Copyfile from network shared folder to folder in host machine
Get-ChildItem "L:\" -Filter *.exe | Where Name -NotMatch '.*NoDB\.exe$' | % {
New-Object psobject -Property @{
No = [int]([regex]::Match($_.Name, '(?<=CL)\d+').Value)
Name = $_.FullName
}
} | Sort No -Descending | Select -ExpandProperty Name -First 1 | Copy-Item -Destination "C:\VagrantBoxes\Win8"
# Copy installation script to Vagrant folder which is share with Vagrant
Copy-Item -Path "C:\Users\PS\Des\Scr_Re_Win_8\Install_Ort.ps1" -Destination "C:\VagrantBoxes\Win8"
# Navigate to Vagrant machine folder
CD "C:\VagrantBoxes\Win8"
# Check if Vagrant is up
vagrant.exe up
# Run PowerShell in Vagrant
vagrant.exe powershell
# Navigate to the folder which is shared with Vagrant
CD "C:\vagrant"
#Set policy to Unrestricted
Set-ExecutionPolicy Unrestricted -Force
# Install Chocolatey
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
# Install .net 3.5
choco install dotnet3.5 -force
# Run Ort installation script
.\Install_Ort.ps1
But in the end when PowerShell is activated in Vagrant box I can't execute last commands
# Navigate to the folder which is shared with Vagrant
CD "C:\vagrant"
#Set policy to Unrestricted
Set-ExecutionPolicy Unrestricted -Force
# Install Chocolatey
iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1'))
# Install .net 3.5
choco install dotnet3.5 -force
# Run Ort installation script
.\Install_Ort.ps1
I see that PowerShell console is active in Vagrant but commands are not executed via PowerShell inside Vagrant box. I can manually type commands but not as part of the script.