2401.1 update

This commit is contained in:
rbalsleyMSFT
2024-01-26 14:28:38 -08:00
parent ed3fcf1a3d
commit aee1aa1e95
4 changed files with 46 additions and 14 deletions
+1 -1
View File
@@ -1,5 +1,5 @@
<Configuration ID="efa6df21-a106-428e-8eaa-d89a5dda6030"> <Configuration ID="efa6df21-a106-428e-8eaa-d89a5dda6030">
<Add OfficeClientEdition="64" Channel="MonthlyEnterprise"> <Add OfficeClientEdition="64" Channel="Current">
<Product ID="O365ProPlusRetail"> <Product ID="O365ProPlusRetail">
<Language ID="MatchOS" /> <Language ID="MatchOS" />
<ExcludeApp ID="Access" /> <ExcludeApp ID="Access" />
+1 -1
View File
@@ -1,5 +1,5 @@
<Configuration ID="efa6df21-a106-428e-8eaa-d89a5dda6030"> <Configuration ID="efa6df21-a106-428e-8eaa-d89a5dda6030">
<Add SourcePath="C:\FFUDevelopment\Apps\Office" OfficeClientEdition="64" Channel="MonthlyEnterprise"> <Add SourcePath="C:\FFUDevelopment\Apps\Office" OfficeClientEdition="64" Channel="Current">
<Product ID="O365ProPlusRetail"> <Product ID="O365ProPlusRetail">
<Language ID="MatchOS" /> <Language ID="MatchOS" />
<ExcludeApp ID="Access" /> <ExcludeApp ID="Access" />
+39 -7
View File
@@ -131,7 +131,7 @@ param(
[Parameter(Mandatory = $false)] [Parameter(Mandatory = $false)]
[ValidateScript({ [ValidateScript({
if ($_ -and (!(Test-Path -Path '.\Drivers') -or ((Get-ChildItem -Path '.\Drivers' -Recurse | Measure-Object -Property Length -Sum).Sum -lt 1MB))) { if ($_ -and (!(Test-Path -Path '.\Drivers') -or ((Get-ChildItem -Path '.\Drivers' -Recurse | Measure-Object -Property Length -Sum).Sum -lt 1MB))) {
throw "InstallDrivers is set to `$true, but either the Drivers folder is missing or empty" throw 'InstallDrivers is set to $true, but either the Drivers folder is missing or empty'
} }
return $true return $true
})] })]
@@ -201,13 +201,21 @@ param(
[string]$MediaType = 'consumer', [string]$MediaType = 'consumer',
[ValidateSet(512, 4096)] [ValidateSet(512, 4096)]
[uint32]$LogicalSectorSizeBytes = 512, [uint32]$LogicalSectorSizeBytes = 512,
#Will be used in future release [bool]$Optimize = $true,
[Parameter(Mandatory = $false)]
[ValidateScript({
if ($_ -and (!(Test-Path -Path '.\Drivers') -or ((Get-ChildItem -Path '.\Drivers' -Recurse | Measure-Object -Property Length -Sum).Sum -lt 1MB))) {
throw 'CopyDrivers is set to $true, but either the Drivers folder is missing or empty'
}
return $true
})]
[bool]$CopyDrivers, [bool]$CopyDrivers,
#Will be used in future release
[bool]$CopyPPKG, [bool]$CopyPPKG,
[bool]$CopyUnattend, [bool]$CopyUnattend,
[bool]$RemoveFFU [bool]$RemoveFFU
) )
$version = '2312.1' $version = '2401.1'
#Check if Hyper-V feature is installed (requires only checks the module) #Check if Hyper-V feature is installed (requires only checks the module)
$osInfo = Get-WmiObject -Class Win32_OperatingSystem $osInfo = Get-WmiObject -Class Win32_OperatingSystem
@@ -627,6 +635,7 @@ function New-ScratchVhdx {
WriteLog "Creating new Scratch VHDX..." WriteLog "Creating new Scratch VHDX..."
$newVHDX = New-VHD -Path $VhdxPath -SizeBytes $disksize -LogicalSectorSizeBytes $LogicalSectorSizeBytes -Dynamic:($Dynamic.IsPresent) $newVHDX = New-VHD -Path $VhdxPath -SizeBytes $disksize -LogicalSectorSizeBytes $LogicalSectorSizeBytes -Dynamic:($Dynamic.IsPresent)
# $newVHDX = New-VHD -Path $VhdxPath -SizeBytes $disksize -LogicalSectorSizeBytes $LogicalSectorSizeBytes -Fixed
$toReturn = $newVHDX | Mount-VHD -Passthru | Initialize-Disk -PassThru -PartitionStyle GPT $toReturn = $newVHDX | Mount-VHD -Passthru | Initialize-Disk -PassThru -PartitionStyle GPT
#Remove auto-created partition so we can create the correct partition layout #Remove auto-created partition so we can create the correct partition layout
@@ -1035,7 +1044,12 @@ function New-FFU {
Mount-WindowsImage -ImagePath $FFUFile -Index 1 -Path "$FFUDevelopmentPath\Mount" | Out-null Mount-WindowsImage -ImagePath $FFUFile -Index 1 -Path "$FFUDevelopmentPath\Mount" | Out-null
WriteLog 'Mounting complete' WriteLog 'Mounting complete'
WriteLog 'Adding drivers - This will take a few minutes, please be patient' WriteLog 'Adding drivers - This will take a few minutes, please be patient'
Add-WindowsDriver -Path "$FFUDevelopmentPath\Mount" -Driver "$FFUDevelopmentPath\Drivers" -Recurse | Out-null try {
Add-WindowsDriver -Path "$FFUDevelopmentPath\Mount" -Driver "$FFUDevelopmentPath\Drivers" -Recurse -ErrorAction SilentlyContinue | Out-null
}
catch {
WriteLog 'Some drivers failed to be added to the FFU. This can be expected. Continuing.'
}
WriteLog 'Adding drivers complete' WriteLog 'Adding drivers complete'
WriteLog "Dismount $FFUDevelopmentPath\Mount" WriteLog "Dismount $FFUDevelopmentPath\Mount"
Dismount-WindowsImage -Path "$FFUDevelopmentPath\Mount" -Save | Out-Null Dismount-WindowsImage -Path "$FFUDevelopmentPath\Mount" -Save | Out-Null
@@ -1045,10 +1059,13 @@ function New-FFU {
WriteLog 'Folder removed' WriteLog 'Folder removed'
} }
#Optimize FFU #Optimize FFU
if($Optimize -eq $true){
WriteLog 'Optimizing FFU - This will take a few minutes, please be patient' WriteLog 'Optimizing FFU - This will take a few minutes, please be patient'
#Invoke-Process cmd "/c ""$DandIEnv"" && dism /optimize-ffu /imagefile:$FFUFile" #Invoke-Process cmd "/c ""$DandIEnv"" && dism /optimize-ffu /imagefile:$FFUFile"
Invoke-Process cmd "/c dism /optimize-ffu /imagefile:$FFUFile" Invoke-Process cmd "/c dism /optimize-ffu /imagefile:$FFUFile"
WriteLog 'Optimizing FFU complete' WriteLog 'Optimizing FFU complete'
}
} }
function Remove-FFUVM { function Remove-FFUVM {
@@ -1218,6 +1235,8 @@ Function New-DeploymentUSB {
} }
else { else {
WriteLog "No FFU files found in the current directory." WriteLog "No FFU files found in the current directory."
Write-Error "No FFU files found in the current directory."
Return
} }
} }
@@ -1262,6 +1281,10 @@ Function New-DeploymentUSB {
WriteLog ("Copying " + $SelectedFFUFile + " to $DeployPartitionDriveLetter. This could take a few minutes.") WriteLog ("Copying " + $SelectedFFUFile + " to $DeployPartitionDriveLetter. This could take a few minutes.")
robocopy $(Split-Path $SelectedFFUFile -Parent) $DeployPartitionDriveLetter $(Split-Path $SelectedFFUFile -Leaf) /COPYALL /R:5 /W:5 /J robocopy $(Split-Path $SelectedFFUFile -Parent) $DeployPartitionDriveLetter $(Split-Path $SelectedFFUFile -Leaf) /COPYALL /R:5 /W:5 /J
} }
if ($CopyDrivers -eq $true) {
WriteLog "Copying drivers to $DeployPartitionDriveLetter\Drivers"
robocopy "$FFUDevelopmentPath\Drivers" "$DeployPartitionDriveLetter\Drivers" /E /R:5 /W:5 /J
}
} }
else { else {
WriteLog "No FFU file selected. Skipping copy." WriteLog "No FFU file selected. Skipping copy."
@@ -1290,8 +1313,10 @@ function Get-FFUEnvironment {
# Loop through each VM # Loop through each VM
foreach ($vm in $vms) { foreach ($vm in $vms) {
# Check if the VM name starts with '_FFU-' and the state is 'Off' if ($vm.Name.StartsWith("_FFU-")) {
if ($vm.Name.StartsWith("_FFU-") -and $vm.State -eq 'Off') { if ($vm.State -eq 'Running') {
Stop-VM -Name $vm.Name -TurnOff -Force
}
# If conditions are met, delete the VM # If conditions are met, delete the VM
Remove-FFUVM -VMName $vm.Name Remove-FFUVM -VMName $vm.Name
} }
@@ -1400,6 +1425,12 @@ if (($InstallApps -and ($VMHostIPAddress -eq ''))) {
if (-not ($ISOPath) -and ($OptionalFeatures -like '*netfx3*')) { if (-not ($ISOPath) -and ($OptionalFeatures -like '*netfx3*')) {
throw "netfx3 specified as an optional feature, however Windows ISO isn't defined. Unable to get netfx3 source files from downloaded ESD media. Please specify a Windows ISO in the ISOPath parameter." throw "netfx3 specified as an optional feature, however Windows ISO isn't defined. Unable to get netfx3 source files from downloaded ESD media. Please specify a Windows ISO in the ISOPath parameter."
} }
if (($LogicalSectorSizeBytes -eq 4096) -and ($installdrivers -eq $true)){
$installdrivers = $false
WriteLog 'LogicalSectorSizeBytes is set to 4096, which is not supported for driver injection. Setting $installdrivers to $false'
WriteLog 'As a workaround, set -copydrivers $true to copy drivers to the deploy partition drivers folder'
WriteLog 'We are investigating this issue and will update the script if/when we have a fix'
}
#Get script variable values #Get script variable values
LogVariableValues LogVariableValues
@@ -1473,7 +1504,8 @@ try {
$index = Get-Index -WindowsImagePath $wimPath -WindowsSKU $WindowsSKU $index = Get-Index -WindowsImagePath $wimPath -WindowsSKU $WindowsSKU
} }
$vhdxDisk = New-ScratchVhdx -VhdxPath $VHDXPath -SizeBytes $disksize -Dynamic -LogicalSectorSizeBytes $LogicalSectorSizeBytes # $vhdxDisk = New-ScratchVhdx -VhdxPath $VHDXPath -SizeBytes $disksize -Dynamic:$false -LogicalSectorSizeBytes $LogicalSectorSizeBytes
$vhdxDisk = New-ScratchVhdx -VhdxPath $VHDXPath -SizeBytes $disksize -LogicalSectorSizeBytes $LogicalSectorSizeBytes
$systemPartitionDriveLetter = New-SystemPartition -VhdxDisk $vhdxDisk $systemPartitionDriveLetter = New-SystemPartition -VhdxDisk $vhdxDisk
@@ -117,7 +117,7 @@ $LogFileName = 'ScriptLog.txt'
$USBDrive = Get-USBDrive $USBDrive = Get-USBDrive
New-item -Path $USBDrive -Name $LogFileName -ItemType "file" -Force | Out-Null New-item -Path $USBDrive -Name $LogFileName -ItemType "file" -Force | Out-Null
$LogFile = $USBDrive + $LogFilename $LogFile = $USBDrive + $LogFilename
$version = '2312.1' $version = '2401.1'
WriteLog 'Begin Logging' WriteLog 'Begin Logging'
WriteLog "Script version: $version" WriteLog "Script version: $version"