Home Folders
Microsoft Active Directory guide
Provision consistent, user-specific home folders and safely coordinate folder moves without updating Active Directory before the data is in place.
Provision home folders
Use the File System integration to provision and collect home folders. NIM can update the Active Directory homeDirectory value, while the File System integration handles the folder itself.
Move existing home folders
The workflow is deliberately two-stage: export the move plan from NIM, then update Active Directory only after the destination folder exists.
1. Export the move plan
Export a CSV from NIM containing Source and Destination columns.
"Source","Destination"
"\\server1\HomeDirs\user1","\\server2\HomeDirs\user1"
"\\server1\HomeDirs\user2","\\server2\HomeDirs\user2"
"\\server1\HomeDirs\user3","\\server2\HomeDirs\user3"
2. Run the folder migration
Run this PowerShell script from a scheduled task or another controlled automation process. It moves each folder with Robocopy, keeps a dated copy of the input CSV, and clears the file after processing.
# Path to output file from NIM containing the source and destination for home folder moves.
$dataDir = "\\server_name\c$\Tools4ever"
$dataFile = "folder_migrations.csv"
if(Test-Path "$dataDir\$dataFile") {
# Read the list of pending folders to move
$folders = Import-Csv "$dataDir\$dataFile"
# Robocopy each folder row to the destination
foreach ($folder in $folders) {
robocopy $folder.Source $folder.Destination /MOVE /E /SEC /R:5 /W:5 /NDL /NFL /NP /NJS /LOG+:"$dataDir\log_$(get-date -f yyyy-MM-dd).txt"
}
# Copy and rename the data file to keep a historical copy
Copy-Item "$dataDir\$dataFile" "$dataDir\$(get-date -f yyyy-MM-dd)_$dataFile"
# Truncate the data file after processing is completed
Clear-Content "$dataDir\$dataFile"
}
3. Update the Active Directory path only when ready
Use this scripted column in the NIM filter that supplies the homeDirectory value. It returns the new path only when the folder is present in the File System data; otherwise, it retains the user's current value.
// Generate expected home directory path
let newHomeDir = `\\\\<server>\\<share>\\${Users['sAMAccountName']}`;
// Get the user's current homeDirectory path
let curHomeDir = Users['homeDirectory'] ?? '';
// Return new path if no current path exists
if(!curHomeDir) { return newHomeDir; }
// Return new path if it exists in FS data, otherwise return their current value
return vaultObjectExists("FS","Folders",newHomeDir) ? newHomeDir : curHomeDir;