Git Product home page Git Product logo

mediacreationtool.bat's Introduction

Not just an Universal MediaCreationTool wrapper script with ingenious support for business editions,

A powerful yet simple windows 10 / 11 deployment automation tool as well!
If you had no success launching the script so far, this latest version will work

Presets

1 Auto Upgrade with detected media, script assists setupprep for upgrading directly

- can keep files and apps on more scenarios where os and target edition does not match
- can switch detected edition by adding EditionID to script name
- can troubleshoot upgrade failing by adding no_update to script name
- auto defaults to 11, so pass version as well for 10: auto 21H2 MediaCreationTool.bat

2 Auto ISO with detected media in current folder directly (or C:\ESD if run from zip)

- can override detected media by adding edition name / language / arch to script name
- example: 21H1 Education en-US x86 iso MediaCreationTool.bat

3 Auto USB with detected media in specified usb target

- for data safety, this is not fully automated - must select the usb drive manually in GUI

4 Select with user picked Edition, Language, Arch (x86,x64,both) - on specified target

- implicit choice, includes setup override files (disable by adding def to script name)

5 MCT Defaults runs unassisted, creating media without script modification

- no added files, script passes products.xml to MCT and quits without touching media

1-4 presets will modify created media in the following ways:

- write auto.cmd to run on demand for auto upgrade with edition switch and skip tpm
- write $ISO$ folder content (if it exists) at the root of the media
if you previously used $OEM$ content, must now place it in $ISO$\sources\$OEM$\
- write sources\PID.txt to preselect edition at media boot or within windows (if configured)
- write sources\EI.cfg to prevent product key prompt on Windows 11 consumer media (11 only)
- write AutoUnattend.xml in boot.wim to enable local account on Windows 11 Home (11 only)
- patch winsetup.dll in boot.wim to remove windows 11 setup checks when booting from media (11 only)
- can disable by adding def to script name for a default, untouched MCT media

Simple deployment

auto.cmd is behind Auto Upgrade preset via GUI
Can run it fully unnatended by renaming script with auto MediaCreationTool.bat
Makes it easy to upgrade keeping files and apps when the OS edition does not match the media
Should allow upgrade from Ultimate, PosReady, Embedded, LTSC or Enterprise Eval as well

Generated script is added to the created media so you can run it again at any time
It is fairly generic - it will detect available editions in install.esd, pick a suitable index,
then set EditionID in the registry to match; can even force another edition, keeping files and apps!
On 11, it will try to skip setup checks (can disable this behavior with script var)
Finally, it sets recommended setup options with least amount of issues on upgrades

Let's say the current OS is Enterprise LTSC 2019, and you use the business media to upgrade:
auto.cmd selects Enterprise index and adjust EditionID to Enterprise in the registry (backed up as EditionID_undo)
Maybe you also want to switch edition,
ex. by renaming the script to ProfessionalWorkstation MediaCreationTool.bat:
auto.cmd selects Professional index and sets EditionID to ProfessionalWorkstation in the registry.

Let's say the OS is Windows 7 Ultimate or PosReady, and you use the consumer media to upgrade:
auto.cmd selects Professional index, and sets EditionID to Professional or Enterprise, respectively.
In all cases, the script tries to pick an existing index, else a compatible one to keep files and apps on upgrade.

Let's say you have a dozen PCs spread with versions: 7, 8.1, 10 and editions: Ultimate, Home, Enterprise LTSB..
If you need to upgrade all to the latest 10 version and only use Pro, you could rename the script as:
auto 21H2 Pro MediaCreationTool.bat

Can even add a VL / MAK / retail product key in the same way to take care of licensing differences.
The script also picks up any $ISO$ folder in the current location - for $OEM$ branding, configuration, tweaks etc.

Changelog

No need to right-click Run as Admin, script will ask itself. Directly saving the Raw files no longer breaks line endings
We did it! We broke the previous gist ;) So this is the new home. Thank you all!

discuss on MDL

