Skip to content

Instantly share code, notes, and snippets.

@raandree
Created November 20, 2025 22:19
Show Gist options
  • Select an option

  • Save raandree/c6ef32777eaab1591d3ae9e14dc6e1d6 to your computer and use it in GitHub Desktop.

Select an option

Save raandree/c6ef32777eaab1591d3ae9e14dc6e1d6 to your computer and use it in GitHub Desktop.
# First do the standard installaton
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "AutomatedLab Installation Script" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host ""
Write-Host "[Step 1/2] Installing AutomatedLab meta-module..." -ForegroundColor Yellow
Write-Host " This may take a few minutes..." -ForegroundColor Gray
try {
Install-Module -Name AutomatedLab -AllowPrerelease -AllowClobber -Force -Scope AllUsers -ErrorAction Stop
Write-Host " ✓ AutomatedLab meta-module installed successfully" -ForegroundColor Green
}
catch {
Write-Host " ✗ Failed to install AutomatedLab: $($_.Exception.Message)" -ForegroundColor Red
exit 1
}
Write-Host ""
$modules = @(
'AutomatedLab.Common',
'AutomatedLab.Recipe',
'AutomatedLab.Ships',
'AutomatedLabCore',
'AutomatedLabDefinition',
'AutomatedLabNotifications',
'AutomatedLabTest',
'AutomatedLabUnattended',
'AutomatedLabWorker',
'HostsFile',
'PSFileTransfer',
'PSLog'
)
$path = if ($PSVersionTable.PSEdition -eq 'Core')
{
"$env:ProgramFiles\PowerShell\Modules"
}
else
{
"$env:ProgramFiles\WindowsPowerShell\Modules"
}
Write-Host "[Step 2/2] Updating AutomatedLab component modules to latest versions..." -ForegroundColor Yellow
Write-Host " Target Path: $path" -ForegroundColor Gray
Write-Host " Modules to update: $($modules.Count)" -ForegroundColor Gray
Write-Host ""
$successCount = 0
$failureCount = 0
foreach ($module in $modules)
{
Write-Host " Processing: " -NoNewline -ForegroundColor Gray
Write-Host "$module" -NoNewline -ForegroundColor White
Write-Host "..." -ForegroundColor Gray
try {
Save-Module -Name $module -Path $path -Force -AllowPrerelease -ErrorAction Stop
Write-Host " ✓ " -NoNewline -ForegroundColor Green
Write-Host "$module updated successfully" -ForegroundColor Gray
$successCount++
}
catch {
Write-Host " ✗ " -NoNewline -ForegroundColor Red
Write-Host "Failed to update $module : $($_.Exception.Message)" -ForegroundColor Red
$failureCount++
}
}
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Installation Summary" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Total Modules Processed: " -NoNewline -ForegroundColor White
Write-Host "$($modules.Count)" -ForegroundColor Cyan
Write-Host "Successfully Updated: " -NoNewline -ForegroundColor White
Write-Host "$successCount" -ForegroundColor Green
Write-Host "Failed: " -NoNewline -ForegroundColor White
Write-Host "$failureCount" -ForegroundColor $(if ($failureCount -eq 0) { "Green" } else { "Red" })
Write-Host ""
if ($failureCount -eq 0) {
Write-Host "✓ AutomatedLab installation completed successfully!" -ForegroundColor Green
Write-Host ""
Write-Host "Next Steps:" -ForegroundColor Yellow
Write-Host " 1. Run 'New-LabSourcesFolder' to set up lab sources directory" -ForegroundColor Gray
Write-Host " 2. Download required ISOs to the lab sources folder" -ForegroundColor Gray
Write-Host " 3. Execute lab deployment scripts from the DscWorkshop\Lab folder" -ForegroundColor Gray
}
else {
Write-Host "⚠ Installation completed with errors. Please review the output above." -ForegroundColor Yellow
}
Write-Host ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment