Powershell script not creating VHDX files

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"

Hello and welcome to the forum. Please edit your original post and format your code as “Preformatted text” so that syntax and formatting is preserved.
Guide to Posting Code

Your title says that VHDX files are not being created. It looks like this is being done via a program called frx.exe which isn’t a PowerShell problem.
If you have any error messages to provide that would be helpful. From a quick google search it looks like your syntax for calling frx.exe from PowerShell is correct.

Let’s reformat the code and then go from there.