2018.10.10: reinstated 1809 [RS5]! using native xml patching for products.xml; fixed syntax bug with exit/b
2018.10.12: added data loss warning for RS5
2018.11.13: RS5 is officially back! + greatly improved choices dialog - feel free to use the small snippet in your own scripts
2019.05.22: 1903 [19H1]
2019.07.11: 1903 __release_svc_refresh__ and enable DynamicUpdate by default to grab latest CU
2019.09.29: UPDATED 19H1 build 18362.356 ; RS5 build 17763.379 and show build number
            added LATEST MCT choice to dinamically download the current version (all others have hard-coded links)
2019.11.16: 19H2 18363.418 as default choice (updated hard-coded links)
2020.02.29: 19H2 18363.592
2020.05.28: 2004 19041.264 first release
2020.10.29: 20H2 and aniversary script refactoring to support all MCT versions from 1507 to 20H2!!!
2020.10.30: hotfix utf-8, enterprise on 1909+
2020.11.01: fix remove unsupported options in older versions code breaking when path has spaces.. pff
2020.11.14: generate latest links for 1909,2004; all xml editing now in one go; resolved known cannot run script issues
2020.11.15: one-time clear of cached MCT, as script generates proper 1.0 catalog for 1507,1511,1703 since last update
            fixed compatibility with naked windows 7 powershell 2.0 / IPv6 / optional import $OEM$ / 1803+ business typo
            updated executables links for 1903 and 2004
2020.11.17: parse first commandline parameter as version, example: MediaCreationTool.bat 1909
2020.12.01: attempt to fix reported issues with 1703; no other changes (skipping 19042.630 leaked esd because it is broken)
2020.12.11: 20H2 19042.631; fixed pesky 1703 decryption bug on dual x86 + x64; improved cleanup; label includes version
2021.03.20: pre-release 21H1; optional auto upgrade or create media presets importing $OEM$ folder and key as PID.txt
2021.05.23: 21H1 release; enhanced script name args parsing, upgrade from embedded, auto.cmd / PID.txt / $OEM$ import
2021.06.06: create iso directly; enhanced dialogs; args from script name or commandline; refactoring is complete!
2021.08.04: done fiddling
2021.09.03: 21H2, both 10 and 11 [unreleased]
2021.09.25: Windows 11
            with Skip TPM Check on media boot as well as on dynamic update (standalone toggle script available)
            final touches for improved script reliability; enhanced auto upgrade preset; win 7 powershell 2.0 compatible
2021.09.30: fix Auto Setup preset not launching.. automatically
2021.10.04: fix for long standing tr localization quirks; Skip TPM Check v2 (ifeo-based instead of wmi)
2021.10.05: 11 22000.194 Release (rofl W11 MCT has limited capabilities, so still using 21H1 MCT because it works fine)
2021.10.09: outstanding refactoring around Windows 11 MCT; minimize while waiting MCT; unified 7 - 11 appearence
2021.10.20: create generic iso if no edition arg; use Downloads folder; no 11 setup checks on boot in VirtualBox; fixes #2
2021.10.23: 11 22000.258
            more intuitive presets; 11 setup override via AutoUnattend.xml or via boot.wim (for VirtualBox 5.x) with FIX arg
            only reliable ui automation; enhanced script output
2021.11.03: multiple download methods; improved automation; improved auto.cmd; moved autounattend.xml to boot.wim
            revising 11 setup bypass (wip) - not being content with any methods is the reason why I've not updated in a while
2021.11.09: skip windows 11 upgrade checks with setup.exe (not just auto.cmd); no server label; local account on 11 home
            auto.cmd has more fixes to keep files and apps on upgrade; reliable ui automation; alternative downloaders 
2021.11.15: 11 22000.318
            write output to script folder (or C:\ESD if run from zip); style: more consistent separation of arguments
            20H2 builds with esd size above 4GB that had to be reverted at 19042.631: en,de,es,pt,fr,it,jp,zh (MCT limits)
