-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy path1. Template Internet Connected Standalone.ps1
54 lines (43 loc) · 2.67 KB
/
1. Template Internet Connected Standalone.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#--------------------------------------------------------------------------------------------------------------------
# Global parameters - CHANGEME
$LabName = 'StandaloneTemplate'
$AdminUser = 'wsadmin'
$AdminPass = 'complexpassword'
$MachineName = 'WS01'
# Get-LabAvailableOperatingSystem will list all available OSes to you
$OperatingSystem = 'Windows 11 Enterprise Evaluation'
#--------------------------------------------------------------------------------------------------------------------
# CUSTOMROLE INSTALLATION
$ABLCustomRolesFilePath = Join-Path $PSScriptRoot "..\CustomRoles"
# Copy the subdirectories of CustomRoles to the lab sources
Copy-Item -Path $ABLCustomRolesFilePath -Destination $labSources -Force -Recurse
#--------------------------------------------------------------------------------------------------------------------
# LAB CREATION
# Create our lab using HyperV (Azure is also supported)
New-LabDefinition -Name $LabName -DefaultVirtualizationEngine HyperV
# Retrieve the name of the external network switch
. Join-Path -Path $PSScriptRoot -ChildPath '..\Functions\Get-ExternalNetworkSwitch.ps1'
$ExternalNetwork = Get-ExternalNetworkSwitch
Add-LabVirtualNetworkDefinition -Name $ExternalNetwork.Name -HyperVProperties @{ SwitchType = $ExternalNetwork.SwitchType ; AdapterName = $ExternalNetwork.NetAdapterInterfaceDescription }
# Create a local admin account
Set-LabInstallationCredential -Username $AdminUser -Password $AdminPass
#--------------------------------------------------------------------------------------------------------------------
# DEFAULT MACHINE PARAMETERS
$PSDefaultParameterValues = @{
'Add-LabMachineDefinition:Network' = $ExternalNetwork.Name
'Add-LabMachineDefinition:ToolsPath' = "$labSources\Tools"
'Add-LabMachineDefinition:MinMemory' = 1GB
'Add-LabMachineDefinition:Memory' = 4GB
'Add-LabMachineDefinition:MaxMemory' = 8GB
'Add-LabMachineDefinition:OperatingSystem' = $OperatingSystem
}
#--------------------------------------------------------------------------------------------------------------------
# MACHINE CREATION - https://automatedlab.org/en/latest/Wiki/Basic/addmachines/
$PostInstallJobs = @() # Will execute in order
$PostInstallJobs += Get-LabPostInstallationActivity -CustomRole RemoveFirstRunExperience
$PostInstallJobs += Get-LabPostInstallationActivity -CustomRole UpdateWindows
Add-LabMachineDefinition -Name $MachineName -PostInstallationActivity $PostInstallJobs
# Install our lab, has flags for level of output
Install-Lab #-Verbose -Debug
# Provides a pretty table detailing all elements of what has been created
Show-LabDeploymentSummary -Detailed