I used dism to mount install.wim for Windows 7 Ultimate. I added updates and some drivers. This all goes successful without any issues. I used Index of 1 as the install.wim is Ultimate only after SP1 integration a couple of years ago and has only 1 index now. However, when I try and unmount it and commit the changes, using the command Dism /Unmount-Image /MountDir:F:\WIN7_Mount /Commit I receive an error: 87 stating The unmount-image option is unknown. So I am frustrated and try to find a different way to unmount the image while committing the changes. So I find imagex and run imagex /unmount /commit f:\WIN7_Mount and it appears to have committed the changes and unmounted it successfully. Now the question is, was this an ok thing to do, or will I have problems with the install.wim file. It went through the committing image and then unmounting image processes? AM I ok, or is it bad to use imagex on a .WIM file that was mounted using dism. I only used imagex to unmount it because for whatever stupid reason, dism was fialing to unmount it.
Should be ok. Next time you use dism, run "Dism /Cleanup-Wim" first. Maybe you've got some app installed that's causing this. At one stage I found I needed to close windows explorer for dism to work 100%....
Also, if you have changed permissions for some of the files that are mounted by dism it may not unmount at all, even after running "Dism /Cleanup-Wim".
At that point one must delete the mount folder, then run the cleanup wim. You can't re-mount in that location until after you create a new mount folder (within that same namespace). Forgot to mention, I also throw the discard on my dismounts because I've already committed. See edit above.
Heres my collection of DISM commands for win 8.1 that i refer to. Besdes not being able to edit .esd files, the only 2 things i can't do with dism that i could with imagex is rename the description (i can rename the title, but not description), and export all indexes with a * (afaik you must specify an index). If you can figure out how to export all indexes with 1 command, i will name my first born after your user name Code: title Append-Image | %Dism% /Append-Image /ImageFile:%DestinationWim% /CaptureDir:D:\ /Name:Drive-D title Get-ImageInfo | %Dism% /Get-ImageInfo /ImageFile:%DestinationWim% title Get-ImageInfo VHD | %Dism% /Get-ImageInfo /ImageFile:%~dp0VHD.vhd /Index:1 title List-Image | %Dism% /List-Image /ImageFile:%DestinationWim% /Index:1 title Export-Image | %Dism% /Export-Image /SourceImageFile:%DestinationWim% /SourceIndex:1 /DestinationImageFile:install2.wim title Export-Image | %Dism% /Export-Image /SourceImageFile:%DestinationWim% /SourceIndex:1 /DestinationImageFile:install2.wim /Name:"Windows 8.1 SingleCoreLanguage (x86)" /Compress:max title Mounting index 1 | %Dism% /Mount-Wim /WimFile:%DestinationWim% /index:1 /MountDir:%mount% /Optimize title Mount-Image | %Dism% /Mount-Image /ImageFile:%DestinationWim% /Index:1 /MountDir:%mount% /Optimize title Mount-Image | %Dism% /Mount-Image /ImageFile:%~dp0VHD.vhd /Index:1 /MountDir:%mount% /ReadOnly title Remount-Image | %Dism% /Remount-Image /MountDir:%mount% title MountedImageInfo | %Dism% /Get-MountedImageInfo title Online analyzecomponentstore | %Dism% /online /cleanup-image /analyzecomponentstore title Online Get-Features | %Dism% /Online /English /Get-Features /Format:Table title Online Disable-Feature | %Dism% /Online /Disable-Feature /Featurename:<name> /Remove title Online Add-ProvisionedAppxPackage | %Dism% /Online /Add-ProvisionedAppxPackage /PackagePath:%~dp0App1.appx /SkipLicense title Online Remove-ProvisionedAppxPackage | %Dism% /Online /Remove-ProvisionedAppxPackage /PackageName:microsoft.app1_1.0.0.0_neutral_en-us_ac4zc6fex2zjp title Online Remstartcomponentcleanup | %Dism% /online /cleanup-image /startcomponentcleanup title MountedImageInfo | %Dism% /image:%mount% /Enable-Feature /FeatureName:NetFx3 /All /LimitAccess /Source:%~dp0w81x86\sources\sxs title Add-Package | %Dism% /image:%mount% /Add-Package /Packagepath:msu.msu title Remove-DefaultAppAssociations | %Dism% /image:%mount% /Remove-DefaultAppAssociations title import-DefaultAppAssociations:%~dp0AppAssoc.xml | %Dism% /image:%mount% /import-DefaultAppAssociations:%~dp0AppAssoc.xml title Unmounting commit | %Dism% /Unmount-Wim /MountDir:%mount% /commit title Unmounting Discard | %Dism% /Unmount-Image /MountDir:%mount% /Discard title Cleanup | %Dism% /Cleanup-Mountpoints title Delete-Image | %Dism% /Delete-Image /ImageFile:%DestinationWim% /Index:1 title Append-Image | %Dism% /Append-Image /ImageFile:%DestinationWim% /CaptureDir:D:\ /Name:Drive-D title apply-Image | %Dism% /apply-image /imagefile:%DestinationWim% /index:1 /ApplyDir:D:\ title apply-Image | %Dism% /apply-image /imagefile:install.swm /swmfile:install*.swm /index:1 /applydir:D:\ title Capture+-Image | %Dism% /Capture-Image /ImageFile:%DestinationWim% /CaptureDir:D:\ /Name:Drive-D title Split-Image | %Dism% /Split-Image /ImageFile:%DestinationWim% /SWMFile:install.swm /FileSize:650 And heres my take on the right click wim reg Code: Windows Registry Editor Version 5.00 ;Wims [HKEY_CLASSES_ROOT\.wim\shell] [HKEY_CLASSES_ROOT\.wim\shell\Make Mount Dirs] "MUIVerb"="Make Mount Dir" "Icon"="shell32.dll,-174" [HKEY_CLASSES_ROOT\.wim\shell\Make Mount Dirs\command] @="cmd /c start /b powershell if (!(test-path C:\\Mount -pathtype container)){new-item C:\\Mount -type directory}" [HKEY_CLASSES_ROOT\.wim\shell\1Wim Info DISM] "MUIVerb"="Wim Info (DISM)" "Icon"="winhlp32.exe" [HKEY_CLASSES_ROOT\.wim\shell\1Wim Info DISM\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /Get-WimInfo /WimFile:\"%1\";Write-Host -NoNewLine 'Press any key to continue...';$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');\"" [HKEY_CLASSES_ROOT\.wim\shell\2Wim Info Imagex] "MUIVerb"="Wim Info (Imagex)" "Icon"="%SystemRoot%\\System32\\imagex.exe" [HKEY_CLASSES_ROOT\.wim\shell\2Wim Info Imagex\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\IMAGEX.exe /XML /info \"%1\";Write-Host -NoNewLine 'Press any key to continue...';$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');\"" [HKEY_CLASSES_ROOT\.wim\shell\3Dism Cleanup] "MUIVerb"="@%SystemRoot%\\System32\\Dism\\WimProvider.dll,-1122" "Icon"="shell32.dll,-192" [HKEY_CLASSES_ROOT\.wim\shell\3Dism Cleanup\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /Cleanup-Wim;powershell -command remove-item -path HKLM:\\SOFTWARE\\Microsoft\\WIMMount -recurse;powershell -command remove-item C:\\Mount -recurse;\"" [HKEY_CLASSES_ROOT\.wim\shell\4Unmount Discard] "MUIVerb"="Unmount Discard" "Icon"="shell32.dll,-240" [HKEY_CLASSES_ROOT\.wim\shell\4Unmount Discard\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /unmount-wim /mountdir:C:\\Mount /discard;powershell -command remove-item -path HKLM:\\SOFTWARE\\Microsoft\\WIMMount -recurse;powershell -command remove-item C:\\Mount -recurse;\"" [HKEY_CLASSES_ROOT\.wim\shell\4Unmount and Save] "MUIVerb"="Unmount and Save" "Icon"="shell32.dll,-16761" [HKEY_CLASSES_ROOT\.wim\shell\4Unmount and Save\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /unmount-wim /mountdir:C:\\Mount /commit;powershell -command remove-item -path HKLM:\\SOFTWARE\\Microsoft\\WIMMount -recurse;powershell -command remove-item C:\\Mount -recurse;\"" [HKEY_CLASSES_ROOT\.wim\shell\5Export Wim Index] "MUIVerb"="Export Wim (imagex)" "Icon"="%SystemRoot%\\System32\\imagex.exe" [HKEY_CLASSES_ROOT\.wim\shell\5Export Wim Index\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\IMAGEX.exe /export \"%1\" * \"%1\".wim\"" [HKEY_CLASSES_ROOT\.wim\shell\51Export Wim Index dism] "MUIVerb"="Export Index 1 (dism)" [HKEY_CLASSES_ROOT\.wim\shell\51Export Wim Index dism\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /Export-Image /SourceImageFile:\"%1\" /SourceIndex:1 /DestinationImageFile:\"%1\".wim\" /compress:maximum" [HKEY_CLASSES_ROOT\.wim\shell\52Export Wim Index dism] "MUIVerb"="Export Index 2 (dism)" [HKEY_CLASSES_ROOT\.wim\shell\52Export Wim Index dism\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /Export-Image /SourceImageFile:\"%1\" /SourceIndex:2 /DestinationImageFile:\"%1\".wim\" /compress:maximum" [HKEY_CLASSES_ROOT\.wim\shell\53Export Wim Index dism] "MUIVerb"="Export Index 3 (dism)" [HKEY_CLASSES_ROOT\.wim\shell\53Export Wim Index dism\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /Export-Image /SourceImageFile:\"%1\" /SourceIndex:3 /DestinationImageFile:\"%1\".wim\" /compress:maximum" [HKEY_CLASSES_ROOT\.wim\shell\54Export Wim Index dism] "MUIVerb"="Export Index 4 (dism)" [HKEY_CLASSES_ROOT\.wim\shell\54Export Wim Index dism\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /Export-Image /SourceImageFile:\"%1\" /SourceIndex:4 /DestinationImageFile:\"%1\".wim\" /compress:maximum" [HKEY_CLASSES_ROOT\.wim\shell\55Export Wim Index dism] "MUIVerb"="Export Index 5 (dism)" [HKEY_CLASSES_ROOT\.wim\shell\55Export Wim Index dism\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /Export-Image /SourceImageFile:\"%1\" /SourceIndex:5 /DestinationImageFile:\"%1\".wim\" /compress:maximum" [HKEY_CLASSES_ROOT\.wim\shell\56Export Wim Index dism] "MUIVerb"="Export Index 6 (dism)" [HKEY_CLASSES_ROOT\.wim\shell\56Export Wim Index dism\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /Export-Image /SourceImageFile:\"%1\" /SourceIndex:6 /DestinationImageFile:\"%1\".wim\" /compress:maximum" [HKEY_CLASSES_ROOT\.wim\shell\57Export Wim Index dism] "MUIVerb"="Export Index 7 (dism)" [HKEY_CLASSES_ROOT\.wim\shell\57Export Wim Index dism\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /Export-Image /SourceImageFile:\"%1\" /SourceIndex:7 /DestinationImageFile:\"%1\".wim\" /compress:maximum" [HKEY_CLASSES_ROOT\.wim\shell\58Export Wim Index dism] "MUIVerb"="Export Index 8 (dism)" [HKEY_CLASSES_ROOT\.wim\shell\58Export Wim Index dism\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /Export-Image /SourceImageFile:\"%1\" /SourceIndex:8 /DestinationImageFile:\"%1\".wim\" /compress:maximum" [HKEY_CLASSES_ROOT\.wim\shell\59Export Wim Index dism] "MUIVerb"="Export Index 9 (dism)" [HKEY_CLASSES_ROOT\.wim\shell\59Export Wim Index dism\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /Export-Image /SourceImageFile:\"%1\" /SourceIndex:9 /DestinationImageFile:\"%1\".wim\" /compress:maximum" [HKEY_CLASSES_ROOT\.wim\shell\6Mount Enter Image Index] "MUIVerb"="@%SystemRoot%\\System32\\Dism\\WimProvider.dll,-1105" "Icon"="shell32.dll,-16739" [HKEY_CLASSES_ROOT\.wim\shell\6Mount Enter Image Index\command] @="cmd /c start /wait /b powershell -command \"$WIM_FILE = '\"%1\"';$de = C:\\Windows\\System32\\Dism.exe /get-wiminfo /WimFile:$WIM_FILE;$de = $de[6,11,16,21,26,31,36,41,46,51,56,61,66,71,76];$de = @($de | Where-Object {$_ -ne 'The operation completed successfully.'});$de = $de | Foreach-Object {$_ -replace 'Index :', ''};$de = $de | Foreach-Object {$_ -replace ' ', ''};$de;$ce = C:\\Windows\\System32\\Dism.exe /get-wiminfo /WimFile:$WIM_FILE;$ce = $ce[7,12,17,22,27,32,37,42,47,52,57,62,67,72,77];$ce = @($ce | Where-Object {$_ -ne 'The operation completed successfully.'});$ce = $ce | Foreach-Object {$_ -replace 'Name :', ''};$ce = $ce | Foreach-Object {$_ -replace ' ', ''};$ce = $ce | Foreach-Object {$_ -replace 'WindowsServer', 'Server'};$ce;$ee = ':' , ':',':',':',':',':',':',':',':',':',':',':',':',':',':';$ee[0] = $de[0] + ':' + $ce[0];$ee[1] = $de[1] + ':' + $ce[1];$ee[2] = $de[2] + ':' + $ce[2];$ee[3] = $de[3] + ':' + $ce[3]; $ee[4] = $de[4] + ':' + $ce[4]; $ee[5] = $de[5] + ':' + $ce[5]; $ee[6] = $de[6] + ':' + $ce[6];$ee[7] = $de[7] + ':' + $ce[7]; $ee[8] = $de[8] + ':' + $ce[8];$ee[9] = $de[9] + ':' + $ce[9]; $ee[10] = $de[10] + ':' + $ce[10];$ee[11] = $de[11] + ':' + $ce[11];$ee[12] = $de[12] + ':' + $ce[12];$ee[13] = $de[13] + ':' + $ce[13];$ee[14] = $de[14] + ':' + $ce[14];cls;$ee = @($ee | Where-Object {$_ -ne ':'});$ee;cls;[void][System.Reflection.Assembly]::LoadWithPartialName('Microsoft.VisualBasic');$INDEX = [Microsoft.VisualBasic.Interaction]::InputBox($ee, 'Which image to mount','1');If ($INDEX -eq '') {exit} Else{C:\\Windows\\System32\\Dism.exe /mount-wim /wimfile:$WIM_FILE /index:$INDEX /mountdir:C:\\Mount}";Write-Host -NoNewLine 'Press any key to continue...';$null = $Host.UI.RawUI.ReadKey('NoEcho,IncludeKeyDown');\"" [HKEY_CLASSES_ROOT\.wim\shell\8Add WMC to Win8 Pro] "MUIVerb"="Add WMC to Win8 Pro" "Icon"="shell32.dll,-139" [HKEY_CLASSES_ROOT\.wim\shell\8Add WMC to Win8 Pro\command] @="cmd /c start /b powershell -command \"&C:\\Windows\\System32\\Dism.exe /image:C:\\Mount /Set-Edition:ProfessionalWMC\""
I'm self taught with any coding i understand, and most of the time i download existing code, and look for patterns and paths i can edit. After i do that a few times, i find myself understanding the flow of the particular language. Its like how in high school they used to teach latin to understand the basis for English words. Once you know Dos, most code has a similar feel, and i pick it up as i find necessary. As for the code you quoted, i could of very well written it, but don't remember doing it. The basis and idea was 100% from the link you referred to, but knowing me, i changed it to suit my needs\paths. I'll admit, i find powershell tedious and confusing, and particularly hate how long some lines of code go on for.