Copy-item cmdlet is not working as expected, i don't understand why. This is my code :
$Source = "C:\folder1" $Destination = "\\172.22.0.115\c$\folder2\" $Password = ConvertTo-SecureString -AsPlainText -Force -String "MyPassword" $User = "Domain\Administrator" $credentials = New-Object -TypeName System.Management.Automation.PSCredential -ArgumentList $user,$password Copy-Item $Source -Destination $Destination -Credential $credentials
And this is the error I get :
The FileSystem provider supports credentials only on the New-PSDrive cmdlet. Perform the operation again without specifying credentials. At C:\Sans titre2.ps1:7 char:1 + Copy-Item $Source -Destination $Destination -Credential $credentials + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ + CategoryInfo : NotImplemented: (:) , PSNotSupportedException + FullyQualifiedErrorId : NotSupported
I also tried this :
Start-BitsTransfer -Source $source -Destination $Destination -Credential $credentials
And Robocopy doesn't support credentials...
I'm running Powershell V4.0 on Windows 7, and my server is running on Windows server 2012 r2 with powershell V4.0 also.
I want to copy a local folder (with all subfolders) to a remote path \ipadress\c$\folder
How can i resolve it?