jeudi 26 avril 2018

Migration

Si vous devez sauvegarder le profil d'un utilisateur (W7-10), voici un petit script:

mkdir %~dp0%username%\

net use > %~dp0%username%\lecteurs_reseau.txt
%~dp0%Listeimprimante.vbs

move "%~dp0imprimante.txt" "%~dp0%username%\"
move "%~dp0imprimanteDefault.txt" "%~dp0%username%\"

rem echo %~dp0

cls
@echo Office va se fermer . sauvegarder vos document avant d aller plus loin
pause
taskkill /IM outlook.exe
taskkill /IM excel.exe
taskkill /IM word.exe



rem xcopy /S /Q /H /Y "%userprofile%\OneDrive\*" "%~dp0%username%\OneDrive\"
rem xcopy /S /Q /H /Y "%userprofile%\OneDrive Entreprise – Modifications *\*" "%~dp0%username%\OneDrive Entreprise – Modifications non synchronisées\"

xcopy /S /Q /H /Y "%userprofile%\Contacts\*" "%~dp0%username%\Contacts\"
xcopy /S /Q /H /Y "%userprofile%\Favorites\*" "%~dp0%username%\Favorites\"

xcopy /S /Q /H /Y "%userprofile%\AppData\Roaming\Microsoft\Sticky Notes\*" "%~dp0%username%\AppData\Roaming\Microsoft\Sticky Notes\"
xcopy /S /Q /H /Y "%userprofile%\AppData\Roaming\Microsoft\Excel\*" "%~dp0%username%\AppData\Roaming\Microsoft\Excel\"
xcopy /S /Q /H /Y "%userprofile%\AppData\Roaming\Microsoft\Proof\*" "%~dp0%username%\AppData\Roaming\Microsoft\Proof\"
xcopy /S /Q /H /Y "%userprofile%\AppData\Roaming\Microsoft\Signatures\*" "%~dp0%username%\AppData\Roaming\Microsoft\Signatures\"
xcopy /S /Q /H /Y "%userprofile%\AppData\Roaming\Microsoft\Templates\*" "%~dp0%username%\AppData\Roaming\Microsoft\Templates\"
xcopy /S /Q /H /Y "%userprofile%\AppData\Roaming\Microsoft\UProof\*" "%~dp0%username%\AppData\Roaming\Microsoft\UProof\"

xcopy /S /Q /H /Y "%userprofile%\AppData\Roaming\Mozilla\*" "%~dp0%username%\AppData\Roaming\Mozilla\"
xcopy /S /Q /H /Y "%userprofile%\AppData\Local\Google\*" "%~dp0%username%\AppData\Local\Google\"
xcopy /S /Q /H /Y "%userprofile%\AppData\Roaming\Apple\*" "%~dp0%username%\AppData\Roaming\Apple\"

xcopy /S /Q /H /Y "%userprofile%\Desktop\*" "%~dp0%username%\Desktop\"
xcopy /S /Q /H /Y "%userprofile%\Documents\*" "%~dp0%username%\Documents\"
xcopy /S /Q /H /Y "%userprofile%\Pictures\*" "%~dp0%username%\Pictures\"
xcopy /S /Q /H /Y "%userprofile%\Music\*" "%~dp0%username%\Music\"
xcopy /S /Q /H /Y "%userprofile%\downloads\*" "%~dp0%username%\downloads\"
xcopy /S /Q /H /Y "%userprofile%\Videos\*" "%~dp0%username%\Videos\"
xcopy /S /Q /H /Y "%userprofile%\AppData\Local\Microsoft\Outlook\*.pst" "%~dp0%username%\AppData\Local\Microsoft\Outlook\*.pst"



pause
cls
pause
echo pensez aux lecteurs reseau
echo pensez aux imprimantes
echo pensez signatures par défaut
Et le script ListeImprimante à mettre au meme :
Const ForWriting = 2
Dim fso, f  
strComputer = "."

Set objWMIService = GetObject("winmgmts:" & "{impersonationLevel=impersonate}!\\" & strComputer & "\root\cimv2")

Set colInstalledPrinters = objWMIService.ExecQuery ("Select * from Win32_Printer")

Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.OpenTextFile(".\imprimante.txt", ForWriting,true)
set f2 = fso.OpenTextFile(".\imprimanteDefault.txt", ForWriting,true)

For Each objPrinter in colInstalledPrinters

if (objPrinter.Name <> "Fax") and (objPrinter.Name <> "Microsoft Office Live Meeting 2007 Document Writer") and (objPrinter.Name <> "Microsoft XPS Document Writer")  Then
        f.write(objPrinter.Name & vbnewline)
    end if

if (objPrinter.Default = true) then
    f2.write(objPrinter.Name & vbnewline)
end if


Next

Aucun commentaire:

Enregistrer un commentaire