我的 Copy-Item PowerShell 命令生成一个我找不到任何参考的错误。
使用 PowerShell 4.x,我试图将文件从本地驱动器复制到远程服务器(相同的网络/域)。远程路径存在且为空。
此脚本中的以下Copy-Item
命令会在(据我所知)复制的每个文件上生成以下错误:
$SessionTarget = New-PSSession -ComputerName "MYSERVER1"
Copy-Item -Path "C:\Websites\XXX\*" -Destination "C:\Websites\XXX\" -ToSession $SessionTarget -Recurse
错误:
Copy-Item : Exception setting "Attributes": "Cannot convert value "1179648" to type "System.IO.FileAttributes" due to enumeration values that are not valid. Specify one of the following enumeration values and try again. The possible enumeration values are "ReadOnly, Hidden, System, Directory, Archive, Device, Normal, Temporary, SparseFile, ReparsePoint, Compressed, Offline, NotContentIndexed, Encrypted, IntegrityStream, NoScrubData"."
At C:\Websites\XXX_Deployment\Deploy.ps1:6 char:1
+ Copy-Item -Path "C:\Websites\XXX\*" -Destination "C:\Websites\XXX ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (:) [Copy-Item], SetValueInvocationException
+ FullyQualifiedErrorId : ExceptionWhenSetting
好消息是文件似乎被复制了。
关于这个错误的任何想法?
谢谢!