
Der folgende Code funktioniert nicht wie erwartet. Er kopiert Dateien und Verzeichnisse in alle Benutzerprofile außer dem des Standardbenutzers. Ich verwende Powershell mit Administratorrechten.
$Source = 'C:\Temp\Teste\*'
$Destination = 'C:\users\*\AppData\Local\'
$Default = 'C:\users\Default\AppData\Local\'
Get-ChildItem $Destination | ForEach-Object {Copy-Item -Path $Source -Destination $_ -Force -Recurse}
Get-ChildItem $Default -Force | ForEach-Object {Copy-Item -Path $Source -Destination $_ -Force -Recurse}
Antwort1
Angenommen, Sie müssen alle Dateien und Ordner vom Quellspeicherort in das %localappdata%
Standardprofil kopieren. Hier funktioniert es, wenn ich die letzte Zeile wie folgt ändere:
Copy-Item -Path $Source -Destination $Default -Force
Zum rekursiven Kopieren (alle Unterordner und Dateien von der Quelle zum Ziel).
Copy-Item -Path $Source -Destination $Default -Force -Recurse