Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Windows Registry Editor Version 5.00
- ;5th version adds support for iso images, and uses WIMINFO powershell snippet for iso, esd, wim (does not need admin rights)
- ;4th version uses dism and Get-WimInfo instead of Get-ImageInfo (for outdated win7); force entry to appear (7-zip shell issue)
- ;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_CLASSES_ROOT\.iso\shell\DISMinfo]
- [HKEY_CLASSES_ROOT\.iso\shell\DISMinfo]
- "MUIVerb"="DISM Info"
- "Icon"="HelpPane.exe"
- [HKEY_CLASSES_ROOT\.iso\shell\DISMinfo\command]
- @="powershell -nop -c iex((11..45|%%{(gp 'Registry::HKCR\\WIMINFO' $_ -ea 0).$_})-join[char]10);'%1';''; WIMINFO '%1'; timeout -1"
- ;========================================================================================
- [-HKEY_CLASSES_ROOT\Windows.IsoFile\shell\DISMinfo]
- [HKEY_CLASSES_ROOT\Windows.IsoFile\shell\DISMinfo]
- "MUIVerb"="DISM Info"
- "Icon"="HelpPane.exe"
- [HKEY_CLASSES_ROOT\Windows.IsoFile\shell\DISMinfo\command]
- @="powershell -nop -c iex((11..45|%%{(gp 'Registry::HKCR\\WIMINFO' $_ -ea 0).$_})-join[char]10);'%1';''; WIMINFO '%1'; timeout -1"
- ;========================================================================================
- [-HKEY_CLASSES_ROOT\.esd\shell\DISMinfo]
- [HKEY_CLASSES_ROOT\.esd\shell\DISMinfo]
- "MUIVerb"="DISM Info"
- "Icon"="HelpPane.exe"
- [HKEY_CLASSES_ROOT\.esd\shell\DISMinfo\command]
- @="powershell -nop -c iex((11..45|%%{(gp 'Registry::HKCR\\WIMINFO' $_ -ea 0).$_})-join[char]10);'%1';''; WIMINFO '%1'; timeout -1"
- ;========================================================================================
- [-HKEY_CLASSES_ROOT\.wim\shell\DISMinfo]
- [HKEY_CLASSES_ROOT\.wim\shell\DISMinfo]
- "MUIVerb"="DISM Info"
- "Icon"="HelpPane.exe"
- [HKEY_CLASSES_ROOT\.wim\shell\DISMinfo\command]
- @="powershell -nop -c iex((11..45|%%{(gp 'Registry::HKCR\\WIMINFO' $_ -ea 0).$_})-join[char]10);'%1';''; WIMINFO '%1'; timeout -1"
- ;========================================================================================
- [HKEY_CLASSES_ROOT\7-Zip.wim\shell\DISMinfo]
- "MUIVerb"="DISM Info"
- "Icon"="HelpPane.exe"
- [HKEY_CLASSES_ROOT\7-Zip.wim\shell\DISMinfo\command]
- @="powershell -nop -c iex((11..45|%%{(gp 'Registry::HKCR\\WIMINFO' $_ -ea 0).$_})-join[char]10);'%1';''; WIMINFO '%1'; timeout -1"
- ;========================================================================================
- [-HKEY_CLASSES_ROOT\Windows.VhdFile\shell\DISMinfo]
- [HKEY_CLASSES_ROOT\Windows.VhdFile\shell\DISMinfo]
- "MUIVerb"="DISM Info"
- "Icon"="HelpPane.exe"
- "CommandFlags"=dword:00000010
- [HKEY_CLASSES_ROOT\Windows.VhdFile\shell\DISMinfo\command]
- @="powershell -win 1 -nop -c \"start powershell -Args '-c \\\"$host.ui.rawui.windowtitle=''DISM Info'';$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;write-host (''=''*60)};timeout -1\\\"' -verb RunAs\""
- ;========================================================================================
- [-HKEY_CLASSES_ROOT\.cab\shell\DISMinfo]
- [HKEY_CLASSES_ROOT\.cab\shell\DISMinfo]
- "MUIVerb"="DISM Info"
- "Icon"="HelpPane.exe"
- "CommandFlags"=dword:00000010
- [HKEY_CLASSES_ROOT\.cab\shell\DISMinfo\command]
- @="powershell -win 1 -nop -c \"start cmd -Args '/c title DISM Info& dism /Online /Get-PackageInfo /PackagePath:\\\"%1\\\" &timeout -1' -verb RunAs\""
- ;========================================================================================
- [-HKEY_CLASSES_ROOT\CABFolder\shell\DISMinfo]
- [HKEY_CLASSES_ROOT\CABFolder\shell\DISMinfo]
- "MUIVerb"="DISM Info"
- "Icon"="HelpPane.exe"
- "CommandFlags"=dword:00000010
- [HKEY_CLASSES_ROOT\CABFolder\shell\DISMinfo\command]
- @="powershell -win 1 -nop -c \"start cmd -Args '/c title DISM Info& 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"="HelpPane.exe"
- [HKEY_CLASSES_ROOT\Microsoft.System.Update.1\shell\DISMinfo\command]
- @="powershell -win 1 -nop -c \"start cmd -Args '/c title DISM Info& pushd \\\"%%temp%%\\\" &mkdir disminfo &Expand -F:*Properties.txt \\\"%1\\\" disminfo &pushd disminfo &type *.txt &del /f /q *.* &timeout -1'\""
- ;========================================================================================
- ; WIMINFO powershell snippet not requiring admin rights
- [HKEY_CLASSES_ROOT\WIMINFO]
- "11"="function WIMINFO ($file = 'install.esd', $index = 0, $output = 0) { :info while ($true) {"
- "12"=" #:: Quick ISO ESD WIM info by AveYo v1"
- "13"=" #:: args = file, image index or 0 for all, output 0 for simple, 1 for xml text, 2 for xml object"
- "14"=" #:: by default returns simple image index, version, arch, lang, edition - example: 6,19041.631,x64,en-US,Professional"
- "15"=" $block = 2097152; $bytes = new-object 'Byte[]' ($block); $begin = [uint64]0; $final = [uint64]0; $limit = [uint64]0"
- "16"=" $steps = [int]([uint64]([IO.FileInfo]$file).Length / $block - 1); $encoding = [Text.Encoding]::GetEncoding(28591)"
- "17"=" $find1 = $encoding.GetString([Text.Encoding]::Unicode.GetBytes('</INSTALLATIONTYPE>'))"
- "18"=" $find2 = $encoding.GetString([Text.Encoding]::Unicode.GetBytes('</WIM>'))"
- "19"=" $f = new-object IO.FileStream ($file, 3, 1, 1); $p = 0; $p = $f.Seek(0, 2)"
- "20"=" for ($o = 1; $o -le $steps; $o++) { "
- "21"=" $p = $f.Seek(-$block, 1); $r = $f.Read($bytes, 0, $block); if ($r -ne $block) {write-host invalid block $r; break}"
- "22"=" $u = [Text.Encoding]::GetEncoding(28591).GetString($bytes); $t = $u.LastIndexOf($find1, [StringComparison]::Ordinal) "
- "23"=" if ($t -ge 0) {"
- "24"=" $f.Seek(($t -$block), 1) >''"
- "25"=" for ($o = 1; $o -le $block; $o++) { $f.Seek(-2, 1) >''; if ($f.ReadByte() -eq 0xfe) {$begin = $f.Position; break} }"
- "26"=" $limit = $f.Length - $begin; if ($limit -lt $block) {$x = $limit} else {$x = $block}"
- "27"=" $bytes = new-object 'Byte[]' ($x); $r = $f.Read($bytes, 0, $x); "
- "28"=" $u = [Text.Encoding]::GetEncoding(28591).GetString($bytes); $t = $u.IndexOf($find2, [StringComparison]::Ordinal)"
- "29"=" if ($t -ge 0) {$f.Seek(($t + 12 -$x), 1) >''; $final = $f.Position} ; break"
- "30"=" } else { $p = $f.Seek(-$block, 1)} "
- "31"=" }"
- "32"=" if ($begin -gt 0 -and $final -gt $begin) {"
- "33"=" $x = $final - $begin; $f.Seek(-$x, 1) >''; $bytes = new-object 'Byte[]' ($x); $r = $f.Read($bytes, 0, $x)"
- "34"=" if ($r -ne $x) {break}"
- "35"=" [xml]$xml = [Text.Encoding]::Unicode.GetString($bytes); $f.Dispose()"
- "36"=" } else {$f.Dispose()}"
- "37"=" break :info } "
- "38"=" if ($output -eq 0) {$simple = ''; foreach ($i in $xml.WIM.IMAGE) {if ($index -gt 0 -and $($i.INDEX)-ne $index) {continue}"
- "39"=" $simple += \"$($i.INDEX),$($I.WINDOWS.VERSION.BUILD).$($I.WINDOWS.VERSION.SPBUILD),\""
- "40"=" $simple += \"$(('x64','x86')[$I.WINDOWS.ARCH-eq'0']),$($I.WINDOWS.LANGUAGES.LANGUAGE),$($I.WINDOWS.EDITIONID)`r`n\""
- "41"=" } ; return $simple }"
- "42"=" if ($output -eq 1) {[console]::OutputEncoding=[Text.Encoding]::UTF8; $xml.Save([Console]::Out); ''} "
- "43"=" if ($output -eq 2) {return $xml}"
- "44"="}"
- "45"="$host.ui.rawui.windowtitle = 'DISM Info'"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement