Das Cmdlet "Copy-Item" funktioniert nicht wie erwartet, ich verstehe nicht warum. Das ist mein 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
Und das ist der Fehler, den ich bekomme:
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
Ich habe es auch versucht:
Start-BitsTransfer -Source $source -Destination $Destination -Credential $credentials
Und Robocopy unterstützt keine Anmeldeinformationen ...
Ich verwende Powershell V4.0 unter Windows 7 und mein Server läuft unter Windows Server 2012 R2 mit Powershell V4.0.
Ich möchte einen lokalen Ordner (mit allen Unterordnern) in einen Remote-Pfad \ ipadress \ c $ \ Ordner kopieren
Wie kann ich das beheben?
Vielen Dank