Means no differences found (no delta TXT written) . This time i checked the compare part and it's working here by showing the not excluded names (if all are recognized correctly). If a delta is found it should process further. Check if WIM names in exclusion eactly match the names in folder.
... little but devastating copy 'n paste error sneaked into compare part ... always good to check pathes 5 times not only 4 . instead of e:\wim\wim path should be e:\wim and it should work . And "skip=3 tokens=* delims= " need to be changed to "tokens=1 delims= " Code: :: CHECK FOR FILES TO PROCESS OR EXIT :: set compare files set wimfile=e:\wim\wimlist.txt set deltafile=e:\wim\deltalist.txt if exist %wimfile% del /s /q %wimfile% >nul if exist %deltafile% del /s /q %deltafile% >nul :: get WIM names from Folder for /r "e:\wim" %%a in (*.wim) do echo %%~na>>%wimfile% :: compare files and write difference to %deltafile% for /f "tokens=1 delims= " %%a in ('powershell "Compare-Object -ReferenceObject (Get-Content %textfile%) -DifferenceObject (Get-Content %wimfile%)" ^| findstr /i "=>"') do echo %%a>>%deltafile% if not exist %deltafile% ( echo No files to process found. echo: pause if exist %wimfile% del /s /q %wimfile% >nul exit )
No errors out that DISM cant find file. the exclusion txt files looks like this Code: + + + Get-Content At + + + + Compare-Object At + + + + + + + Compare-Object At + + + + v1000_w81u1x64_Customer_001... v1000_w81u1x64_Customer_002... v1000_w81u1x64_Customer_003... Here is the code again Spoiler Code: @echo off :: get admin rights (NET FILE||(powershell -command Start-Process '%0' -Verb runAs -ArgumentList '%* '&EXIT /B))>NUL 2>&1 setLocal EnableDelayedExpansion :: Get timestamp data: will show month.day.year.hour.min.sec for /f "skip=1 delims=" %%x in ('wmic os get localdatetime') do if not defined X set X=%%x :: Timestamp with seconds :: set timestamp=%X:~4,2%-%X:~6,2%-%X:~0,4%-%X:~8,2%-%X:~10,2%-%X:~12,2% :: Timestamp without seconds set timestamp=%X:~4,2%-%X:~6,2%-%X:~0,4%-%X:~8,2%-%X:~10,2% :: Path to update packages set updates1=e:\windowsupdates\Baseline set updates2=e:\windowsupdates\General set updates3=e:\windowsupdates\Hotfix set updates4=e:\windowsupdates\Security set updates5=e:\windowsupdates\Additional set updates6=e:\windowsupdates\Extra :: Exclude WIms from set textfile=e:\wim\exclusions.txt :: CHECK FOR FILES TO PROCESS OR EXIT :: set compare files set wimfile=e:\wim\wimlist.txt set deltafile=e:\wim\deltalist.txt if exist %wimfile% del /s /q %wimfile% >nul if exist %deltafile% del /s /q %deltafile% >nul :: get WIM names from Folder for /r "e:\wim" %%a in (*.wim) do echo %%~na>>%wimfile% :: compare files and write difference to %deltafile% for /f "tokens=1 delims= " %%a in ('powershell "Compare-Object -ReferenceObject (Get-Content %textfile%) -DifferenceObject (Get-Content %wimfile%)" ^| findstr /i "=>"') do echo %%a>>%deltafile% if not exist %deltafile% ( echo No files to process found. echo: pause if exist %wimfile% del /s /q %wimfile% >nul exit ) :: Path to files copy set path1=e:\files set target=e:\mount :: start procedure :: backup all WIMs to e:\backup\backup.wim echo. echo =============================================================================== echo Backing up to e:\backup\backup_%timestamp%.wim echo =============================================================================== echo. set "p=0" for /r "e:\wim" %%a in (*.wim) do set /a p+=1 if /i "%p%"=="0" echo NO WIMs FOUND.&&pause&&exit for /f "tokens=* delims= " %%a in (%deltafile%) do ( echo Exporting %%a to e:\backup\backup.wim echo. Dism /Export-Image /SourceImageFile:e:\wim\%%a.wim /SourceIndex:1 /DestinationImageFile:e:\backup\backup_%timestamp%.wim /compress:max /CheckIntegrity ) :: mount single WIMs to e:\mount, add updates and unmount/commit echo. echo =============================================================================== echo Mounting to e:\mount echo Adding Updates echo Unmount/Commit echo =============================================================================== echo. set "a=0"&&set "b=0"&&set "c=0"&&set "d=0"&&set "e=0"&&set "f=0" for /r "%updates1%" %%a in (*.*) do set /a a+=1 for /r "%updates2%" %%a in (*.*) do set /a b+=1 for /r "%updates3%" %%a in (*.*) do set /a c+=1 for /r "%updates4%" %%a in (*.*) do set /a d+=1 for /r "%updates5%" %%a in (*.*) do set /a e+=1 for /r "%updates6%" %%a in (*.*) do set /a f+=1 :: execute loop for deltas only for /f "tokens=* delims= " %%a in (%deltafile%) do ( echo Processing %%a echo. DISM /mount-wim /wimfile:e:\wim\%%a.wim /index:1 /mountdir:e:\mount if /i %a% gtr 0 DISM /image:e:\mount /Add-Package /PackagePath:%updates1% if /i %b% gtr 0 DISM /image:e:\mount /Add-Package /PackagePath:%updates2% if /i %c% gtr 0 DISM /image:e:\mount /Add-Package /PackagePath:%updates3% if /i %d% gtr 0 DISM /image:e:\mount /Add-Package /PackagePath:%updates4% if /i %e% gtr 0 DISM /image:e:\mount /Add-Package /PackagePath:%updates5% if /i %f% gtr 0 DISM /image:e:\mount /Add-Package /PackagePath:%updates6% xcopy.exe %path1%\*.* %target%\*.* /s /d /e /h /r /y DISM /unmount-wim /mountdir:e:\mount /commit echo %%a>>%textfile% ) :: merge single WIMs to e:\master\install.wim echo. echo =============================================================================== echo Exporting to e:\master echo =============================================================================== echo. for /f "tokens=* delims= " %%a in (%deltafile%) do ( echo Exporting %%a to e:\master\install.wim echo. Dism /Export-Image /SourceImageFile:e:\wim\%%a.wim /SourceIndex:1 /DestinationImageFile:e:\master\install.wim /compress:max /CheckIntegrity ) if exist %wimfile% del /s /q %wimfile% >nul if exist %deltafile% del /s /q %deltafile% >nul :: split master WIM echo. echo =============================================================================== echo Splitting WIM to e:\sources echo =============================================================================== echo. Dism /Split-Image /ImageFile:e:\master\install.wim /SWMFile:e:\sources\install.swm /FileSize:256 :: end procedure :: script will pause here echo. echo =============================================================================== echo DONE ... echo =============================================================================== echo. pause :: EXIT endlocal exit
Is still a problem in compare part. How is your original exclusion list looking like? The moment script pauses at end, wimfile and deltafile are still present, if you hit any key they get deleted. Please post exclusion list before start and the other 2 after the run (before thy get deleted).
Let's try a real dry run to check the compare. Code: @echo off :: get admin rights (NET FILE||(powershell -command Start-Process '%0' -Verb runAs -ArgumentList '%* '&EXIT /B))>NUL 2>&1 setLocal EnableDelayedExpansion :: Get timestamp data: will show month.day.year.hour.min.sec for /f "skip=1 delims=" %%x in ('wmic os get localdatetime') do if not defined X set X=%%x :: Timestamp with seconds :: set timestamp=%X:~4,2%-%X:~6,2%-%X:~0,4%-%X:~8,2%-%X:~10,2%-%X:~12,2% :: Timestamp without seconds set timestamp=%X:~4,2%-%X:~6,2%-%X:~0,4%-%X:~8,2%-%X:~10,2% :: Path to update packages set updates1=e:\windowsupdates\Baseline set updates2=e:\windowsupdates\General set updates3=e:\windowsupdates\Hotfix set updates4=e:\windowsupdates\Security set updates5=e:\windowsupdates\Additional set updates6=e:\windowsupdates\Extra :: Exclude WIms from set textfile=e:\wim\exclusions.txt :: CHECK FOR FILES TO PROCESS OR EXIT :: set compare files set wimfile=e:\wim\wimlist.txt set deltafile=e:\wim\deltalist.txt if exist %wimfile% del /s /q %wimfile% >nul if exist %deltafile% del /s /q %deltafile% >nul :: get WIM names from Folder for /r "e:\wim" %%a in (*.wim) do echo %%~na>>%wimfile% :: compare files and write difference to %deltafile% for /f "tokens=1 delims= " %%a in ('powershell "Compare-Object -ReferenceObject (Get-Content %textfile%) -DifferenceObject (Get-Content %wimfile%)" ^| findstr /i "=>"') do echo %%a>>%deltafile% if not exist %deltafile% ( echo No files to process found. echo: pause if exist %wimfile% del /s /q %wimfile% >nul exit ) :: Path to files copy set path1=e:\files set target=e:\mount echo Exclusions: type %textfile% echo: echo: echo Folder: type %wimfile% echo: echo Delta: type %deltafile% :: end procedure :: script will pause here echo. echo =============================================================================== echo DONE ... echo =============================================================================== echo. pause :: EXIT endlocal exit Post the output. I tested with a folder with installa.wim, installb.wim (till d), exclusion list excludes b and c image. When runing above script it correctly outputs: Code: Exclusions: installb installc Folder: installa installb installc installd Delta: installa installd =============================================================================== DONE ... =============================================================================== Drücken Sie eine beliebige Taste . . .
Okay so I got curious and shortened the file name of the WIM and it's going through with no errors so far.
Yeah, was assuming this being the error ... nice to hear it's working for you. Debugging can be kinda breech birth sometimes .
HINT: I now remember that using '()' in a filename (default for Total Commander when automatically renaming files during copy) causes powershell to error out. Seems there are some chars where it reacts bitchy .
That one shouldn't cause errors affaik. Use my last dry-run-test script to check what's working, it will only show all found names, shorter than the whole process every time .
Rename one of your WIM to this (replaced the x's) but that you an idea of the character size. XXXXX_XXXXXXXX_XXXX_XXX_XXXXX_XX_XXX_XXXX_XXXX-11-17-2014.wim
Seems to be no problem, even when using Xs, renamed one of he WIMs and added their name to exclusions.txt: Code: Exclusions: installa XXXXX_XXXXXXXX_XXXX_XXX_XXXXX_XX_XXX_XXXX_XXXX-11-17-2014 Folder: installa installc installd XXXXX_XXXXXXXX_XXXX_XXX_XXXXX_XX_XXX_XXXX_XXXX-11-17-2014 Delta: installc installd =============================================================================== DONE ... ===============================================================================
Now i see the problem . Powershell is shortening the output to deltafile after 36 chars, will check for solution. Code: Exclusions: ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0004-11-17-2014 ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0002-11-17-2014 Folder: ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0001-11-17-2014 ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0002-11-17-2014 ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0003-11-17-2014 ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0004-11-17-2014 Delta: ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX... ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX... =============================================================================== DONE ... ===============================================================================
Bitchy powershell . Take this !!!! Needs to refine the output of powershell with Format-Table -AutoSize switch to avoid the cutting . Change the old powershell for loop with this one: Code: for /f "tokens=1 delims= " %%a in ('"powershell Compare-Object -ReferenceObject (Get-Content %textfile%) -DifferenceObject (Get-Content %wimfile%) ^| Format-Table -AutoSize" ^| findstr /i "=^>"') do echo %%a>>%deltafile% Now output shows: Code: Exclusions: ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0004-11-17-2014 ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0002-11-17-2014 Folder: ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0001-11-17-2014 ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0002-11-17-2014 ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0003-11-17-2014 ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0004-11-17-2014 Delta: ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0001-11-17-2014 ABCDE_12345678_XXXX_XXX_XXXXX_XX_XXX_XXXX_0003-11-17-2014 =============================================================================== DONE ... =============================================================================== EDIT: ================================ Forgot to mention that '=>' canged to '=^>'.
I started from fresh and receiving files now found DISM cant see e:\master\install.wim proceeds by not backing the WIM file and instead splits to e:\sources\install*.wim