Path to the input CSV file
$inputCsvPath = “\corp.velocityrisk.com\Data\IT\temp\User AD Info for PTA\TestGroup.csv”
Path to the FSLogix profiles directory
$fslogixPath = "\savruavdfslogixtest.file.core.windows.net\profiles"
Import the input CSV file
$users = Import-Csv -Path $inputCsvPath
Path to the FRX executable
$frxPath = “C:\Program Files\FSLogix\Apps\frx.exe”
Loop through each user and copy their profile
foreach ($user in $users) {
$samAccountName = $user.SamAccountName
$sid = $user.SID
# Create the FSLogix profile path
$fslogixProfilePath = Join-Path $fslogixPath "${samAccountName}_$sid"
# Ensure the FSLogix profile directory exists
if (-Not (Test-Path $fslogixProfilePath)) {
New-Item -Path $fslogixProfilePath -ItemType Directory
}
# Define the source paths for HomeDrive and Profiles
$homeDrivePath = "\\corp.velocityrisk.com\users\HomeDrive\${samAccountName}"
$profilesPath = "\\corp.velocityrisk.com\users\Profiles\${samAccountName}"
# Combine the HomeDrive and Profiles paths into a single VHDX file using frx.exe
& $frxPath copy-profile -filename "$fslogixProfilePath\Profile_${samAccountName}.vhdx" -sid $sid -source $homeDrivePath,$profilesPath
Write-Output "Profiles for $samAccountName copied to $fslogixProfilePath"