2021.11.16: 10 19044.1288 - official release of 10 21H2
            10 19043.1348 - newest 10 build - don't ask why ms is releasing these as such, it's not the first time
2021.12.07: skip windows 11 upgrade checks only via auto.cmd - just ignore server label, please
2021.12.15: fix regression with 1507-1709 not getting the correct fallback esd; fix dev '-noe' not autoclosing script
2021.12.22: improved auto.cmd handling of mismatched OS and target edition, obey 'def', 'auto' upgrades 7 to 10, not 11
2022.03.16: prevent launch errors when run from non-canonical paths; USBLayout progress; pickup $ISO$ dir to add on media
            DU in 11: auto installs 22000.556 atm; older skip_11_checks, without Server label; Home offline local account
2022.03.18: fix regression with Auto Upgrade; removed powershell -nop arg (issue #41); enhanced 11 AutoUnattend.xml
2022.03.20: stable - all issues ironed out; improved script ui; upgrade keeping files from Eval editions too
            last squash I promise ;)

mediacreationtool.bat's People

Contributors

aveyo avatar betabrainz avatar lzw29107 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

mediacreationtool.bat's Issues

Help!! Error

After the download for windows 11 is complete, it goes into a blue screen to install, then the PC restarts. it reaches 30s, then it restarts again, then it reaches 40s then the whole PC shuts down fully!!
After I boot manually, I get this error from windows upgrade
"we couldn't install windows 11 0xc1900101 - 0x30018"

Before i raised an issue, i tried everything on this page to make sure i tried my best.
https://softwaretested.com/windows/windows-10-error-code-0xc1900101-0x30018/

Please guide me

Rolling back

Hello.
I was able to install Windows 11 but setup restarted after finish and when it restarted it rolled back at black, opening screen. And tadaa... Windows 10, again with an error which cant remember about it but something "start up" i guess... Any fix or hints or advice?

Lines 51 & 55 set command not correct

Original
set/a dV=14
set/a dP=4

Corrected
set /a dV=14
set /a dP=4

I could not get the script to run for me after latest update. So i changed those 2 lines and its working.

Am i correct in that was causing issues?

Saving ISO Files in C:/ESD

@AveYo
Can you please tell me a way I can make this script use the C:\ESD folder instead of the downloads folder, they way it did earlier.

I want it to store everything (the MCT Folder, the shortcut to download the latest version of the tool and the ISO File) in the ESD folder.
Thanks.

Feature request: Addition of LTSC ISOs to the tool

As the title says, it would be nice to have access to the LTSC versions of the Windows ISOs.
This could be added as a separate argument the user can edit in the MediaCreationTool.bat.

Since not all Windows versions come with an LTSC counterpart, maybe it would be wise to add a "(LTSC available)" note to those who do.

Also, if the user sets the set LTSC = True tag, it should be verified only if the set MCT=XXXX tag is that of a supported version:

  • set LTSC = True and set MCT=21H2 is a valid option
  • set LTSC = True and set MCT=20H1 isn't a valid option

Forgive me if this is already a feature, or something that can't be implemented.

Programme fails to complete

When launching the .bat file, the programme gets to about here and then I get a message pop up on the screen.
image
The .bat file screen then disappears and does not return.

image
Whatever button I click on the pop-up, the pop-up disappears but nothing else happens.

I've deleted all the files I can find related to this tool and downloaded a fresh copy but the same thing happens so I must be missing something.

The first time I ran this tool I got past this stage and was able to select Windows 11 and then the Create ISO option but it got to a point and then stopped. Unfortunately I didn't take a screenshot.
When it stopped the first time around, I got a pop-up from my anti-virus software so I think it might have done something but cannot be certain. Do you have any ideas on how to fix this?

Appreciate your time and effort in producing this tool.

Maybe a stupid question

Good day to you sir, my question is how to download the latest MediaCreationTool.bat
2021/12/22 ?

Best rgards

20H2 Download Validation Issues

