Skip to content

Commit

Permalink
Add Windows 11 Professional (vmware-samples#130)
Browse files Browse the repository at this point in the history
- Adds Windows 11 Professional
- Separate `init` and `prepare` scripts for desktop vs. server.
- Updates `README.md`.
  • Loading branch information
tenthirtyam committed Oct 14, 2021
1 parent 4bfe1f6 commit 31fba9c
Show file tree
Hide file tree
Showing 14 changed files with 1,002 additions and 10 deletions.
9 changes: 6 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,9 @@

<img alt="Last Commit" src="https://img.shields.io/github/last-commit/rainpole/packer-vsphere?style=for-the-badge&logo=github"> [<img alt="The Changelog" src="https://img.shields.io/badge/The%20Changelog-Read-blue?style=for-the-badge&logo=github">](CHANGELOG.md) [<img alt="Open in Visual Studio Code" src="https://img.shields.io/badge/Visual%20Studio%20Code-Open-blue?style=for-the-badge&logo=visualstudiocode">](https://open.vscode.dev/rainpole/packer-vsphere)
<br/>
<img alt="VMware vSphere 7.0 Update 2" src="https://img.shields.io/badge/VMware%20vSphere-7.0%20Update%202-blue?style=for-the-badge">
<img alt="Packer 1.7.6" src="https://img.shields.io/badge/HashiCorp%20Packer-1.7.6-blue?style=for-the-badge&logo=packer">
<img alt="VMware vSphere 7.0 Update 2+" src="https://img.shields.io/badge/VMware%20vSphere-7.0%20Update%202+-blue?style=for-the-badge">
<img alt="Packer 1.7.6+" src="https://img.shields.io/badge/HashiCorp%20Packer-1.7.6+-blue?style=for-the-badge&logo=packer">
<img alt="Ansible 2.9+" src="https://img.shields.io/badge/Ansible-2.9+-blue?style=for-the-badge&logo=ansible">

## Table of Contents
1. [Introduction](#Introduction)
Expand Down Expand Up @@ -191,6 +192,7 @@ The files are distributed in the following directories.
* Microsoft Windows Server 2022
* Microsoft Windows Server 2019
* Microsoft Windows Server 2016
* Microsoft Windows 11 Professional
* Microsoft Windows 10 Professional

3. Obtain the checksum type (_e.g._ `sha256`, `md5`, etc.) and checksum value for each guest operating system `.iso` image. This will be use in the build input variables.
Expand Down Expand Up @@ -620,7 +622,8 @@ Start a build by running the build script (`./build.sh`). The script presents a
17 - Windows Server 2016 - All
18 - Windows Server 2016 - Standard Only
19 - Windows Server 2016 - Datacenter Only
20 - Windows 10 Professional
20 - Windows 11 Professional
21 - Windows 10 Professional
Other:
Expand Down
33 changes: 32 additions & 1 deletion build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,35 @@ menu_option_19() {
}

menu_option_20() {
INPUT_PATH="$SCRIPT_PATH"/builds/windows/windows-11/
echo -e "\nCONFIRM: Build Microsoft Windows 11 Professional Template for VMware vSphere?"
echo -e "\nContinue? (y/n)"
read -r REPLY
if [[ ! $REPLY =~ ^[Yy]$ ]]
then
exit 1
fi

### Build Microsoft Windows 11 Professional for VMware vSphere. ###
echo "Building a Microsoft Microsoft Windows 11 Professional Template for VMware vSphere..."

### Initialize HashiCorp Packer and required plugins. ###
echo "Initializing HashiCorp Packer and required plugins..."
packer init "$INPUT_PATH"

### Start the HashiCorp Packer Build ###
echo "Starting the HashiCorp Packer build..."
packer build -force \
-var-file="$CONFIG_PATH/vsphere.pkrvars.hcl" \
-var-file="$CONFIG_PATH/build.pkrvars.hcl" \
-var-file="$CONFIG_PATH/common.pkrvars.hcl" \
"$INPUT_PATH"

### All done. ###
echo "Done."
}

menu_option_21() {
INPUT_PATH="$SCRIPT_PATH"/builds/windows/windows-10/
echo -e "\nCONFIRM: Build Microsoft Windows 10 Professional Template for VMware vSphere?"
echo -e "\nContinue? (y/n)"
Expand Down Expand Up @@ -687,7 +716,8 @@ until [ "$selection" = "0" ]; do
echo " 17 - Windows Server 2016 - All"
echo " 18 - Windows Server 2016 - Standard Only"
echo " 19 - Windows Server 2016 - Datacenter Only"
echo " 20 - Windows 10 Professional"
echo " 20 - Windows 11 Professional"
echo " 21 - Windows 10 Professional"
echo ""
echo " Other:"
echo ""
Expand Down Expand Up @@ -717,6 +747,7 @@ until [ "$selection" = "0" ]; do
18 ) clear ; menu_option_18 ; press_enter ;;
19 ) clear ; menu_option_19 ; press_enter ;;
20 ) clear ; menu_option_20 ; press_enter ;;
21 ) clear ; menu_option_21 ; press_enter ;;
I ) clear ; info ; press_enter ;;
Q ) clear ; exit ;;
* ) clear ; incorrect_selection ; press_enter ;;
Expand Down
4 changes: 2 additions & 2 deletions builds/windows/windows-10/data/autounattend.pkrtpl.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,12 @@
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -File F:\windows-server-vmtools.ps1</CommandLine>
<CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -File F:\windows-vmtools.ps1</CommandLine>
<Order>3</Order>
<Description>Install VMware Tools</Description>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -File F:\windows-server-init.ps1</CommandLine>
<CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -File F:\windows-init.ps1</CommandLine>
<Order>4</Order>
<Description>Enable Windows Remote Management</Description>
</SynchronousCommand>
Expand Down
2 changes: 1 addition & 1 deletion builds/windows/windows-10/windows.auto.pkrvars.hcl
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ communicator_port = 5985
communicator_timeout = "12h"

