首页 > 解决方案 > Copy-item command is throwing Access denied error

问题描述

I am using below command from my test01 server from where i want to invoke the copy-item command on the test02 server.. I am facing access is denied issue.

test01 is the servername where my sharefolder is there test02 is the remote machine

$password = ConvertTo-SecureString “pass” -AsPlainText -Force $Cred = New-Object System.Management.Automation.PSCredential (“work”, $password) Invoke-Command -ScriptBlock {Copy-Item '\test01\new' 'c:\test' -Force -Recurse} -ComputerName "test02" -Credential $Cred strong text

标签: azure-devops

解决方案


您的构建代理似乎缺乏执行该操作的管理员权限。Invoke-Command -ComputerName需要管理员权限...)

尝试使用管理员帐户更新当前代理或安装新代理(建议创建新代理池),然后使用管理员帐户启动代理。您可以参考此票以获取更多详细信息。


推荐阅读