CopyAutopilotQuickIdealEnvironmentToDrive.ps1

param (     
    #Path to an Mounted ISO
    #This file will be mounted and the contents will be copied to the OSDCloud USB
    [Parameter(Mandatory)]
    [System.String]$DriveLetter,

    [Parameter(Mandatory)]
    [System.String]$PathToAutopilotQuickIdealEnvironment
)
$osdbootStartTime = Get-Date
Write-Host "Copying ideal environment to '$($DriveLetter):\'..." -Foreground Magenta
# Existing preload folders can retain plaintext files from earlier app versions.
# Keep them out of new USB copies; the app now reads Secrets.aqsecrets instead.
$legacyCredentialFiles=@(
    'AzureLogSettings.json','AppInsights.json','GroupMan.json','Takehome.json',
    'TakehomeLoggerInfo.json','TakehomeCreds.json','GithubCreds.json',
    'TakeHomeCreds.xml','TakeHomeKey.txt','BiosPassword.txt','DellBiosSettings.zip',
    'Wifi.ppkg','Invoke-BiosUpdate.ppkg'
)
$legacyCacheFiles=@($legacyCredentialFiles)+@($legacyCredentialFiles | ForEach-Object { $_+'-CacheData.json' })
robocopy "$($PathToAutopilotQuickIdealEnvironment.TrimEnd('\'))" ($DriveLetter+":\AutopilotQuick\") *.* /e /ndl /njh /njs /np /r:0 /w:0 /b /zb /XF $legacyCacheFiles /XD DellBiosSettings TempDism
$osdbootEndTime = Get-Date
$osdbootTimeSpan = New-TimeSpan -Start $osdbootStartTime -End $osdbootEndTime
Write-Host -ForegroundColor Cyan "Completed copying ideal environment to drive in $($osdbootTimeSpan.ToString("mm' minutes 'ss' seconds'"))"