Answered by:
Copy-item UNC Path to Server Appdata

Question
-
Hi,
I like to copy from Userhome UNC Path to Citrix User Appdata, i used this script:
$source = "\\intra.frutigen.com\DFS\Home$\$env:USERNAME\work"
$server = "$env:COMPUTERNAME"
$destinationpath = "\\$server\C$\Users\$env:USERNAME\AppData\Roaming\Microsoft\*"
copy-item -path $source -destination $destinationpath -verboseI always get this Error:
copy-item : Illegal characters in path.
At line:1 char:1
+ copy-item -path $source -destination $destinationpath -verbose
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (\\WAGVXAXY\C$\U...ing\Microsoft\*:String) [Copy-Item], ArgumentExcepti
on
+ FullyQualifiedErrorId : CreateDirectoryArgumentError,Microsoft.PowerShell.Commands.CopyItemCommand
PS C:\Windows\system32> copy-item : Illegal characters in path.
Copy-Item : A positional parameter cannot be found that accepts argument 'characters'.
At line:1 char:1
+ copy-item : Illegal characters in path.
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Copy-Item], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.CopyItemCommandThanks for your help,
Adrian
Answers
-
Destination path cannot have a wildcard and does not end in a backslash. It must be the path of a folder or file.
$destinationpath = "\\$server\C$\Users\$env:USERNAME\AppData\Roaming\Microsoft"
\_(ツ)_/
- Marked as answer by adrian reinhard Monday, October 7, 2019 1:23 PM
All replies
-
Destination path cannot have a wildcard and does not end in a backslash. It must be the path of a folder or file.
$destinationpath = "\\$server\C$\Users\$env:USERNAME\AppData\Roaming\Microsoft"
\_(ツ)_/
- Marked as answer by adrian reinhard Monday, October 7, 2019 1:23 PM
-