Add a function for queueing startup commands
This commit is contained in:
parent
38c37c3564
commit
16560270a7
1 changed files with 22 additions and 13 deletions
|
@ -186,6 +186,20 @@ function Start-Setup {
|
||||||
Move-PartitionRange -Disk $Disk -1 -1 ($To + 1)
|
Move-PartitionRange -Disk $Disk -1 -1 ($To + 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function Add-StartupCommand {
|
||||||
|
param(
|
||||||
|
[string] $Script,
|
||||||
|
[string] $Description
|
||||||
|
)
|
||||||
|
|
||||||
|
$installationCommand = $oobeSettings.SelectSingleNode("./ua:FirstLogonCommands/ua:SynchronousCommand[last()]", $namespace);
|
||||||
|
$newCommand = $installationCommand.ParentNode.AppendChild($installationCommand.CloneNode($true));
|
||||||
|
$newCommand.SelectSingleNode("./ua:CommandLine", $namespace).InnerText = $Script;
|
||||||
|
$orderElement = $newCommand.SelectSingleNode("./ua:Order", $namespace);
|
||||||
|
$orderElement.InnerText = ([int]($orderElement.InnerText) + 1);
|
||||||
|
$newCommand.SelectSingleNode("./ua:Description", $namespace).InnerText = $Description;
|
||||||
|
}
|
||||||
|
|
||||||
# Collect necessary variables
|
# Collect necessary variables
|
||||||
$winpePass = Get-PassSettings "windowsPE";
|
$winpePass = Get-PassSettings "windowsPE";
|
||||||
$setupConfig = Get-Component $winpePass "Microsoft-Windows-Setup";
|
$setupConfig = Get-Component $winpePass "Microsoft-Windows-Setup";
|
||||||
|
@ -213,19 +227,14 @@ function Start-Setup {
|
||||||
$oobeSettings.SelectSingleNode($xpath, $namespace).InnerText = $valhallaConfig.setupUser;
|
$oobeSettings.SelectSingleNode($xpath, $namespace).InnerText = $valhallaConfig.setupUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
$installationCommand = $oobeSettings.SelectSingleNode("./ua:FirstLogonCommands/ua:SynchronousCommand[last()]", $namespace);
|
Add-StartupCommand `
|
||||||
$newCommand = $installationCommand.ParentNode.AppendChild($installationCommand.CloneNode($true));
|
-Script (
|
||||||
|
"powershell -Command " +
|
||||||
$newCommand.SelectSingleNode("./ua:CommandLine", $namespace).InnerText = `
|
"`$env:PWSH_PATH = $(Get-PathInjection $env:PWSH_PATH);" +
|
||||||
"powershell -Command " + `
|
"`$env:INSTALLER_SCRIPT = $(Get-ScriptPathInjection $env:SETUP_SCRIPT_NAME);" +
|
||||||
"`$env:PWSH_PATH = $(Get-PathInjection $env:PWSH_PATH);" + `
|
"`$env:CONFIG_MODULE = $(Get-ScriptPathInjection $env:CONFIG_MODULE);" +
|
||||||
"`$env:INSTALLER_SCRIPT = $(Get-ScriptPathInjection $env:SETUP_SCRIPT_NAME);" + `
|
"& (Join-Path `$env:PWSH_PATH pwsh) `$env:INSTALLER_SCRIPT;") `
|
||||||
"`$env:CONFIG_MODULE = $(Get-ScriptPathInjection $env:CONFIG_MODULE);" + `
|
-Description "Install PowerShell Core and git and run setup script";
|
||||||
"& (Join-Path `$env:PWSH_PATH pwsh) `$env:INSTALLER_SCRIPT;";
|
|
||||||
|
|
||||||
$orderElement = $newCommand.SelectSingleNode("./ua:Order", $namespace);
|
|
||||||
$orderElement.InnerText = ([int]($orderElement.InnerText) + 1);
|
|
||||||
$newCommand.SelectSingleNode("./ua:Description", $namespace).InnerText = "Install PowerShell Core and git and run setup script";
|
|
||||||
|
|
||||||
if ($valhallaConfig.dualboot.enable) {
|
if ($valhallaConfig.dualboot.enable) {
|
||||||
$diskSize = [long](ConvertFrom-Csv (wmic diskdrive where "Index=$(Get-InstallDisk)" get Size | ForEach-Object { "$_".Trim(); })).Size;
|
$diskSize = [long](ConvertFrom-Csv (wmic diskdrive where "Index=$(Get-InstallDisk)" get Size | ForEach-Object { "$_".Trim(); })).Size;
|
||||||
|
|
Loading…
Reference in a new issue