The code in this repo contains the script files we use to create the free VMs available in https://developer.microsoft.com/en-us/microsoft-edge/tools/vms/ The main reason to open source this project is for the community to help with the templates of the different VMs and add features or configurations that might be useful for them.
This script generates VMs for several platforms (VirtualBox and Vagrant, Parallels, Hyper-V, VMWare), notifies via email of the process, uploads the files to an Azure Storage for its distribution and creates a new JSON file to put on the website. Some of these steps will not make sense for you so feel free to hack around and disable them.
There are some known issues with the scripts so make sure to check the issues section.
Currently this process only works on Windows 8.1 machines.
- Windows 8.1 (working on a solution that works for Windows 10)
- Packer 0.8.6 For Windows and Mac (It's an old version, we know)
- VirtualBox 5.0.2 for Windows hosts
- VMware Workstation
- Hyper-V
- Parallels Desktop 11 for Mac
- 7-Zip for Windows 64bits
- AzCopy
- Putty
- Visual Studio Community
The following are the instructions to set up an environment almost fully automated. During the VM creation process sometimes the host needs to be rebooted or some permissions are required. If you don't some manual intervention you can skip some steps like AutoLogon, etc.
git clone https://github.com/MicrosoftEdge/dev.microsoftedge.com-vms/
Unzip Packer files to C:\packer
.
Packer doesn't support Hyper-V currently. PR-2576 adds support to it but hasn't been merged yet.
Although we are working on updating the project to work with that PR, in the meantime you will have to use this Hyper-V plugin for Packer. Please follow the instructions in the repo to compile it for Windows and place the plugin into C:\packer
.
We automatically install the Guest Extensions, but to do that silently the installation needs to add the Oracle certificate to the list of trusted certs in the guest OS. Right now we suggest that you follow the process described in this guide. You will have to place that .cer
file in scripts\floppy\guesttools\oracle-cert.cer
. In the near future we plan to update the process to follow the guidance of the official manual in the section 4.2.1.3. Unattended Installation.
Set the execution policy by typing this into your powershell window:
Set-ExecutionPolicy -ExecutionPolicy Unrestricted -Force
setx PATH "%PATH%;C:\Packer;C:\Program Files\7-Zip"
New-ItemProperty -Path HKLM:Software\Microsoft\Windows\CurrentVersion\policies\system -Name EnableLUA -PropertyType DWord -Value 0 -Force
The following registry setting sets the auto logon and also saves the default username and password which will be used to log in at every reboot.
$RegPath = "HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Winlogon"
Set-ItemProperty $RegPath "AutoAdminLogon" -Value "1" -type String
Set-ItemProperty $RegPath "DefaultUsername" -Value "DomainName\Administrator" -type String
Set-ItemProperty $RegPath "DefaultPassword" -Value "Password" -type String
The bin
folder should have the following folders
AzCopy
with all the binaries and no subfoldersPutty
with plink.exe and putty.exePackerMerge
with the output of compiling the projecttools\PackerMerge
with Visual Studio (it should copy the output directly to the right folder when the build is finished)VMSGen\
with the output of compiling the projecttools\VMSGen
with Visual Studio (it should copy the output directly to the right folder when the build is finished)
You will also need to download BgInfo, unzip it and put the .exe in scripts\floppy\bginfo\
Remember to install also 7-Zip for Windows 64bits
To Enable Hypervisor:
bcdedit /set hypervisorlaunchtype auto
To Disable Hypervisor:
bcdedit /set hypervisorlaunchtype off
It is recommended that first machine that we generated should not be HyperV. First time we generate a Hyper-V virtual machiche the computer will reboot.
Clone this repo to /Users/admin/dev.microsoftedge.com-vms/
git clone https://github.com/MicrosoftEdge/dev.microsoftedge.com-vms/
Turn Apple File Sharing on
sudo launchctl load -w /System/Library/LaunchDaemons/com.apple.AppleFileServer.plist
Share Repository folder
sudo sharing -a /Users/admin/dev.microsoftedge.com-vms/
Unzip Packer files to /Users/packer
- Open up Terminal.
- Run the following command:
sudo nano /etc/paths
- Enter your password, when prompted.
- Go to the bottom of the file, and enter the path you wish to add (/Users/admin/packer)
- Hit control-x to quit.
- Enter “Y” to save the modified buffer.
The Apple Mac OS X operating system has SSH installed by default but the SSH daemon is not enabled. This means vmgen script can't login remotely or do remote copies until you enable it.
To enable it, go to "System Preferences". Under "Internet & Networking" there is a "Sharing" icon. Run that. In the list that appears, check the "Remote Login" option.
This process uses ISOs, and more precisely the Client Enterprise Evaluation. You should legally get a copy of the iso for the guest you want to build and put it directly in the the scripts\iso
folder.
If you want to speed up the process of creating the VMs you can create an Integrated Up To Date Windows ISO. There are online guides such as this one that explains the process in detail.
In order to run the script, we need to open any Windows PowerShell console with Admin rights and run the script vmgen.ps1 with the -Build parameter.
.\vmgen.ps1 -Build
This script requires a configuration file called vmgen.json
located in the same directory. This file is used by the generation tool to know which Virtual Machines must be generated. The content of the configuration file must have this format:
{
"Build": "20150901",
"OutputPath": "D:\\vms",
"AzureUpload": false,
"GenerateMultipart": true,
"AzureStorage": {
"Url" : "https://yourblostorage.blob.core.windows.net/vms",
"Key" : "xxxxxxxxxxx..."
},
"Mac": {
"IP": "192.168.0.2",
"SSH_User": "admin",
"SSH_Password": "password",
"NetworkPath": "\\\\MAC\\microsoftedge-vms",
"RepoPath" : "/Users/admin/dev.microsoftedge.com-vms",
"PackerPath" : "/Users/admin/packer"
},
"Mail": {
"SMTP": "smtp.office365.com",
"From": "[email protected]",
"To": "[email protected]",
"User": "[email protected]",
"Password": ""
},
"VMS": {
"Windows": {
"HyperV": {
"MSEdge": [
"Win10"
],
"IE11": [
"Win81", "Win7"
],
"IE10": [
"Win7"
]
},
"VirtualBox": {
"IE11": [
"Win81", "Win7"
],
"IE10": [
"Win7"
]
}
},
"Mac": {
"Parallels": {
"IE11": [
"Win81", "Win7"
],
"IE10": [
"Win7"
]
}
}
}
}
-
Build - Indicates build number. This identifier will be used to generate output folder name.
-
OutputPath - Path to store ZIP files.
-
AzureUpload - Indicates if output files will be uploaded to an Azure storage account.
-
AzureStorage - Contains the Url and the Key of de Azure Storage Account to upload de output files.
-
Mac - Contains IP, SSH User & password, and a shared path.
-
Mail - SMTP configuration to send emails to the appropriate people
-
VMS - Object struct to set the dev.microsoftedge.com Virtual Machines to be generated. The valid values for each level are as follows:
- First Level - Windows, Mac
- Second Level - HyperV, VirtualBox, VMware, Parallels, VPC
- Third Level - IE8, IE9, IE10, IE11, MSEdge
- Fourth Level - Win7, Win81, Win10
To upload the generated files after a build without regenerate de VMs, we need to run the script vmgen.ps1 with the -Build and -OnlyUpload parameter.
.\vmgen.ps1 -Build -OnlyUpload
A JSON specific version will be generated in OutputPath. If you want your result to be merge with another file, place it in the same folder with the name vms.json.
To generate a new platform perform the following steps:
- Make a copy of
floppy_files_OS.json
,OSx64.json
andurls_OSx64.json
files from template-parts/templates to template-parts. - Change OS by the name of the new platform identifier (i.e. Win10TH2).
- Edit
url_OSx64.json
and enter the correctiso_url
andiso_checksum
properties. - Edit
OSx64.json
and changevm_name
andoutput_directory
properties for every builder configuration. - It's not mandatory to change
floppy_files_OS.json
. You can leave it without changes. - Edit
BuildTemplates.ps1
and and the follow lines to add a new template generation.
$template = "MSEdge-Win10TH2" ..\bin\PackerMerge\PackerMerge -i:".\template-parts\user.json,.\template-parts\urls_OSx64.json,.\template-parts\OSx64.json,.\template-parts\floppy_files_common.json,.\template-parts\floppy_files_OS.json,.\template-parts\provisioner_common.json,.\template-parts\pp-vagrant.json" -o:".\template-output\$template.json" Write-Verbose "$template.json created."
Win7 | Win81 | Win10 | |
---|---|---|---|
MSEdge | - | - | X |
IE11 | X | X | - |
IE10 | X | - | - |
IE9 | X | - | - |
IE8 | X | - | - |
IE7 | - | - | - |
VPC | HyperV | VBox | VMware | Parallels | |
---|---|---|---|---|---|
Win7 | X | X | X | X | X |
Win81 | - | X | X | X | X |
Win10 | - | X | X | X | X |
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact [email protected] with any additional questions or comments.