Skip to content

Commit 62b89a7

Browse files
mjr4077ausintaxasn
authored andcommitted
Add -LiteralPath to Copy-ADTFileToUserProfiles as well.
1 parent 4e09217 commit 62b89a7

2 files changed

Lines changed: 11 additions & 5 deletions

File tree

src/PSAppDeployToolkit/Public/Copy-ADTFile.ps1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ function Copy-ADTFile
9494

9595
[Parameter(Mandatory = $true, Position = 0, ParameterSetName = 'LiteralPath')]
9696
[ValidateNotNullOrEmpty()]
97-
[SupportsWildcards()]
9897
[System.String[]]$LiteralPath,
9998

10099
[Parameter(Mandatory = $true, Position = 1)]

src/PSAppDeployToolkit/Public/Copy-ADTFileToUserProfiles.ps1

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)