Comments (6)
@MichaelGrafnetter, can you send me the DSC configuration so that I can easily reproduce it?
from automatedlab.
@raandree Sure! I just hope that this will work for you, as I copied it from a much larger DSC config:
$script:labSources = 'C:\LabSources'
$script:vmPath = 'C:\LabVMs'
$script:labContent = 'C:\ADLab'
$script:labAdmin = 'Admin'
$script:adminPassword = 'Pa$$w0rd'
Configuration ADLab
{
Import-DscResource -ModuleName PSDesiredStateConfiguration
Node 'localhost'
{
LocalConfigurationManager
{
ConfigurationModeFrequencyMins = 60
RebootNodeIfNeeded = $true
ConfigurationMode = 'ApplyAndAutoCorrect'
ActionAfterReboot = 'ContinueConfiguration'
}
WindowsFeature HyperV
{
Name = 'Hyper-V'
IncludeAllSubFeature = $true
Ensure = 'Present'
}
Script LabDefinition
{
DependsOn = '[WindowsFeature]HyperV'
TestScript = {
$version = Get-Content -Path $using:labContent\ConfiguredVersion.txt -ErrorAction SilentlyContinue
return (Get-Lab -List) -contains 'ADLab' -and $version -eq 13
}
SetScript = {
$global:labSources = $using:labSources
New-LabDefinition -Name ADLab -DefaultVirtualizationEngine HyperV -VmPath $using:vmPath
Add-LabVirtualNetworkDefinition -Name ADLab -AddressSpace 10.213.0.0/24
$defaultDomain = 'contoso.com'
Add-LabDomainDefinition -Name $defaultDomain -AdminUser $using:labAdmin -AdminPassword $using:adminPassword
Add-LabDomainDefinition -Name 'adatum.com' -AdminUser $using:labAdmin -AdminPassword $using:adminPassword
Set-LabInstallationCredential -Username $using:labAdmin -Password $using:adminPassword
$PSDefaultParameterValues = @{
'Add-LabMachineDefinition:OperatingSystem' = 'Windows Server 2022 Standard (Desktop Experience)'
'Add-LabMachineDefinition:DomainName' = $defaultDomain
'Add-LabMachineDefinition:Network' = 'ADLab'
'Add-LabMachineDefinition:MinMemory' = 1GB
'Add-LabMachineDefinition:MaxMemory' = 4GB
'Add-LabMachineDefinition:Memory' = 2GB
'Add-LabMachineDefinition:Gateway' = '10.213.0.1'
}
Add-LabMachineDefinition -Name CONTOSO-DC -Roles RootDC -Memory 3GB
Add-LabMachineDefinition -Name CONTOSO-ADFS
Add-LabMachineDefinition -Name CONTOSO-SRV -Roles FileServer
Add-LabMachineDefinition -Name CONTOSO-PC1 -OperatingSystem 'Windows 11 Enterprise' -Memory 3GB
Add-LabMachineDefinition -Name CONTOSO-PC2 -OperatingSystem 'Windows 11 Enterprise'
Add-LabMachineDefinition -Name ADATUM-DC -Roles RootDC -DomainName 'adatum.com'
Add-LabMachineDefinition -Name CONTOSO-DC2 -Roles DC
Export-LabDefinition -Force -ExportDefaultUnattendedXml
Set-Content -Path $using:labContent\ConfiguredVersion.txt -Value 13 -Force
}
GetScript = { return $null }
}
Script InstallLab
{
DependsOn = '[Script]LabDefinition'
TestScript = {
$global:labSources = $using:labSources
Import-Lab -Name ADLab -NoValidation -NoDisplay
$lab = Get-Lab -Verbose:$false
$configuredVersion = Get-Content -Path $using:labContent\ConfiguredVersion.txt -ErrorAction SilentlyContinue
$installedVersion = Get-Content -Path $using:labContent\InstalledVersion.txt -ErrorAction SilentlyContinue
Import-Module -Name Hyper-V -Verbose:$false
$vms = Get-VM -Name ADATUM-*,CONTOSO-*
return @($vms).Count -ge $lab.Machines.Count -and $null -ne $installedVersion -and $configuredVersion -eq $installedVersion
}
SetScript = {
$global:labSources = $using:labSources
Import-Lab -Name ADLab -NoValidation -NoDisplay
Install-Lab
Copy-Item -Path $using:labContent\ConfiguredVersion.txt -Destination $using:labContent\InstalledVersion.txt -Force
}
GetScript = { return $null }
}
}
}
ADLab -OutputPath $labContent -ConfigurationData @{ AllNodes = @( @{ NodeName = 'localhost'; PsDscAllowPlainTextPassword = $true } ) } | Out-Null
Set-DscLocalConfigurationManager -Path $labContent -Force
Start-DscConfiguration -Path $labContent -Wait -Force -Verbose
from automatedlab.
Related Issues (20)
- [New Feature]: Map Host Folders to VM HOT 2
- [Bug]: Timeout when 'Starting remaining machines' HOT 5
- [Bug]: Hyper-V VM created with -VmGeneration 1 fails to boot HOT 8
- [Bug]: Hyper-V VM having network adapter created with -UseDhcp gets static IP assigned HOT 4
- [New Feature]: Do not delete Virtual Switch during Remove-Lab HOT 1
- Get-Lab command only reports one response HOT 6
- [New Feature]: Support for Oracle Linux HOT 3
- [Bug]: CM-2103.ps1 not working, loose "lab context" in Customroles script, (Get-LabVM return NULL)
- [New Feature]: HOT 1
- [Bug]: Download of SysInternals suite sometimes fails HOT 1
- Documentation: List not formatted in markdown HOT 1
- [Bug]: Virtual network could not be created automatically HOT 1
- [Bug]: Custom role not installed, lab sources file share not accessible HOT 4
- [Bug]: Timeout Error Waiting for Active Directory to Start on Domain Controller HOT 1
- [Bug]: Secondary DC installation is not reentrant HOT 3
- [New Feature]: System Drive Cleanup HOT 2
- [Bug]: VMConnect config file creation fails under SYSTEM HOT 1
- [Bug]: Cannot Install Windows 11 Enterprise with AutomatedLab HOT 10
- [New Feature]: Disable VM Time Synchronization HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from automatedlab.