Skip to main content

Copy-ADTFileToUserProfiles

SYNOPSIS

Copy one or more items to each user profile on the system.

SYNTAX

CalculatedProfiles (Default)

Copy-ADTFileToUserProfiles [[-Destination] <String>] [-BasePath <String>] [-Recurse] [-Flatten] [-NoClobber]
[-FileCopyMode <String>] [-RobocopyParams <String>] [-RobocopyAdditionalParams <String>]
[-ExcludeNTAccount <String[]>] [-IncludeSystemProfiles] [-IncludeServiceProfiles] [-ExcludeDefaultUser]
[-ContinueFileCopyOnError] [-WhatIf] [-Confirm] [<CommonParameters>]

Path

Copy-ADTFileToUserProfiles [-Path] <String[]> [[-Destination] <String>] [-BasePath <String>] [-Recurse]
[-Flatten] [-NoClobber] [-FileCopyMode <String>] [-RobocopyParams <String>]
[-RobocopyAdditionalParams <String>] [-ContinueFileCopyOnError] [-WhatIf] [-Confirm] [<CommonParameters>]

LiteralPath

Copy-ADTFileToUserProfiles [-LiteralPath] <String[]> [[-Destination] <String>] [-BasePath <String>] [-Recurse]
[-Flatten] [-NoClobber] [-FileCopyMode <String>] [-RobocopyParams <String>]
[-RobocopyAdditionalParams <String>] [-ContinueFileCopyOnError] [-WhatIf] [-Confirm] [<CommonParameters>]

SpecifiedProfiles

Copy-ADTFileToUserProfiles [[-Destination] <String>] [-BasePath <String>] [-Recurse] [-Flatten] [-NoClobber]
[-FileCopyMode <String>] [-RobocopyParams <String>] [-RobocopyAdditionalParams <String>]
-UserProfiles <UserProfileInfo[]> [-ContinueFileCopyOnError] [-WhatIf] [-Confirm] [<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&lt;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&lt;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&lt;UserName> for each user.

PARAMETERS

-Path

The path of the file or folder to copy.

Type: String[]
Parameter Sets: Path
Aliases:

Required: True
Position: 2
Default value: None
Accept pipeline input: False
Accept wildcard characters: True

-LiteralPath

The literal path of the file or folder to copy.

Type: String[]
Parameter Sets: LiteralPath
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

-NoClobber

Prevents overwriting existing files at the destination. When specified, files that already exist at the destination path are skipped.

Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-FileCopyMode

Specifies whether to use the native Copy-Item cmdlet or Robocopy.exe when copying files. The default value for this parameter can be configured in the config.psd1 file. Note: Robocopy supports the use of asterisk wildcards (*) 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

-UserProfiles

Specifies one or more UserProfileInfo objects to copy files into.

Type: UserProfileInfo[]
Parameter Sets: SpecifiedProfiles
Aliases:

Required: True
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: CalculatedProfiles
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: CalculatedProfiles
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: CalculatedProfiles
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: CalculatedProfiles
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

-WhatIf

Shows what would happen if the cmdlet runs. The cmdlet is not run.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: wi

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Confirm

Prompts you for confirmation before running the cmdlet.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: cf

Required: False
Position: Named
Default value: None
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 the -LiteralPath parameter.

OUTPUTS

None

This function does not generate any output.

NOTES

An active ADT session is NOT required to use this function.

This function supports the -WhatIf and -Confirm parameters for testing changes before applying them.

Tags: psadt
Website: https://psappdeploytoolkit.com
Copyright: (C) 2026 PSAppDeployToolkit Team (Sean Lillis, Dan Cunningham, Muhammad Mashwani, Mitch Richters, Dan Gough).
License: https://opensource.org/license/lgpl-3-0

https://psappdeploytoolkit.com/docs/reference/functions/Copy-ADTFileToUserProfiles

https://github.com/PSAppDeployToolkit/PSAppDeployToolkit/blob/main/src/PSAppDeployToolkit/Public/Copy-ADTFileToUserProfiles.ps1