23 May 2009

Information about WIM file by ImageX

I guess today it's not necessary to explain what Imagex.exe is and what it does :).
Personally, I really love this tool, but I don't like the way Imagex responses to the parameter /INFO. When we run the following:
IMAGEX /INFO D:\Sources\install.wim

We will see the following result (just part of the result):


ImageX Tool for Windows
Copyright (C) Microsoft Corp. All rights reserved.
Version: 6.1.7100.0

WIM Information:
----------------
Path: D:\Sources\install.wim
GUID: {0d111cde-2c81-41f9-8a12-c6a4ea332f6c}
Image Count: 5
Compression: LZX
Part Number: 1/1
Attributes: 0xc
Integrity info
Relative path junction


Available Image Choices:
------------------------

2407585560

9062
46181
7966805292

0x01C9CFC1
0xAC43B062


0x01C9CFD1
0x1DB61AA6


0
MicrosoftR WindowsR Operating System
Starter
Client
acpiapic
WinNT
Terminal Server

en-US
en-US


6
1
7127
0
0

WINDOWS

Windows 7 STARTER
Windows 7 STARTER
Starter
3064992513
Windows 7 Starter
Windows 7 Starter


9095
46384
8019432535

0x01C9CFC1
0xAC43B062


0x01C9CFD4
0x05378D42


0
MicrosoftR WindowsR Operating System
HomeBasic
Client
acpiapic
WinNT
Terminal Server

en-US
en-US


6
1
7127
0
0

WINDOWS

Windows 7 HOMEBASIC
Windows 7 HOMEBASIC
HomeBasic
3096342833
Windows 7 Home Basic
Windows 7 Home Basic



So, one day I decided to simplify the ImageX's result, make it more readable, and I've created one script. I've called it _Info_About-WIM.bat. So, when I run _Info_About-WIM.bat D:\Sources\install.wim I see the result in following format:

Index Image Name
[1] Windows 7 STARTER
[2] Windows 7 HOMEBASIC
[3] Windows 7 HOMEPREMIUM
[4] Windows 7 PROFESSIONAL
[5] Windows 7 ULTIMATE


So, here is a content of _Info_About-WIM.bat:

@echo off

IF {%1}=={} @Echo Please provide a path to the .WIM file. For ex. D:\Sources\install.wim &goto :EOF

SET WIMPATH=%1
SET Images-Num=
SET LoopNum=
SET I=

FOR /F "TOKENS=3 Delims=: " %%a in ('imagex /INFO %1 ^| Find /i "Image Count"') do set Images-Num=%%a
SET /a LoopNum=%Images-Num% + 1

@Echo Index Image Name

:LOOP1
SET /a I=%I% + 1
IF "%I%"=="%LoopNum%" goto END
FOR /F "TOKENS=3 Delims=>,<" %%a in ('Imagex /INFO %1 %I% ^| find /i ""') do @Echo [%I%] %%a
goto LOOP1

:END



Follow ITstuff.ca on Twitter

If you enjoyed this post consider subscribing via rssrectangle ITStuff.ca | Tips and Tricks for IT Staff or ITStuff.ca | Tips and Tricks for IT Staff Email

Bookmark and Share ITStuff.ca

1 comment:

  1. Hi I thought I'd finally found my answer here, seems I'm not the only one who doesn't like the /INFO layout.:)

    I'm running/calling this from a cmd windows in Windows 7, i'm trying to automate the whole creation of VHD , attach of ISO, VHD and copying of a given WIM, with minimum user input, this was my last obstacle, to make the /INFO (I.T.) user friendly.

    When I run your script/bat (i've called it imagin for my own purposes) against my M: drive

    imagin.bat M:\sources\install.wim

    all i get is

    Index Image Name

    No other info, and the command prompt again.

    I may be missing something silly, but do you have any ideas/pointers?

    Thanks

    ReplyDelete