Error codes 0x8007000D - 0x90002 in Microsoft MCT when validating ISO download for 20H2. Running the following command to generate:

MediaCreationTool.bat ISO 20H2 Pro

Could you update the build version of Windows 10 21H2?

Hello, according to the news from microsoft, the final release version of Windows 10 21H2 will be Build 19044.1288. The version of Windows 10 21H2 in script is a little old. Could you update the version to Build 19044.1288 in the script?

TPM bypass not working.

My laptop does not have a TPM (v1 or v2), secure boot is enabled by default and cannot be disabled inside BIOS.
Did the following:

  1. run the batch script
  2. selected 11 -> Select in MCT
  3. followed MCT step by step, created ISO file

Then I mount the created ISO and run setup.exe (to upgrade), but setup says need TPM 2.0 and cannot continue.

Older script to clear TPM keys in Windows 10

Could You be so nice and send me ([email protected]) a script written around 5th of Oct 21 to clear all TPM keys. I have an issue with computer (I have WOW6432Node malware) and this helped me to remove some hidden traces (my whole network is infected and this is for another computer).
There were only 4 or 5 commands that I copied in command prompt and they did the magic (the computer needed restart) and yes thank You in advance, sincerely, Grega Leskovšek from Slovenia

what do you want me to do with that? I'm in short supply of crystal balls these days..

what do you want me to do with that? I'm in short supply of crystal balls these days..
get a qr scan app for your phone and scan it, it will direct you to a microsoft support link
because if that's an windows setup error - it has nothing to do with this script, your problem is elsewhere
I can only blindly suggest you run a in-place repair with your current windows 10 version

Originally posted by @AveYo in #62 (comment)

cannot open the MediaCreationTool.bat

Thanks for the author!
but I have some problem in running this bat.
Neither I double click or run as Admin, the cmd window just show and auto close immediately.
Should I install something like net.framework before running this?

new TPM check

In 22509, the new file
C:$WINDOWS.~BT\Sources\Panther\Appraiser_Data.ini
was checked.

Latest build is creating a different installer that seems to break in-place upgrade

As of the latest commit, it seems that the MCT is creating a slightly different ISO. The setup.exe from this ISO launches full screen, and doesn't provide any options to upgrade to Windows 11, it asks you to select an edition, and then a drive/partition to install to, similar to when you boot from the installer. No option is given to keep files/apps.

I confirmed that the previous commit from 10/20 does not have this issue, I was able to run it and the MCT created an ISO that worked without issue for an upgrade.

Installing didn't start

When I start bat file , starts cmd, next powershell , and process end, what I can do with it ?

sorry for errors*

Windows 10 21H1 ISO file size difference

Hey,

So, I was looking to download the Windows 10 21H1 ISO and back when it was the latest version available the normal MCT generated ISO used to weigh up to about 4.29GB whereas the 21H1 ISO downloaded from MCT through your script is about 4.38GB, why is that?

Thanks,
Regards

Localization

The script fails during the 'generate_No_11_Setup_Checks_on_Boot_cmd' phase on windows systems where the name of the local 'administrators' group is localized (like 'administradores' on spanish windows versions).
Specifically the script fails with an exception on the line that reads:

set c1= $b = [System.IO.File]::ReadAllBytes('winsetup.dll'); $h = [System.BitConverter]::ToString($b)-replace'-'

modifying the previous line that reads:

pushd %BOOT%\sources & takeown /f winsetup.dll /a >nul & icacls winsetup.dll /grant administrators:f >nul

changing 'administrators' to match the name of the correct local administrators group fixes the problem.
Probably using something like:

([System.Security.Principal.SecurityIdentifier]'S-1-5-32-544').Translate( [System.Security.Principal.NTAccount]).Value

to obtain the localized name of the administrators group would provide a more general solution.

Feature Request

Windows 11 (Dev Channel) attempted to update (through Windows update) and failed due to it being an unsupported PC. I then ran Skip_TPM_Check_on_Dynamic_Update_v4.cmd, rebooted, and attempted to update again, but the update failed the same way.

