@@ -16,6 +16,9 @@ function Copy-ADTFileToUserProfiles
1616 . PARAMETER Path
1717 The path of the file or folder to copy.
1818
19+ . PARAMETER LiteralPath
20+ The literal path of the file or folder to copy.
21+
1922 . PARAMETER Destination
2023 The path of the destination folder to append to the root of the user profile.
2124
@@ -58,7 +61,7 @@ function Copy-ADTFileToUserProfiles
5861 . INPUTS
5962 System.String[]
6063
61- You can pipe in string values for $Path .
64+ You can pipe in string values for $LiteralPath .
6265
6366 . OUTPUTS
6467 None
@@ -101,11 +104,15 @@ function Copy-ADTFileToUserProfiles
101104
102105 [CmdletBinding (SupportsShouldProcess = $true , DefaultParameterSetName = ' CalculatedProfiles' )]
103106 param (
104- [Parameter (Mandatory = $true , Position = 1 , ValueFromPipeline = $true )]
107+ [Parameter (Mandatory = $true , Position = 1 , ParameterSetName = ' Path ' )]
105108 [ValidateNotNullOrEmpty ()]
106109 [SupportsWildcards ()]
107110 [System.String []]$Path ,
108111
112+ [Parameter (Mandatory = $true , Position = 1 , ParameterSetName = ' LiteralPath' , ValueFromPipeline = $true )]
113+ [ValidateNotNullOrEmpty ()]
114+ [System.String []]$LiteralPath ,
115+
109116 [Parameter (Mandatory = $false , Position = 2 )]
110117 [ValidateNotNullOrEmpty ()]
111118 [System.String ]$Destination = [System.Management.Automation.Language.NullString ]::Value,
@@ -205,7 +212,7 @@ function Copy-ADTFileToUserProfiles
205212 process
206213 {
207214 # Add all source paths to the collection.
208- $sourcePaths.AddRange ($Path )
215+ $sourcePaths.AddRange (( Get-Variable - Name $PSCmdlet .ParameterSetName - ValueOnly) )
209216 }
210217
211218 end
@@ -219,7 +226,7 @@ function Copy-ADTFileToUserProfiles
219226 continue
220227 }
221228 $dest = (Join-Path - Path $UserProfile ." $BasePath `Path" - ChildPath $Destination ).Trim()
222- Write-ADTLogEntry - Message " Copying path [$Path ] to $ ( $dest ) :"
229+ Write-ADTLogEntry - Message " Copying path [$sourcePaths ] to $ ( $dest ) :"
223230 if ($PSCmdlet.ShouldProcess ($dest , " Copy files from [$sourcePaths ] to user profile [$ ( $UserProfile.NTAccount ) ]" ))
224231 {
225232 Copy-ADTFile - Path $sourcePaths - Destination $dest @CopyFileSplat
0 commit comments