none
Copy-item UNC Path to Server Appdata RRS feed

  • 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 -verbose

    I 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.CopyItemCommand

    Thanks for your help,

    Adrian

    Monday, October 7, 2019 12:33 PM

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"


    \_(ツ)_/

    Monday, October 7, 2019 1:10 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"


    \_(ツ)_/

    Monday, October 7, 2019 1:10 PM
  • cool stuff, it works!!

    thanks alot have a good one, adrian

    Monday, October 7, 2019 1:23 PM