Fix ObjectID Errors when Mounting WIMs

@echo on
cls
“C:\Program Files\Windows AIK\Tools\Servicing\Dism.exe” /mount-wim /wimfile:”C:\myimage\image.wim” /index:1 /mountdir:”C:\newmount”
pause
“C:\Program Files\Windows AIK\Tools\Servicing\Dism.exe” /unmount-wim /mountdir:”C:\newmount” /commit
“C:\Program Files\Windows AIK\Tools\Servicing\Dism.exe” /Cleanup-Wim
pause
exit /b 0

email me

Figure out which Drive to Image in your Startnet.cmd file

email me

This script will determine whether C, D, or E drive is the proper drive to image during an automated imaging process. This is important if you have multiple partitioned drives and would like to automate the imaging—for example, you have C drive for Windows, D drive for data, and E drive for recovery. They will not necessarily be those letters during the imaging process, so you need a way to determine which is the right drive letter for the Windows drive (otherwise, you risk imaging the wrong partition—yikes). I use diskpart to format the Windows partition (the easy part)…and the script returns each drive’s available space, all except the Windows drive (since it was formatted)…an empty drive returns “c:\”

@echo off
title Windows 7 Imaging Utility
cls
Echo Please wait while the Imaging Utility loads....
color 0a
@setlocal enableextensions enabledelayedexpansion
wpeinit

set MyDrv=

rem this images the drive
if exist d:\boot\wim\image.wim (
cls
echo Running diskpart on drive...
diskpart /s d:\boot\wim\disk.txt

for /f "tokens=3" %%a in ('dir c:\') do set varDrv1=%%a
for /f "tokens=3" %%c in ('dir e:\') do set varDrv3=%%c

set varDrv1=!varDrv1:,=!
set varDrv3=!varDrv3:,=!

if !varDrv3! EQU e:\ echo success && set MyDrv=E
if !varDrv1! EQU c:\ echo success && set MyDrv=C

cls
echo Imaging drive...please wait
d:\boot\wim\imagex.exe /apply d:\boot\wim\image.wim 1 !MyDrv!:
goto :end
)

rem this images the drive
if exist e:\boot\wim\image.wim (
cls
echo Running diskpart on drive...
diskpart /s e:\boot\wim\disk.txt

for /f "tokens=3" %%a in ('dir c:\') do set varDrv1=%%a
for /f "tokens=3" %%b in ('dir d:\') do set varDrv2=%%b

set varDrv1=!varDrv1:,=!
set varDrv2=!varDrv2:,=!

if !varDrv2! EQU d:\ echo success && set MyDrv=D
if !varDrv1! EQU c:\ echo success && set MyDrv=C

cls
echo Imaging drive...please wait
e:\boot\wim\imagex.exe /apply e:\boot\wim\image.wim 1 !MyDrv!:
goto :end
)

rem this images the drive
if exist f:\boot\wim\image.wim (
cls
echo Running diskpart on drive...
diskpart /s f:\boot\wim\disk.txt

for /f "tokens=3" %%a in ('dir c:\') do set varDrv1=%%a
for /f "tokens=3" %%b in ('dir d:\') do set varDrv2=%%b
for /f "tokens=3" %%c in ('dir e:\') do set varDrv3=%%c

set varDrv1=!varDrv1:,=!
set varDrv2=!varDrv2:,=!
set varDrv3=!varDrv3:,=!

if !varDrv3! EQU e:\ echo success && set MyDrv=E
if !varDrv2! EQU d:\ echo success && set MyDrv=D
if !varDrv1! EQU c:\ echo success && set MyDrv=C

cls
echo Imaging drive...please wait
f:\boot\wim\imagex.exe /apply f:\boot\wim\image.wim 1 !MyDrv!:
goto :end
)

:end
exit

Merge MAC Address Files with Case Conversion

@Echo off
Title Administrative Compare and Output
color 0a
SETLOCAL ENABLEDELAYEDEXPANSION

REM ——————————————————————————————–
for /f “tokens=1,2 delims=,” %%a in (list1.txt) do (
for /f “tokens=1,2 delims=,” %%c in (list2.txt) do (

SET string1=%%a
SET string2=%%c

rem do case conversion – comment out to skip case conversion
CALL :LCase string1 macadd1
CALL :LCase string2 macadd2

echo COMPARE MAC1-!macadd1! to MAC2-!macadd2!
if !macadd1! EQU !macadd2! echo SUCCESS! && echo %%b %%d & echo %%b,%%d>>computers.txt
rem timing, remove to speed up
Rem ping -n 2 127.0.0.1>nul
)
)
REM ——————————————————————————————–
echo COMPLETE!
pause

:LCase
:UCase
:: Converts to upper/lower case variable contents
:: Syntax: CALL :UCase _VAR1 _VAR2
:: Syntax: CALL :LCase _VAR1 _VAR2
:: _VAR1 = Variable NAME whose VALUE is to be converted to upper/lower case
:: _VAR2 = NAME of variable to hold the converted value
:: Note: Use variable NAMES in the CALL, not values (pass “by reference”)

SET _UCase=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
SET _LCase=a b c d e f g h i j k l m n o p q r s t u v w x y z
SET _Lib_UCase_Tmp=!%1!
IF /I “%0″==”:UCase” SET _Abet=%_UCase%
IF /I “%0″==”:LCase” SET _Abet=%_LCase%
FOR %%Z IN (%_Abet%) DO SET _Lib_UCase_Tmp=!_Lib_UCase_Tmp:%%Z=%%Z!
SET %2=%_Lib_UCase_Tmp%
GOTO:EOF

email me