Private/OSD-ExtraFiles.ps1
function OSD-ExtraFiles { [CmdletBinding()] PARAM () Write-Host '========================================================================================' -ForegroundColor DarkGray Write-Host "Install.wim: Task Extra Files" -ForegroundColor Green if ($ExtraFiles) { foreach ($ExtraFile in $ExtraFiles) { Write-Host "$OSDBuilderContent\$ExtraFile" -ForegroundColor DarkGray robocopy "$OSDBuilderContent\$ExtraFile" "$MountDirectory" *.* /e /ndl /xx /b /np /ts /tee /r:0 /w:0 /Log+:"$Info\logs\$((Get-Date).ToString('yyyy-MM-dd-HHmmss'))-Task-ExtraFiles.log" | Out-Null } } else { Write-Host "No Task Extra Files were processed" -ForegroundColor DarkGray } Write-Host '========================================================================================' -ForegroundColor DarkGray Write-Host "Install.wim: Template Extra Files" -ForegroundColor Green $AOSBExtraFiles = @() $AOSBExtraFiles = Get-ChildItem ("$OSDBuilderTemplates\ExtraFiles\AutoApply\Global\*","$OSDBuilderTemplates\ExtraFiles\AutoApply\Global $OSArchitecture\*") | Where-Object {$_.PSIsContainer -eq $true} | Select-Object -Property FullName if ($ReleaseId -eq 7601) { [array]$AOSBExtraFiles += Get-ChildItem ("$OSDBuilderTemplates\ExtraFiles\AutoApply\Windows 7\*","$OSDBuilderTemplates\ExtraFiles\AutoApply\Windows 7 $OSArchitecture\*") | Where-Object {$_.PSIsContainer -eq $true} | Select-Object -Property FullName } else { if ($OSInstallationType -eq 'Client') { [array]$AOSBExtraFiles += Get-ChildItem ("$OSDBuilderTemplates\ExtraFiles\AutoApply\Windows 10\*","$OSDBuilderTemplates\ExtraFiles\AutoApply\Windows 10 $OSArchitecture\*") | Where-Object {$_.PSIsContainer -eq $true} | Select-Object -Property FullName #[array]$AOSBExtraFiles += Get-ChildItem ("$OSDBuilderTemplates\ExtraFiles\AutoApply\Windows 10\*","$OSDBuilderTemplates\ExtraFiles\AutoApply\Windows 10 $OSArchitecture\*","$OSDBuilderTemplates\ExtraFiles\AutoApply\Windows 10 $OSArchitecture $ReleaseId\*") | Where-Object {$_.PSIsContainer -eq $true} | Select-Object -Property FullName } else { [array]$AOSBExtraFiles += Get-ChildItem "$OSDBuilderTemplates\ExtraFiles\AutoApply\Windows Server\*" | Where-Object {$_.PSIsContainer -eq $true} | Select-Object -Property FullName #[array]$AOSBExtraFiles += Get-ChildItem ("$OSDBuilderTemplates\ExtraFiles\AutoApply\Windows Server\*","$OSDBuilderTemplates\ExtraFiles\AutoApply\Windows Server $ReleaseId\*") | Where-Object {$_.PSIsContainer -eq $true} | Select-Object -Property FullName } } if ($SkipTemplates) {$AOSBExtraFiles = @()} if ($AOSBExtraFiles) { foreach ($ExtraFile in $AOSBExtraFiles) { Write-Host "$($ExtraFile.FullName)" -ForegroundColor DarkGray robocopy "$($ExtraFile.FullName)" "$MountDirectory" *.* /e /ndl /xx /b /np /ts /tee /r:0 /w:0 /Log+:"$Info\logs\$((Get-Date).ToString('yyyy-MM-dd-HHmmss'))-Template-ExtraFiles.log" | Out-Null } } else { Write-Host "No Template Extra Files were processed" -ForegroundColor DarkGray } } |