Allow dynamic setup of windows
This commit is contained in:
parent
f9d87ae9e4
commit
62c1f4ab43
1 changed files with 27 additions and 0 deletions
27
scripts/Windows/OS/Setup.ps1
Normal file
27
scripts/Windows/OS/Setup.ps1
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
$null = $env:WIN_COMPUTER_NAME;
|
||||||
|
$null = $env:SETUP_SCRIPT_NAME;
|
||||||
|
|
||||||
|
[xml]$unattendedConfig = $(Get-Content "$drive\Autounattend.template.xml");
|
||||||
|
|
||||||
|
function Get-PassSettings {
|
||||||
|
[OutputType([xml])]
|
||||||
|
param(
|
||||||
|
[string] $passName
|
||||||
|
)
|
||||||
|
|
||||||
|
return $unattendedConfig.SelectSingleNode("/unattend/settings[@pass='$passName']");
|
||||||
|
}
|
||||||
|
|
||||||
|
$drives = & wmic volume get "DriveLetter,Label";
|
||||||
|
$drive = $($($drives | Select-String -Pattern "winiso") -split "\s+")[0];
|
||||||
|
|
||||||
|
# Adjust unattended settings
|
||||||
|
$specializeSettings = Get-PassSettings "specialize";
|
||||||
|
$specializeSettings.SelectSingleNode("./component[@name='Microsoft-Windows-Shell-Setup']/ComputerName").InnerText = "$env:WIN_COMPUTER_NAME";
|
||||||
|
|
||||||
|
$oobeSystemSettings = Get-PassSettings "oobeSystem";
|
||||||
|
$oobeSystemSettings.SelectSingleNode("./component/FirstLogonCommands/SynchronousCommand[last()]/CommandLine").InnerText += "`npwsh 'PortValhalla/$env:SETUP_SCRIPT_NAME';";
|
||||||
|
|
||||||
|
Write-Warning "Attention: This program will completely wipe your current disk #1 and install Windows on it. Are you sure you want to do this?"
|
||||||
|
Read-Host -Prompt "Hit enter to continue or CTRL+C to abort"
|
||||||
|
& "$drive\setup.exe";
|
Loading…
Reference in a new issue