pour créer un script de lancement de sauvegarde vers un disque distant : créer le script : script_copie_datas.ps1 contenu du script : ---------------------------------------------------------------------------------------------- # Ajoutez ces lignes tout en haut du script $LogFile = "C:\Temp\log_sauvegarde.txt" "----------------------------------------" | Out-File -Append $LogFile "Début de tentative : $(Get-Date)" | Out-File -Append $LogFile "Utilisateur exécutant : $env:USERNAME" | Out-File -Append $LogFile "Machine : $env:COMPUTERNAME" | Out-File -Append $LogFile $DestinationRoot = "\\pnas2.stockage.inra.fr\nab-uefp\DONNEES\9_Sauvegarde" $UserDest = Join-Path $DestinationRoot $env:USERNAME $DesktopPath = [Environment]::GetFolderPath('Desktop') $DocumentsPath = [Environment]::GetFolderPath('MyDocuments') if (!(Test-Path $UserDest)) { New-Item -ItemType Directory -Path $UserDest | Out-Null } if (Test-Path $DesktopPath) { $DestBureau = Join-Path $UserDest "Bureau" robocopy "$DesktopPath" "$DestBureau" /E /R:3 /W:3 /MT:8 /XJD /XJF } if (Test-Path $DocumentsPath) { $DestDocs = Join-Path $UserDest "Documents" robocopy "$DocumentsPath" "$DestDocs" /E /R:3 /W:3 /MT:8 /XJD /XJF } ------------------------------------------------------------------------------------- pour lancer le script au démarrage : créer un fichier .bat ---------------------------------------------- powershell.exe -ExecutionPolicy Bypass -WindowStyle Hidden -File “%ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp\script_copie_datas.ps1” --------------------------------------------------- Appuyez sur les touches Windows + R, tapez shell:common startup copier script_copie_datas.ps1 et le fichier .bat dans le dossier : “%ProgramData%\Microsoft\Windows\Start Menu\Programs\StartUp\ redemarrer