To fix the issue, I deleted the $WINDOWS.~BT folder, rebooted, and then tried to update and was successful.

You might consider adding the ability for the script to deal with the Windows update files being present before the script is ran, perhaps by just deleting AppraiserRes.dll and appraiser.sdb if they are present. This way it will work for anyone who attempted to update prior to running the script and then afterwards it will maintain the system's ability to dynamic update.

Great work by the way, this is exactly what I have been looking for as I don't own a single machine that would be officially supported by Windows 11.

From an ESD or Iso file without TMP

I wonder because I don't understand the manual how to use your script to make an original Microsoft 22000.318.211104-1236.co_release_svc_refresh_CLIENTBUSINESS_VOL_x64FRE_nl-nl ESD file without TMP?

My regards

right click menu index

thanks for Quick_11_iso_esd_wim_TPM_toggle. how can i delete index from right click menu?

Failed when restarting the computer

I tried to install "Windows 11 Insider Preview 22526.1000 (rs_prerelease)" and I enabled Skip_TPM_Check_on_Dynamic_Update.cmd. But when I restarted my computer for completing update, there was no any change on my system (I still on 22523).

It restarted and no any info like "Updating".

My System Info:

  • Now system version: 22523.1000
  • Expect version: 22526.1000
  • Running latest MediaCreationTool.bat
  • Updating requested by "Settings App"

Feature Request: Download ISOs for both architectures

Hi, the MCT lets you say "both" to the question of x64 or x86 arch, but it isn't clear whether the tool allows this as an option. Does the line
::# uncomment and change autodetected MediaArch - or rename script: "x64 iso 1909 Education MediaCreationTool.bat"
rem set ARCH=x64
Provide an option for "both" (or "all" or something) or are the only accepted options x64 and x86; if the latter, can support for "both" be added?
Thanks

only creates shortcut sending me back here

Hi,
when I run the MediaCreationTool.bat the powershell window briefly flashes on I can manage to see menu items 1 2 3 4 etc then it immediately closes and creates single file called latest_MCT.url which sends me back to this page from where I downloaded it? How do I make this work please?

Feature request: allow users to add custom files

Hi and thanks for this software. I was wondering if it's possible to add custom files to the ISO.
I think the script is already capable of adding files, like with the $OEM$ folder.
In this case, I'd like my files to be placed in the root of the iso file, not sources\$OEM$\
For example, maybe some one needs to add a custom autounattend.xml in the root of the ISO.

EDIT: It would be good if this task would be "unlinked" from the 'DEF' stage. In other words: adding custom folder without adding: $OEM$ PID.txt EI.cfg auto.cmd unattend.xml.

Cannot update Windows 11 through official update (non-insider)

I ran the latest version of the v7 Skip_TPM_Check_on_Dynamic_Update.cmd script, but I am unable to install Windows 11 through the non-insider Windows update.

I checked Regedit, and the keys in HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Image File Execution Options\SetupHost.exe are there.

According to the PC Health Check, the two incompatibilities are that my TPM is on version 1.2 and my CPU is unsupported: it's an Intel Core i5-3470 CPU.

Screenshot 2021-12-27 014343

Feature request

Please add feature that will download and compile Windows 11 22h2 (dev)

what do you want me to do with that? I'm in short supply on crystal balls these days..

what do you want me to do with that? I'm in short supply of crystal balls these days..
get a qr scan app for your phone and scan it, it will direct you to a microsoft support link
because if that's an windows setup error - it has nothing to do with this script, your problem is elsewhere
I can only blindly suggest you run a in-place repair with your current windows 10 version

Originally posted by @AveYo in #62 (comment)

__Originally posted by @Human19788 in https://github.com/AveYo/MediaCreationTool.bat/issues/63__active my email address [email protected]

Roll back to Win10

If I install Win 11 with this will I able to downgrade to Win 10 from the settings, recovery, roll back option as I should if I upgraded with Win update?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.