// Provisioner Settings
scripts = ["scripts/windows/windows-server-prepare.ps1"]
scripts = ["scripts/windows/windows-prepare.ps1"]
inline = [
"Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))",
"choco feature enable -n allowGlobalConfirmation",
Expand Down
223 changes: 223 additions & 0 deletions builds/windows/windows-11/data/autounattend.pkrtpl.hcl
Original file line number Diff line number Diff line change
@@ -0,0 +1,223 @@
<?xml version="1.0" encoding="UTF-8"?>
<unattend xmlns="urn:schemas-microsoft-com:unattend">
<settings pass="windowsPE">
<component xmlns:wcm="http:https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-International-Core-WinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<SetupUILanguage>
<UILanguage>${vm_inst_os_language}</UILanguage>
</SetupUILanguage>
<InputLocale>${vm_inst_os_keyboard}</InputLocale>
<SystemLocale>${vm_inst_os_language}</SystemLocale>
<UILanguage>${vm_inst_os_language}</UILanguage>
<UILanguageFallback>${vm_inst_os_language}</UILanguageFallback>
<UserLocale>${vm_inst_os_language}</UserLocale>
</component>
<component xmlns:wcm="http:https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-PnpCustomizationsWinPE" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<DriverPaths>
<PathAndCredentials wcm:action="add" wcm:keyValue="1">
<Path>E:\Program Files\VMware\VMware Tools\Drivers\pvscsi\Win8\amd64</Path>
</PathAndCredentials>
</DriverPaths>
</component>
<component xmlns:wcm="http:https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<DiskConfiguration>
<Disk wcm:action="add">
<DiskID>0</DiskID>
<WillWipeDisk>true</WillWipeDisk>
<CreatePartitions>
<!-- Windows RE Tools partition -->
<CreatePartition wcm:action="add">
<Order>1</Order>
<Type>Primary</Type>
<Size>300</Size>
</CreatePartition>
<!-- System partition (ESP) -->
<CreatePartition wcm:action="add">
<Order>2</Order>
<Type>EFI</Type>
<Size>100</Size>
</CreatePartition>
<!-- Microsoft reserved partition (MSR) -->
<CreatePartition wcm:action="add">
<Order>3</Order>
<Type>MSR</Type>
<Size>128</Size>
</CreatePartition>
<!-- Windows partition -->
<CreatePartition wcm:action="add">
<Order>4</Order>
<Type>Primary</Type>
<Extend>true</Extend>
</CreatePartition>
</CreatePartitions>
<ModifyPartitions>
<!-- Windows RE Tools partition -->
<ModifyPartition wcm:action="add">
<Order>1</Order>
<PartitionID>1</PartitionID>
<Label>WINRE</Label>
<Format>NTFS</Format>
<TypeID>DE94BBA4-06D1-4D40-A16A-BFD50179D6AC</TypeID>
</ModifyPartition>
<!-- System partition (ESP) -->
<ModifyPartition wcm:action="add">
<Order>2</Order>
<PartitionID>2</PartitionID>
<Label>System</Label>
<Format>FAT32</Format>
</ModifyPartition>
<!-- MSR partition does not need to be modified -->
<ModifyPartition wcm:action="add">
<Order>3</Order>
<PartitionID>3</PartitionID>
</ModifyPartition>
<!-- Windows partition -->
<ModifyPartition wcm:action="add">
<Order>4</Order>
<PartitionID>4</PartitionID>
<Label>OS</Label>
<Letter>C</Letter>
<Format>NTFS</Format>
</ModifyPartition>
</ModifyPartitions>
</Disk>
</DiskConfiguration>
<ImageInstall>
<OSImage>
<InstallFrom>
<MetaData wcm:action="add">
<Key>/IMAGE/NAME</Key>
<Value>${os_image}</Value>
</MetaData>
</InstallFrom>
<InstallTo>
<DiskID>0</DiskID>
<PartitionID>4</PartitionID>
</InstallTo>
</OSImage>
</ImageInstall>
<RunSynchronous>
<RunSynchronousCommand>
<Order>1</Order>
<!-- Set power scheme to high performance in WinPE for faster imaging. -->
<Path>cmd /c powercfg.exe /s 8c5e7fda-e8bf-4a96-9a85-a6e23a8c635c</Path>
</RunSynchronousCommand>
<RunSynchronousCommand>
<Order>2</Order>
<!-- Bypass TPM 2.0 precheck. -->
<Path>cmd /c reg add &quot;HKLM\SYSTEM\Setup\LabConfig&quot; /f /v BypassTPMCheck /t REG_DWORD /d 1</Path>
</RunSynchronousCommand>
</RunSynchronous>



<UserData>
<AcceptEula>true</AcceptEula>
<FullName>${build_username}</FullName>
<Organization>${build_username}</Organization>
<ProductKey>
<Key>${kms_key}</Key>
<WillShowUI>OnError</WillShowUI>
</ProductKey>
</UserData>
<EnableFirewall>false</EnableFirewall>
</component>
</settings>
<settings pass="offlineServicing">
<component xmlns:wcm="http:https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-LUA-Settings" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<EnableLUA>false</EnableLUA>
</component>
</settings>
<settings pass="generalize">
<component xmlns:wcm="http:https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Security-SPP" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<SkipRearm>1</SkipRearm>
</component>
</settings>
<settings pass="specialize">
<component xmlns:wcm="http:https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<OEMInformation>
<HelpCustomized>false</HelpCustomized>
</OEMInformation>
<TimeZone>${vm_guest_os_timezone}</TimeZone>
<RegisteredOwner />
</component>
<component xmlns:wcm="http:https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-ServerManager-SvrMgrNc" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<DoNotOpenServerManagerAtLogon>true</DoNotOpenServerManagerAtLogon>
</component>
<component xmlns:wcm="http:https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-OutOfBoxExperience" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<DoNotOpenInitialConfigurationTasksAtLogon>true</DoNotOpenInitialConfigurationTasksAtLogon>
</component>
<component xmlns:wcm="http:https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Security-SPP-UX" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<SkipAutoActivation>true</SkipAutoActivation>
</component>
</settings>
<settings pass="oobeSystem">
<component name="Microsoft-Windows-International-Core" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS" xmlns:wcm="http:https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance">
<InputLocale>${vm_guest_os_keyboard}</InputLocale>
<SystemLocale>${vm_guest_os_language}</SystemLocale>
<UILanguage>${vm_guest_os_language}</UILanguage>
<UILanguageFallback>${vm_guest_os_language}</UILanguageFallback>
<UserLocale>${vm_guest_os_language}</UserLocale>
</component>
<component xmlns:wcm="http:https://schemas.microsoft.com/WMIConfig/2002/State" xmlns:xsi="http:https://www.w3.org/2001/XMLSchema-instance" name="Microsoft-Windows-Shell-Setup" processorArchitecture="amd64" publicKeyToken="31bf3856ad364e35" language="neutral" versionScope="nonSxS">
<AutoLogon>
<Password>
<Value>${build_password}</Value>
<PlainText>true</PlainText>
</Password>
<Enabled>true</Enabled>
<Username>${build_username}</Username>
</AutoLogon>
<OOBE>
<HideEULAPage>true</HideEULAPage>
<HideLocalAccountScreen>true</HideLocalAccountScreen>
<HideOEMRegistrationScreen>true</HideOEMRegistrationScreen>
<HideOnlineAccountScreens>true</HideOnlineAccountScreens>
<HideWirelessSetupInOOBE>true</HideWirelessSetupInOOBE>
<NetworkLocation>Work</NetworkLocation>
<ProtectYourPC>2</ProtectYourPC>
</OOBE>
<UserAccounts>
<AdministratorPassword>
<Value>${build_password}</Value>
<PlainText>true</PlainText>
</AdministratorPassword>
<LocalAccounts>
<LocalAccount wcm:action="add">
<Password>
<Value>${build_password}</Value>
<PlainText>true</PlainText>
</Password>
<Group>administrators</Group>
<DisplayName>${build_username}</DisplayName>
<Name>${build_username}</Name>
<Description>Build Account</Description>
</LocalAccount>
</LocalAccounts>
</UserAccounts>
<FirstLogonCommands>
<SynchronousCommand wcm:action="add">
<CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"</CommandLine>
<Description>Set Execution Policy 64-Bit</Description>
<Order>1</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -Command "Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Force"</CommandLine>
<Description>Set Execution Policy 32-Bit</Description>
<Order>2</Order>
<RequiresUserInput>true</RequiresUserInput>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -File F:\windows-vmtools.ps1</CommandLine>
<Order>3</Order>
<Description>Install VMware Tools</Description>
</SynchronousCommand>
<SynchronousCommand wcm:action="add">
<CommandLine>%SystemRoot%\system32\WindowsPowerShell\v1.0\powershell.exe -File F:\windows-init.ps1</CommandLine>
<Order>4</Order>
<Description>Enable Windows Remote Management</Description>
</SynchronousCommand>
</FirstLogonCommands>
</component>
</settings>
</unattend>
Loading

0 comments on commit 31fba9c

Please sign in to comment.