Home Folders
A home folder is a designated directory or storage space assigned to an individual user within a networked environment, typically facilitated by Active Directory services. These folders serve as personalized storage locations where users can store and organize their files, documents, and other data. By utilizing Active Directory Home Folders within NIM, administrators can streamline user management, ensuring that each user has a dedicated and secure space for their data, accessible across the network. This centralized approach enhances data security, simplifies user access and permissions, and facilitates efficient data organization within the networked environment.
For provisioning home folders, please make use of the File System integration
NIM doesn't move home folders. If these folders need to move, we can export a CSV from NIM containing a list of the folders to move. Below is a PS snippet that uses Robocopy.exe to move folders based on a CSV that contains a Source column and Destination column.
CSV Example
"Source","Destination" "\\server1\HomeDirs\user1","\\server2\HomeDirs\user1" "\\server1\HomeDirs\user2","\\server2\HomeDirs\user2" "\\server1\HomeDirs\user3","\\server2\HomeDirs\user3"
Robocopy Script
This script would be added to something like Windows Task Scheduler. The script creates date-stamp log files and creates a historical (date-stamp) copy of the CSV before clearing the content of the CSV.
# 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 & rename the data file to keep a historical copy Copy-Item "$dataDir\$dataFile" "$dataDir\$(get-date -f yyyy-MM-dd)_$dataFile" # Truncate the datafile after processing is completed Clear-Content "$dataDir\$dataFile" }
Update Filter Scripted Column Example
This snippet returns either the "new" homeDirectory path if the user doesn't have one or if the new path exists - meaning that the folder has been moved by the external script. Otherwise, it will return the user's current homeDirectory path. This avoids the issue of changing the binding in AD before the folder has been moved to the new location.
// 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;