Copy-ADTFileToUserProfiles
SYNOPSIS
Copy one or more items to each user profile on the system.
SYNTAX
Copy-ADTFileToUserProfiles [-Path] <String[]> [[-Destination] <String>] [-BasePath <String>] [-Recurse]
[-Flatten] [-FileCopyMode <String>] [-RobocopyParams <String>] [-RobocopyAdditionalParams <String>]
[-ExcludeNTAccount <String[]>] [-IncludeSystemProfiles] [-IncludeServiceProfiles] [-ExcludeDefaultUser]
[-ContinueFileCopyOnError] [<CommonParameters>]
DESCRIPTION
The Copy-ADTFileToUserProfiles function copies one or more items to each user profile on the system. It supports various options such as recursion, flattening files, and using Robocopy to overcome the 260 character limit.
EXAMPLES
EXAMPLE 1
Copy-ADTFileToUserProfiles -Path "$($adtSession.DirSupportFiles)\config.txt" -Destination "AppData\Roaming\MyApp"
Copy a single file to C:\Users<UserName>\AppData\Roaming\MyApp for each user.
EXAMPLE 2
Copy-ADTFileToUserProfiles -Path "$($adtSession.DirSupportFiles)\config.txt","$($adtSession.DirSupportFiles)\config2.txt" -Destination "AppData\Roaming\MyApp"
Copy two files to C:\Users<UserName>\AppData\Roaming\MyApp for each user.
EXAMPLE 3
Copy-ADTFileToUserProfiles -Path "$($adtSession.DirFiles)\MyDocs" Destination "MyApp" -BasePath "Documents" -Recurse
Copy an entire folder recursively to a new MyApp folder under each user's Documents folder.
EXAMPLE 4
Copy-ADTFileToUserProfiles -Path "$($adtSession.DirFiles)\.appConfigFolder" -Recurse
Copy an entire folder to C:\Users<UserName> for each user.
PARAMETERS
-Path
The path of the file or folder to copy.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: True
Position: 2
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False
-Destination
The path of the destination folder to append to the root of the user profile.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: 3
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-BasePath
The base path to append the destination folder to.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: Profile
Accept pipeline input: False
Accept wildcard characters: False
-Recurse
Copy files in subdirectories.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-Flatten
Flattens the files into the root destination directory.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-FileCopyMode
Select from 'Native' or 'Robocopy'. Default is configured in config.psd1. Note that Robocopy supports * in file names, but not folders, in source paths.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-RobocopyParams
Override the default Robocopy parameters.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-RobocopyAdditionalParams
Append to the default Robocopy parameters.
Type: String
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-ExcludeNTAccount
Specify NT account names in Domain\Username format to exclude from the list of user profiles.
Type: String[]
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False
-IncludeSystemProfiles
Include system profiles: SYSTEM, LOCAL SERVICE, NETWORK SERVICE.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-IncludeServiceProfiles
Include service profiles where NTAccount begins with NT SERVICE.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ExcludeDefaultUser
Exclude the Default User.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
-ContinueFileCopyOnError
Continue copying files if an error is encountered. This will continue the deployment script and will warn about files that failed to be copied.
Type: SwitchParameter
Parameter Sets: (All)
Aliases:
Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
INPUTS
System.String[]
You can pipe in string values for $Path.
OUTPUTS
None
This function does not generate any output.
NOTES
An active ADT session is NOT required to use this function.
Tags: psadt
Website: https://psappdeploytoolkit.com
Copyright: (C) 2025 PSAppDeployToolkit Team (Sean Lillis, Dan Cunningham, Muhammad Mashwani, Mitch Richters, Dan Gough).
License: https://opensource.org/license/lgpl-3-0
RELATED LINKS
https://psappdeploytoolkit.com/docs/reference/functions/Copy-ADTFileToUserProfiles