Dism?

Discussion in 'Scripting' started by timesurfer, Nov 11, 2013.

  1. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,068
    270
    Once upon a time MD and I used DISM code to make it so that user would not have to go into RE to enter logon info, open cmd prompt and enter C:IR7

    The RE image would be mounted with all the necessary info then close and restart

    It took like 10 minutes or so or it would have been good good idea

    Are there any ideas on how to speed up that process for the install part of IR7?

    Thanks
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  2. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,773
    1,085
    60
    Catch me up to speed, does RE = WinRE.wim recovery environment ?
     
  3. Tito

    Tito Super Mod / Adviser
    Staff Member

    Nov 30, 2009
    17,574
    15,383
    340
    Yep, thats right.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  4. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,773
    1,085
    60
  5. ricktendo64

    ricktendo64 MDL Expert

    Apr 20, 2008
    1,345
    1,934
    60
    Disable your anti virus could help
     
  6. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,068
    270
    Hey MJ :)

    Thanks

    Actually I don't have the code anymore and MD never put it up on my IR4/5 thread cause he said it could cause damage if not used properly or something
    I was just trying to talk about the different type of install where we didn't have to go into RE manually and wanted your thoughts regarding mounting RE with already programmed logon and cmd line stuff

    The code MD did was pretty cool and worked great just took like 10 minutes to mount the RE image and do it's thing but the install was completely automatic

    I only brought up this conversation because my 4 year long develpment has come to a close and had only two more ideas to make it better, this being one and the other was the WPA key delete inside windows, otherwise I am all out of my original concepts for my W7 rearm concept
    lol...What are you talking about :eek:...lol

    My rearm concept (.cmd) never flags my AV with DL or install :p...lol
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  7. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,773
    1,085
    60
    #7 Mr Jinje, Nov 16, 2013
    Last edited: Nov 16, 2013
  8. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,068
    270
    Ok :eek: then maybe I should just figure out how to do the WPA key delete inside windows if the DISM couldn't be somehow used to benefit RW

    But thanks for implying that I'm as good at computers as that guy ;)

    I just sleep and have dreams with concepts for RW and am little clever and could never take down the world powers via computer tech

    But maybe my earth wizard self might :yoda:

    Thanks though for your concern, however I'm "covered up" which in the Quran means either cloaked or on drugs :shisha:...lol

    I'll let you choose what it means and thanks for all your help and replies

    They have made me very happy

    "Hard to see the dark side is" :sith:

    "Except for one person who surfs time and rides that biggest wave, the galactic wave with all it's star systems and planets within and this person can sit in the eye of the hurricane and where darkness has sat "previously" but no longer and the amnesia of God is cleared and this tiny planet is returned to the grace that is it's origins or it's force" :sith:

    Funny how Senator Palpatine hid as good person but was really evil but funnier the one who hides as bad but is the most good :applause:

    p.s. We really need a Luke Skywalker and Obi one Kanobi smiley here at MDL :p

    p.s.s. Not everyone who works for the NSA/Interpole/CIA is evil, sometimes there is one who is commanded to protect a person like me...

    lol
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  9. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,256
    670
    60
    #9 MasterDisaster, Nov 17, 2013
    Last edited by a moderator: Apr 20, 2017
    Try this ninja version:eekout:
    Save it as rearm.bat and run as Administrator.
    Code:
    @echo off
    echo Rearm For Windows Automated Version
    echo Preparing your computer....
    for /f "tokens=2 delims=:" %%A in ('reagentc /info ^| find "BCD"') do set dir=%%A
    set recoveryDir=C:\Recovery\%dir: =%
    SET mountDir=C:\Mount
    SET rearmDir=C:\Rearm
    rmdir /s /q %mountDir% >NUL 2>&1
    rmdir /s /q %rearmDir% >NUL 2>&1
    mkdir %mountDir%
    mkdir %rearmDir%
    attrib +h +s %mountDir%
    attrib +h +s %rearmDir%
    xcopy /cheriky %recoveryDir%\*.wim %rearmDir%\ >NUL 2>&1
    echo Do or do not... there is no try
    dism /Mount-Wim /MountDir:%mountDir% /WimFile:%rearmDir%\WinRE.wim /index:1 >NUL 2>&1
    set winpeshl=%mountDir%\Windows\System32\winpeshl.ini
    attrib -r %winpeshl%
    echo [LaunchApp]>%winpeshl%
    echo AppPath=X:\reset.bat>>%winpeshl%
    attrib +r %winpeshl%
    REG QUERY "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion" /v CurrentVersion | FINDSTR 6.1 >NUL
    IF ERRORLEVEL 1 echo Supports Windows 7 and Server 2008 R2 only & goto end
    REG ADD "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\SoftwareProtectionPlatform\Activation" /v NotificationDisabled /t REG_DWORD /d 1 /f >NUL
    echo edition = CreateObject("WScript.Shell").RegRead("HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\EditionID") >key.vbs
    echo Set keys = CreateObject ("Scripting.Dictionary") >>key.vbs
    echo keys.Add "Enterprise",                     "H7X92-3VPBB-Q799D-Y6JJ3-86WC6" >>key.vbs
    echo keys.Add "EnterpriseE",                    "H3V6Q-JKQJG-GKVK3-FDDRF-TCKVR" >>key.vbs
    echo keys.Add "EnterpriseN",                    "BQ4TH-BWRRY-424Y9-7PQX2-B4WBD" >>key.vbs
    echo keys.Add "HomeBasic",                      "YGFVB-QTFXQ-3H233-PTWTJ-YRYRV" >>key.vbs
    echo keys.Add "HomeBasicE",                     "VTKM9-74GQY-K3W94-47DHV-FTXJY" >>key.vbs
    echo keys.Add "HomeBasicN",                     "MD83G-H98CG-DXPYQ-Q8GCR-HM8X2" >>key.vbs
    echo keys.Add "HomePremium",                    "RHPQ2-RMFJH-74XYM-BH4JX-XM76F" >>key.vbs
    echo keys.Add "HomePremiumE",                   "76BRM-9Q4K3-QDJ48-FH4F3-9WT2R" >>key.vbs
    echo keys.Add "HomePremiumN",                   "D3PVQ-V7M4J-9Q9K3-GG4K3-F99JM" >>key.vbs
    echo keys.Add "Professional",                   "HYF8J-CVRMY-CM74G-RPHKF-PW487" >>key.vbs
    echo keys.Add "ProfessionalE",                  "3YHKG-DVQ27-RYRBX-JMPVM-WG38T" >>key.vbs
    echo keys.Add "ProfessionalN",                  "BKFRB-RTCT3-9HW44-FX3X8-M48M6" >>key.vbs
    echo keys.Add "ServerDatacenter",               "7X29B-RDCR7-J6R29-K27FF-H9CR9" >>key.vbs
    echo keys.Add "ServerDatacenterCore",           "7X29B-RDCR7-J6R29-K27FF-H9CR9" >>key.vbs
    echo keys.Add "ServerEmbeddedSolution",         "M2KD2-F2333-Q3TJ8-BQMHX-9PWX6" >>key.vbs
    echo keys.Add "ServerEmbeddedSolutionCore",     "M2KD2-F2333-Q3TJ8-BQMHX-9PWX6" >>key.vbs
    echo keys.Add "ServerEnterprise",               "7P8GH-FV2FF-8FDCR-YK49D-D7P97" >>key.vbs
    echo keys.Add "ServerEnterpriseCore",           "7P8GH-FV2FF-8FDCR-YK49D-D7P97" >>key.vbs
    echo keys.Add "ServerEnterpriseIA64",           "7YKJ4-CX8QP-Q23QY-7BYQM-H2893" >>key.vbs
    echo keys.Add "ServerEssentialAdditional",      "7PDBG-28HK4-276G6-XVJF4-KH9Y4" >>key.vbs
    echo keys.Add "ServerEssentialAdditionalSvc",   "RCDPD-97Q7B-MRDC3-GTRYF-MCD6G" >>key.vbs
    echo keys.Add "ServerEssentialManagement",      "4F37J-4YTKY-6DFDJ-FDRFY-2HT34" >>key.vbs
    echo keys.Add "ServerEssentialManagementSvc",   "4HFV2-KB9P6-TQVJF-87D8X-2YYBF" >>key.vbs
    echo keys.Add "ServerForSBSolutions",           "PHYFD-HQ4XW-78PR4-2CXKF-V67KJ" >>key.vbs
    echo keys.Add "ServerForSBSolutionsEM",         "JR4Y2-WC84X-PBRDJ-QTBTB-TQGGH" >>key.vbs
    echo keys.Add "ServerHomePremium",              "4BWDV-9MKGX-V9QJ4-YWFWR-P6974" >>key.vbs
    echo keys.Add "ServerHomeStandard",             "MCQYD-2TJYQ-JP7KR-7GYYF-YGPXQ" >>key.vbs
    echo keys.Add "ServerHPC",                      "Q7PRR-M2WBM-RJJ99-FG393-MGY3B" >>key.vbs
    echo keys.Add "ServerHyperCore",                "Q8R8C-T2W6H-7MGPB-4CQ9R-KR36H" >>key.vbs
    echo keys.Add "ServerMediumBusinessManagement", "FD499-FD79G-V9D2W-F9WQ6-MD2VC" >>key.vbs
    echo keys.Add "ServerMediumBusinessMessaging",  "YVYC7-KVQ8G-XF6K4-9MG8M-QXFC2" >>key.vbs
    echo keys.Add "ServerMediumBusinessSecurity",   "YQ3V7-79DM4-42PVW-BYRH8-69VXK" >>key.vbs
    echo keys.Add "ServerSBSPremium",               "BXQQP-Q6Q6D-TR7TR-3YXQW-VFHKM" >>key.vbs
    echo keys.Add "ServerSBSPremiumCore",           "BXQQP-Q6Q6D-TR7TR-3YXQW-VFHKM" >>key.vbs
    echo keys.Add "ServerSBSStandard",              "YMFM8-J2RV2-66G78-XPQ7C-4RY3B" >>key.vbs
    echo keys.Add "ServerSolution",                 "Y7GVM-YFQQW-HV8HW-GRW6D-YJ84M" >>key.vbs
    echo keys.Add "ServerSolutionEM",               "WF9T8-VT7D2-GD629-WTKGH-3WBJT" >>key.vbs
    echo keys.Add "ServerSolutionsPremium",         "4TMY4-8JG4B-VKY8X-6TVDH-J7XFV" >>key.vbs
    echo keys.Add "ServerSolutionsPremiumCore",     "4TMY4-8JG4B-VKY8X-6TVDH-J7XFV" >>key.vbs
    echo keys.Add "ServerStandard",                 "HMG6P-C7VGP-47GJ9-TWBD4-2YYCD" >>key.vbs
    echo keys.Add "ServerStandardCore",             "HMG6P-C7VGP-47GJ9-TWBD4-2YYCD" >>key.vbs
    echo keys.Add "ServerWeb",                      "YGTGP-9XH8D-8BVGY-BVK4V-3CPRF" >>key.vbs
    echo keys.Add "ServerWebCore",                  "YGTGP-9XH8D-8BVGY-BVK4V-3CPRF" >>key.vbs
    echo keys.Add "ServerWinFoundation",            "36RXV-4Y4PJ-B7DWH-XY4VW-KQXDQ" >>key.vbs
    echo keys.Add "ServerWinSB",                    "JG43G-CMPHG-VPBC6-9TDQR-RRFJ4" >>key.vbs
    echo keys.Add "ServerWinSBV",                   "WQG3Q-VWT72-VX39Q-VRTRD-2RF7K" >>key.vbs
    echo keys.Add "Starter",                        "7Q28W-FT9PC-CMMYT-WHMY2-89M6G" >>key.vbs
    echo keys.Add "StarterE",                       "BRQCV-K7HGQ-CKXP6-2XP7K-F233B" >>key.vbs
    echo keys.Add "StarterN",                       "D4C3G-38HGY-HGQCV-QCWR8-97FFR" >>key.vbs
    echo keys.Add "Ultimate",                       "D4F6K-QK3RD-TMVMJ-BBMRX-3MBMV" >>key.vbs
    echo keys.Add "UltimateE",                      "TWMF7-M387V-XKW4Y-PVQQD-RK7C8" >>key.vbs
    echo keys.Add "UltimateN",                      "HTJK6-DXX8T-TVCR6-KDG67-97J8Q" >>key.vbs
    echo if keys.Exists(edition) then >>key.vbs
    echo WScript.Echo keys.Item(edition) >>key.vbs
    echo End If >>key.vbs
    FOR /F %%A in ('cscript /nologo key.vbs') do SET PIDKEY=%%A 
    del key.vbs
    SET file=%mountDir%\reset.bat
    for /f "tokens=2 delims==" %%A in ('"wmic logicaldisk where Name="%systemdrive%" get VolumeSerialNumber /format:list"')do set sn=%%A
    echo @echo off>%file%
    echo for /f "tokens=2 delims==" %%%%A IN ('"wmic logicaldisk where VolumeSerialNumber="%sn%" get Name /format:list"') do set dl=%%%%A>>%file%
    echo reg load HKLM\MY_SYSTEM "%%dl%%\Windows\System32\config\system"^>NUL >>%file%
    echo reg delete HKLM\MY_SYSTEM\WPA /f^>NUL >>%file%
    echo reg unload HKLM\MY_SYSTEM^>NUL>>%file%
    echo echo del "C:\key.vbs" ^>%%dl%%\installkey.bat >>%file%
    echo echo cscript /b slmgr.vbs /ipk %PIDKEY%^>^>%%dl%%\installkey.bat >>%file%
    echo echo slmgr.vbs /dli^>^>%%dl%%\installkey.bat>>%file%
    echo echo reagentc /disable^>^>%%dl%%\installkey.bat>>%file%
    echo echo reagentc /setreimage /path %windir%\System32\Recovery /target %windir%^>^>%%dl%%\installkey.bat>>%file%
    echo echo reagentc /enable^>^>%%dl%%\installkey.bat>>%file%
    echo echo rmdir /s /q %rearmDir%^>^>%%dl%%\installkey.bat>>%file%
    echo echo del /A "C:\installkey.bat"^>^>%%dl%%\installkey.bat>>%file%
    echo attrib +h +s %%dl%%\installkey.bat>>%file%
    echo echo CreateObject("WScript.Shell").Run """C:\installkey.bat""", 0, False^>%%dl%%\key.vbs >>%file%
    echo reg load HKLM\MY_SOFTWARE "%%dl%%\Windows\System32\config\software" ^>NUL >>%file% 
    echo reg add HKLM\MY_SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnce /v InstallKey /t REG_SZ /d C:\key.vbs ^>NUL >>%file%
    echo reg unload HKLM\MY_SOFTWARE >>%file%
    echo wpeutil reboot >>%file%
    echo Patience young padwan, May the force be with you
    dism /Commit-Wim /MountDir:%mountDir%>NUL 2>&1
    echo Soon will I rest, yes, forever sleep. Earned it I have. Twilight is upon me, soon night must fall
    dism /Unmount-Wim /MountDir:%mountDir% /commit>NUL 2>&1
    rmdir /s /q %mountDir%
    reagentc /disable>NUL 2>&1
    reagentc /setreimage /path %rearmDir% /target C:\Windows>NUL 2>&1
    reagentc /enable>NUL 2>&1
    reagentc /boottore>NUL 2>&1
    shutdown /r /t 0
    :end
    exit
    
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  10. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,068
    270
    #10 timesurfer, Nov 18, 2013
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Thank you my friend and rearm ninja :ninjastar:

    What is your complete install "time" with this...lol

    Note: I also had the idea to do reinstall/uninstall at day 180 with windows yes/no msg box so if I provide an automated install RW we'll have to do the write to IR7.bat that sits inside Trial/IR7 folder :suicide:

    Will try in a few hours :worthy:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  11. MasterDisaster

    MasterDisaster MDL Expert

    Aug 29, 2009
    1,256
    670
    60
    #11 MasterDisaster, Nov 18, 2013
    Last edited: Nov 19, 2013
    It takes around 3-4 minutes from start to finish.

    Code is updated, copy the latest version and try.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  12. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,068
    270
    #12 timesurfer, Nov 19, 2013
    Last edited: Nov 19, 2013
    (OP)
    :eek: That is shorter or same time as RE install

    Thanks, going to test right now

    Wow :worthy: RW is becoming really cool with these last 13-14 changes that have happened since Trilogy 4.2

    TS :hug2: MD
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  13. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,068
    270
    Hey MD, test "time" for me was about 10 minutes, maybe a little over 10 minutes on my 1GB computer :suicide:...lol

    I wish the mount "time" for RE DISM was shorter cause it's nice to have it automated but if it's this long then I think most will not like it

    If you have better idea's I'd like to see them but I'm going to explore how to delete WPA key inside windows otherwise I've done the best I can with RW

    Thanks

    TS
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  14. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,068
    270
    #14 timesurfer, Nov 21, 2013
    Last edited: Nov 21, 2013
    (OP)
    Since we're narrowing down any last concepts that would perfect my Rearm Concept we're dealing with two variables:

    1. Quicker DISM concept of automatic IR7install/reinstall

    or ideally

    2. Somehow delete the WPA reg key inside windows and if possible without having to install trial key

    So isn't there someway to have an batch file at boot run before the services that would block it running so that the key could be deleted and self-restore to 5 rearms?

    A run once or BCD entry of some kind

    Wanting to close shop on RW and implement master/final code support so as usual am asking out loud as to bring this development to a close :suicide:

    TS

    :shisha:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  15. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,773
    1,085
    60
    I don't think DISM is the culrpit, maybe the real issue (10 minute mount time) is caused by your hardware and not the script. That explains why it only takes 3-4 minutes on MD's newer machine, but much longer on your older CPU. I'm assuming it's the compressing / decompressing of the wim taking so long.

    Easy way to check would be to export an winre.wim to a new .wim container using the 'None' compression option in imagex, then seeing if the script doesn't run much faster on your old machine.
     
  16. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,068
    270
    #16 timesurfer, Nov 21, 2013
    Last edited: Nov 21, 2013
    (OP)
    In DISM :sith: not being sought into the realm of "culprit" I consciously expect "slower" models to be slower but given that there is an average amongst "hardware" not the brilliant MD auto code

    I think my conclusion 3 years ago that given MD's extreme communication to automate the rearm concept install a.k.a. IR7 install it was indeed the compressing / decompressing of the wim

    Like I posted somewhere recently, I would have to write this into the reinstall/uninstall code at 180 days and to would be happy to provide an alternative "longer taking" IR7 link, hence there would be two DL links that would be as follows:

    1. Manual IR7 installer/reinstaller
    2. Automatic IR7 installer/reinstaller

    Would love to try using the 'None' compression option in imagex if you can give me step by step testing instructions

    :shisha:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  17. Mr Jinje

    Mr Jinje MDL Expert

    Aug 19, 2009
    1,773
    1,085
    60
    #17 Mr Jinje, Nov 21, 2013
    Last edited: Nov 21, 2013
    Step 1) Get http://www.autoitscript.com/site/autoit-tools/gimagex/
    Step 2) Open it and go to Export Tab
    Step 3) Set source and destination wim (via Browse button)
    Step 4) Under destination, change the default "Compression" from 'Fast' to 'None' via the drop down list.
    Step 5) Export Button ???

    If I am not mistaken, W7 DISM is single process limited and maxes out at 25% on my quad core. So maybe a slower CPU core (amd vs intel) would yield different mount times on the same file.
     
  18. Stannieman

    Stannieman MDL Guru

    Sep 4, 2009
    2,232
    1,800
    90
    There are 2 things that affect dism's performance.
    1. AV, MSE for example realtime monitors all files that are created. And since extracting a wim isn't copying, but dism that's "creating" files, it checks all those files. Adding an exception for dism.exe increases performance a lot.

    2. There are 2 ways of mounting. The old way is just extracting all the files, it keeps what files you change and then when repacking it only recompresses the changed files.
    The newer way is that no files are really extracted but a link to them is shown in explorer. Like a symlink that links to inside a wim file. When you try to open/edit a file it's extracted on the fly. This means that there's only diskIO for files you actually use. In combination with point 1 this is a double preformance gain, as only used files are scanned. Now I noticed that the win 8.x versions of dism take longer to mount that the win7 version, so maybe it doesn't use the link method always anymore.

    The things in point 2 might not be fully correct (like symlink points etc), but this is roughly how it works.
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  19. timesurfer

    timesurfer MDL Developer

    Nov 22, 2009
    8,527
    4,068
    270
    This is the exact post I needed. Thanks

    I know that DISM gets mounted with pre-installed info like logon info and cmd prompt stuff so I was wondering what would be better way to add the logon and cmd stuff to speed up the process otherwise I appreciate everyone's help with this second to final idea for RW

    :shisha:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  20. Stannieman

    Stannieman MDL Guru

    Sep 4, 2009
    2,232
    1,800
    90
    What do you actually want to make?
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...