Problème pour monter "shadow copy" en FR
Bonjour à toutes et tous
Tout d'abord tous mes voeux pour cette nouvelle année !!!
J'ai trouvé il y a quelques temps sur ce lien : http://www.howtogeek.com/129188/htg-...-locked-files/
Un petit script bien pratique nommé "MountLatestShadowCopy" qui permet de monter et exploiter les clichés instantanés VSS.
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
| @ECHO OFF
IF NOT "%~1" == "/?" GOTO Main
ECHO Mount Latest Shadow Copy [v1.0]
ECHO Locates the most recent Windows file shadow copy and mounts it to the
ECHO specified directory.
ECHO Copyright (c) 2012, Jason Faulkner - All rights reserved.
ECHO.
ECHO %~n0 MountToFolder [SearchDrive]
ECHO.
ECHO MountToFolder Folder location where the shadow copy contents will be made
ECHO available. This folder should NOT exist; it will be created
ECHO as a mount point and accessible after the operation completes.
ECHO Important Note: The target specified should end with
ECHO a \ character to ensure it is properly read as a directory.
ECHO For example: C:\MyShadowCopy\
ECHO SearchDrive Specifies the local drive for which you want to mount the
ECHO latest shadow copy. Enter with a colon following the drive
ECHO letter. Default value is C:.
ECHO.
ECHO Note: This script MUST be run as Administrator (with highest privledges in a
ECHO scheduled task) in order to work properly.
ECHO.
ECHO Requirements:
ECHO Windows Vista or later with System Restore enabled.
ECHO.
ECHO __________
ECHO Visit my website for additional information, examples and updates.
ECHO <a href="http://jasonfaulkner.com" target="_blank">http://jasonfaulkner.com</a>
GOTO :EOF
:Main
SETLOCAL EnableExtensions
CALL :Initialize
CALL :Configuration %*
CALL :CheckRequirements
IF %ERRORLEVEL% GTR 0 GOTO Finish
CALL :PrepSettings
IF %ERRORLEVEL% GTR 0 GOTO Finish
REM Pull the shadow copy listing.
VSSAdmin List Shadows %SearchDrive% > %TempFile%
SET ShadowPath=
REM Pull the latest shadow copy from the listing.
FOR /F "usebackq tokens=1,2* delims=:" %%A IN (`FINDSTR /I /C:"Shadow Copy Volume:" %TempFile%`) DO SET ShadowPath=%%B
IF NOT "%ShadowPath%" == "" (
REM A shadow copy was found, mount it.
MKLINK /D "%MountFolder%" %ShadowPath%\
) ELSE (
ECHO No Shadow Copies found.
)
:Finish
IF EXIST %TempFile% DEL %TempFile%
ENDLOCAL
GOTO :EOF
:Initialize
SET MountFolder=
SET SearchDrive=C:
SET TempFile="%TEMP%\%~n0_%RANDOM%.txt"
GOTO :EOF
:Configuration
IF /I "%~1" == "" GOTO InvalidParams
SET MountFolder=%~dp1
IF NOT "%~2" == "" SET SearchDrive=%~2
GOTO :EOF
:PrepSettings
IF EXIST "%MountFolder%" (
ECHO Mount Folder: %MountFolder%
ECHO The specified folder already exists. Enter a new folder for the mount target.
GOTO InvalidParams
)
IF NOT "%SearchDrive%" == "" SET SearchDrive=/FOR=%SearchDrive%
GOTO :EOF
:CheckRequirements
CALL :VerifyRequirement "vssadmin.exe"
GOTO :EOF
:VerifyRequirement
IF EXIST "%~1" GOTO :EOF
IF NOT "%~$PATH:1" == "" GOTO :EOF
ECHO Missing requirement: [%~1] Use /? to view the help information.
EXIT /B 2
:InvalidParams
ECHO Invalid parameters. Use /? to view the help information.
EXIT /B 1 |
Le script fonctionne parfaitement sur un environnement anglo-saxon mais pas sur un OS en français. Je l'ai donc modifié en remplaçant l'entrée "Shadow Copy Volume" par "Volume de cliché instantané"
Code:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
| :Main
SETLOCAL EnableExtensions
CALL :Initialize
CALL :Configuration %*
CALL :CheckRequirements
IF %ERRORLEVEL% GTR 0 GOTO Finish
CALL :PrepSettings
IF %ERRORLEVEL% GTR 0 GOTO Finish
REM Pull the shadow copy listing.
VSSAdmin List Shadows %SearchDrive% > %TempFile%
SET ShadowPath=
REM Pull the latest shadow copy from the listing.
FOR /F "usebackq tokens=1,2* delims=:" %%A IN (`FINDSTR /I /C:"Volume de cliché instantané :" %TempFile%`) DO SET ShadowPath=%%B
IF NOT "%ShadowPath%" == "" (
REM A shadow copy was found, mount it.
MKLINK /D "%MountFolder%" %ShadowPath%\
) ELSE (
ECHO No Shadow Copies found.
)
:Finish
IF EXIST %TempFile% DEL %TempFile%
ENDLOCAL
GOTO :EOF
:Initialize
SET MountFolder=
SET SearchDrive=C:
SET TempFile="%TEMP%\%~n0_%RANDOM%.txt"
GOTO :EOF
:Configuration
IF /I "%~1" == "" GOTO InvalidParams
SET MountFolder=%~dp1
IF NOT "%~2" == "" SET SearchDrive=%~2
GOTO :EOF
:PrepSettings
IF EXIST "%MountFolder%" (
ECHO Mount Folder: %MountFolder%
ECHO The specified folder already exists. Enter a new folder for the mount target.
GOTO InvalidParams
)
IF NOT "%SearchDrive%" == "" SET SearchDrive=/FOR=%SearchDrive%
GOTO :EOF
:CheckRequirements
CALL :VerifyRequirement "vssadmin.exe"
GOTO :EOF
:VerifyRequirement
IF EXIST "%~1" GOTO :EOF
IF NOT "%~$PATH:1" == "" GOTO :EOF
ECHO Missing requirement: [%~1] Use /? to view the help information.
EXIT /B 2 |
Mais rien n'y fait j'ai toujours l'erreur "No Shadows Copies found" alors que les clichés existent bel et bien... Et là je sèche :weird:
Est ce que quelqu'un a déjà été confronté à ce problème ?
Merci d'avance pour votre aide