You're actually nitpicking over nothing. 2nd version adds listing of the first 3 indexes, to know more info about them than just the name. Most esd's have the actual image that should interest you on index 3 while 1 and 2 are useless (Windows Setup Media & Microsoft Windows Recovery Environment). Anyway, 3rd version will list now only existing indexes, for a small price of slower listing. Hope this satisfies you! In the end, it end up a better .reg so thanks all for input.
Sure, but you've complained about cosmetics (like a bull seeing red, you saw 'error') not functionality. It worked fine, and it was fast. Now it's more complete, but a bit slower. Like I've mentioned in OP, this is just a reg file with a sequence of commands, and it has to obey some lame size limitations - it's not a batch script.
Well, it took some precious Saturday time, and I almost drown in quote escaping, but I'm not Microsoft - I take responsibility for my s**t
"Get-ImageInfo /imagefile" don't read my ESD files, and "The term 'Get-WimInfo' is not recognized as the name of a cmdlet, function, script file, or operable program." under powershell, so I had to change it to: [HKEY_CLASSES_ROOT\.esd\shell\DISMinfo\command] @="powershell -c \"Start-Process powershell -ArgumentList '-c \\\"$w=''%1'';$w;dism /Get-WimInfo /WimFile:$w;timeout -1\\\"' -verb RunAs\"" with this, I get a list from an ESD image file, but with no Index detail ($i), as I cannot get a result for the "counting" from the PS command ($c), and if I Argument between{...}, I end up in a loop-list, even when it get errors after the last valid Index number (from invalid index #'s) : Output: Deployment Image Servicing and Management tool Version: 10.0.14393.0 Details for image : 17763.1.180914-1434.rs5_release_clientconsumer_ret_x64fre_en-gb_a9993f25934b5d28001749d5a8856c640f055cf1.esd Index : 1 Name : Windows Setup Media Description : Windows Setup Media Size : 273,099,572 bytes Index : 2 Name : Microsoft Windows PE (x64) Description : Microsoft Windows PE (x64) Size : 1,801,883,423 bytes Index : 3 Name : Microsoft Windows Setup (x64) Description : Microsoft Windows Setup (x64) Size : 1,961,925,920 bytes Index : 4 Name : Windows 10 Home Description : Windows 10 Home Size : 14,084,784,437 bytes Index : 5 Name : Windows 10 Home N Description : Windows 10 Home N Size : 13,277,327,741 bytes Index : 6 Name : Windows 10 Home Single Language Description : Windows 10 Home Single Language Size : 14,084,830,676 bytes Index : 7 Name : Windows 10 Education Description : Windows 10 Education Size : 14,321,002,383 bytes Index : 8 Name : Windows 10 Education N Description : Windows 10 Education N Size : 13,503,360,762 bytes Index : 9 Name : Windows 10 Pro Description : Windows 10 Pro Size : 14,320,884,972 bytes Index : 10 Name : Windows 10 Pro N Description : Windows 10 Pro N Size : 13,503,206,158 bytes The operation completed successfully. Press any key to continue ...
Well something is wrong with your host OS, because the powershell cmdlets for dism have been around for ages. Net framework version 4+ is needed for any serious usage of Windows specially if it's an older version like 7, am I guessing that's what you've used? Anyway, here's a modification getting the count from dism command (obviously less reliable than the cmdlet, but should be good enough - and even a bit faster): Code: Windows Registry Editor Version 5.00 ;4th version uses dism to get count instead of ps cmdlet - for those broken/outdated win7 systems ;3rd version adds support for vhd images, and lists all existing indexes details (detecting them adds a bit of slow at start) ;2nd version adds support for msu, and blindly listed first 3 indexes details, fast, but could list 'error" ;1st version undo (HCU unreliable, more so if having 7-Zip shell extensions, hence switched to HKCR) [-HKEY_CURRENT_USER\Software\Classes\.esd\shell\DISMinfo] [-HKEY_CURRENT_USER\Software\Classes\.wim\shell\DISMinfo] [-HKEY_CURRENT_USER\Software\Classes\CABFolder\shell\DISMinfo] [-HKEY_CLASSES_ROOT\.esd\shell\DISMinfo] [HKEY_CLASSES_ROOT\.esd\shell\DISMinfo] "MUIVerb"="DISM Info" "Icon"="C:\\Windows\\HelpPane.exe" "CommandFlags"=dword:00000010 [HKEY_CLASSES_ROOT\.esd\shell\DISMinfo\command] @="powershell -c \"Start-Process powershell -ArgumentList '-c \\\"$w=''%1'';$w;$c=(dism /Get-ImageInfo /ImageFile:$w) | sls ''Index'';for($i=1;$i -le $c.count;$i++){dism /Get-ImageInfo /ImageFile:$w /Index:$i};timeout -1\\\"' -verb RunAs\"" $c=(dism /Get-ImageInfo /ImageFile:$w)[-6].split(' :')[-1] [-HKEY_CLASSES_ROOT\.wim\shell\DISMinfo] [HKEY_CLASSES_ROOT\.wim\shell\DISMinfo] "MUIVerb"="DISM Info" "Icon"="C:\\Windows\\HelpPane.exe" "CommandFlags"=dword:00000010 [HKEY_CLASSES_ROOT\.wim\shell\DISMinfo\command] @="powershell -c \"Start-Process powershell -ArgumentList '-c \\\"$w=''%1'';$w;$c=(dism /Get-ImageInfo /ImageFile:$w) | sls ''Index'';for($i=1;$i -le $c.count;$i++){dism /Get-ImageInfo /ImageFile:$w /Index:$i};timeout -1\\\"' -verb RunAs\"" [-HKEY_CLASSES_ROOT\Windows.VhdFile\shell\DISMinfo] [HKEY_CLASSES_ROOT\Windows.VhdFile\shell\DISMinfo] "MUIVerb"="DISM Info" "Icon"="C:\\Windows\\HelpPane.exe" "CommandFlags"=dword:00000010 [HKEY_CLASSES_ROOT\Windows.VhdFile\shell\DISMinfo\command] @="powershell -c \"Start-Process powershell -ArgumentList '-c \\\"$w=''%1'';$w;$c=(dism /Get-ImageInfo /ImageFile:$w) | sls ''Index'';for($i=1;$i -le $c.count;$i++){dism /Get-ImageInfo /ImageFile:$w /Index:$i};timeout -1\\\"' -verb RunAs\"" [-HKEY_CLASSES_ROOT\CABFolder\shell\DISMinfo] [HKEY_CLASSES_ROOT\CABFolder\shell\DISMinfo] "MUIVerb"="DISM Info" "Icon"="C:\\Windows\\HelpPane.exe" "CommandFlags"=dword:00000010 [HKEY_CLASSES_ROOT\CABFolder\shell\DISMinfo\command] @="powershell -c \"Start-Process cmd -ArgumentList '/c dism /Online /Get-PackageInfo /PackagePath:\\\"%1\\\" &timeout -1' -verb RunAs\"" [-HKEY_CLASSES_ROOT\Microsoft.System.Update.1\shell\DISMinfo] [HKEY_CLASSES_ROOT\Microsoft.System.Update.1\shell\DISMinfo] "MUIVerb"="DISM Info" "Icon"="C:\\Windows\\HelpPane.exe" "CommandFlags"=dword:00000010 [HKEY_CLASSES_ROOT\Microsoft.System.Update.1\shell\DISMinfo\command] @="powershell -c \"Start-Process cmd -ArgumentList '/c pushd \\\"%%temp%%\\\" &mkdir disminfo &Expand -F:*Properties.txt \\\"%1\\\" disminfo &pushd disminfo &type *.txt &del /f /q *.* &timeout -1'\"" @hyperstriker, please report back if it's what you needed.
Thanks @BAU, I found that my problem were laying over the DISM version (10.0.14393.0) I was running over, the option Get-ImageInfo don't read the ESD image files and it reply with an "Error: 87, The parameter is incorrect."; so I tried over the DISM ver.10.0.17763.1 from inside an newer complete OS image and it worked well, I assume that the Powershell error ("The term 'Get-WimInfo' is not recognized."..) is because I am under the same OS release ver. and the embedded Powershell 5.1.14393.2580 don't support it as well; as I even tried the console from the PowerShell 6.2.0-preview.1, but just to get the same results. Thank you so much @BAU for your work share, the care and time.
Get-ImageInfo (Get-WindowsImage) support esd files since Win 8.1 but the issue was it doesn't support .esd extension and require .wim
That's great! Should I replace the version in OP with this last one? For me it's a bit faster, kinda like the very first iteration, would like a confirmation.
When I try the last one, in my case, the one getting the count ($c) by closing DISM between the parenthesis instead of using Get-Imageinfo directly from powershell it output faster; Yes!, is a matter of a second, and Yes!, (strange enough) by calling up an external executable tool instead of using an internal cmdlet; but, it is faster, I can notice the pause better at the start of the second opened window right before displaying all the indexed information. but this is noticeable when I check on images not with 2 or 3 indexed information to display as it just take a second, but when I try those with 10 or so,; And lets have in mind that it also may vary in cases as per the environment, of and on where and how the image file is storage or located and all that in between. so... Yes!, and Yes!, I think that you should replace the one in OP with this one. On the other hand, as I was having problem getting the count to list-detail the index over the ESD image files with the Get-WimInfo option from the DISM as it is invalid inside powershell, so to break for an string it got it work. Then, if I use the following for the .esd extensions, it works great and it display the indexes detail as expected. [HKEY_CLASSES_ROOT\.esd\shell\DISMinfo\command] @="powershell -c \"Start-Process powershell -ArgumentList '-c \\\"$w=''%1'';$w;$c=(dism /Get-WimInfo /WimFile:$w) | sls ''Index'';for($i=1;$i -le $c.count;$i++){dism /Get-WimInfo /WimFile:$w /Index:$i};timeout -1\\\"' -verb RunAs\"" So..., in conclusion, for and in my case, with this change, as not being able to work over ESD's from DISM with Get-ImageInfo, and can by just using Get-WimInfo, So to by nesting DISM then breaking the command pipeline to intro a select-string for to "index", with this pattern, you just provided the solution. I forgot to mention that the .Net Framework I am under is the 4.7.2 and .NET core runtime 2.1.5 Once gain, @BAU, thanks a lot. problem solved!
Are you asking about the part of copy-pasting that text into a file.reg (not file.reg.txt - must have View - file name extensions in explorer) and then double-clicking it to import it? Edit: Also attached in first post in a zip so all you have to do is download it then dblclick the included .reg file