admin管理员组文章数量:1399287
I use The following powershell code to copy file from a remote machine on the same network to the actual machine where this powershell is executed. The firewall is disabled. The $UpdateSourceFolder is a shared folder where all users have access. The problem is that copy-item never returns me exception but the file are not copied from one location to another.
Try {
Copy-item "$UpdateSourceFolder\*" "$UpdateDestinationFolder" -Force -Recurse -ErrorAction Stop
Add-Content $LogFilePath "SUCCESSFULLY COPIED FILE"
}
catch {
$errorMessage = $_.Exception.Message
Add-Content $LogFilePath $errorMessage
}
Is there something I can do to force Powershell to give me the exception?
本文标签: Powershell CopyItem fails without exceptionsStack Overflow
版权声明:本文标题:Powershell: Copy-Item fails without exceptions - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744188361a2594400.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论