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