Mediacreationtool.bat run it as system silently


tommyhalllock

New member
Local time
11:41 AM
Posts
8
OS
Windows 11
Hello all, I am really struggling getting this tool to run silently as SYSTEM it seems to run fine as interactive but just hangs in process when trying to run in background. Probably something im missing.

Anyways the context is I am trying to use it to run an inplace upgrade for windows 11 systems to update to the latest feature pack 23h2 and need to deploy it to mutiple systems.

As to why am i using this tool? Because every other method has caused issues with corruption or bluescreens tried winupdate assisant and even normal win update.

Anyways i have tested this tool using the .iso and it works with no issues so i am trying to setup a deployment method so it sets up a task in task sched to run a .ps1 script at 3am system time that installs the mediacreationtool.bat silently.

This method will be ran as SYSTEM. I got the task created and the script runs but when I check processes it gets stuck on something as it just sits there with no disk usage.

The only switch im using when running the mediacreationtool.bat is /auto upgrade

anyone have any other ideas?
 

My Computer

System One

  • OS
    Windows 11
Are you calling it with as 23H2? Otherwise the script's probably trying to pull 24H2 (since it's the latest), and it hasn't been updated for 24H2.

"auto 23H2 MediaCreationTool.bat"
 

My Computer

System One

  • OS
    Windows 7
I’d love to see the script (less sensitive info marked by xxxxxx)

I’ve been very interested in scripts lately.

Batch:
Any chance you could add it to code in here?
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 23H2 Build 22631.5039
    Computer type
    PC/Desktop
    Manufacturer/Model
    Sin-built
    CPU
    Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz (4th Gen?)
    Motherboard
    ASUS ROG Maximus VI Formula
    Memory
    32.0 GB of I forget and the box is in storage.
    Graphics Card(s)
    Gigabyte nVidia GeForce GTX 1660 Super OC 6GB
    Sound Card
    Onboard
    Monitor(s) Displays
    5 x LG 25MS500-B - 1 x 24MK430H-B - 1 x Wacom Pro 22" Tablet
    Screen Resolution
    All over the place
    Hard Drives
    Too many to list.
    OS on Samsung 1TB 870 QVO SATA
    PSU
    Silverstone 1500
    Case
    NZXT Phantom 820 Full-Tower Case
    Cooling
    Noctua NH-D15 Elite Class Dual Tower CPU Cooler / 6 x EziDIY 120mm / 2 x Corsair 140mm somethings / 1 x 140mm Thermaltake something / 2 x 200mm Corsair.
    Keyboard
    Corsair K95 / Logitech diNovo Edge Wireless
    Mouse
    Logitech: G402 / G502 / Mx Masters / MX Air Cordless
    Internet Speed
    1000/400Mbps
    Browser
    All sorts
    Antivirus
    Kaspersky Premium
    Other Info
    I’m on a horse.
  • Operating System
    Windows 11 Pro 23H2 Build: 22631.4249
    Computer type
    Laptop
    Manufacturer/Model
    LENOVO Yoga 7i EVO OLED 14" Touchscreen i5 12 Core 16GB/512GB
    CPU
    Intel Core 12th Gen i5-1240P Processor (1.7 - 4.4GHz)
    Memory
    16GB LPDDR5 RAM
    Graphics card(s)
    Intel Iris Xe Graphics Processor
    Sound Card
    Optimized with Dolby Atmos®
    Screen Resolution
    QHD 2880 x 1800 OLED
    Hard Drives
    M.2 512GB
    Antivirus
    Defender / Malwarebytes
    Other Info
    …still on a horse.
I was 'informed' earlier that 24H2 is not coming to all computers at the same time so I'm waiting until it's automatically offered. It is offered for Copilot+ PCs but I don't have one of those.

My issue with automating using the MCT is that it's a small downloaded file that then has to been run and choices made a few times. I download the .iso file 'in case' but normally create the bootable USB Thumb drive to install. One choice that doesn't have to made is the one about whether 32-bit or 64-bit as the 32-bit isn't available for Win11.
 

My Computers

System One System Two

  • OS
    Win11 Pro RTM
    Computer type
    Laptop
    Manufacturer/Model
    Dell Vostro 3400
    CPU
    Intel Core i5 11th Gen. 2.40GHz
    Memory
    12GB
    Hard Drives
    256GB SSD NVMe M.2
  • Operating System
    Windows 11 Pro RTM x64
    Computer type
    PC/Desktop
    Manufacturer/Model
    Dell Vostro 5890
    CPU
    Intel Core i5 10th Gen. 2.90GHz
    Memory
    16GB
    Graphics card(s)
    Onboard, no VGA, using a DisplayPort-to-VGA adapter
    Monitor(s) Displays
    24" Dell
    Hard Drives
    512GB SSD NVMe, 4TB Seagate HDD
    Browser
    Firefox, Edge
    Antivirus
    Windows Defender/Microsoft Security

My Computers

System One System Two

  • OS
    Windows 11 Pro 23H2 Build 22631.5039
    Computer type
    PC/Desktop
    Manufacturer/Model
    Sin-built
    CPU
    Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz (4th Gen?)
    Motherboard
    ASUS ROG Maximus VI Formula
    Memory
    32.0 GB of I forget and the box is in storage.
    Graphics Card(s)
    Gigabyte nVidia GeForce GTX 1660 Super OC 6GB
    Sound Card
    Onboard
    Monitor(s) Displays
    5 x LG 25MS500-B - 1 x 24MK430H-B - 1 x Wacom Pro 22" Tablet
    Screen Resolution
    All over the place
    Hard Drives
    Too many to list.
    OS on Samsung 1TB 870 QVO SATA
    PSU
    Silverstone 1500
    Case
    NZXT Phantom 820 Full-Tower Case
    Cooling
    Noctua NH-D15 Elite Class Dual Tower CPU Cooler / 6 x EziDIY 120mm / 2 x Corsair 140mm somethings / 1 x 140mm Thermaltake something / 2 x 200mm Corsair.
    Keyboard
    Corsair K95 / Logitech diNovo Edge Wireless
    Mouse
    Logitech: G402 / G502 / Mx Masters / MX Air Cordless
    Internet Speed
    1000/400Mbps
    Browser
    All sorts
    Antivirus
    Kaspersky Premium
    Other Info
    I’m on a horse.
  • Operating System
    Windows 11 Pro 23H2 Build: 22631.4249
    Computer type
    Laptop
    Manufacturer/Model
    LENOVO Yoga 7i EVO OLED 14" Touchscreen i5 12 Core 16GB/512GB
    CPU
    Intel Core 12th Gen i5-1240P Processor (1.7 - 4.4GHz)
    Memory
    16GB LPDDR5 RAM
    Graphics card(s)
    Intel Iris Xe Graphics Processor
    Sound Card
    Optimized with Dolby Atmos®
    Screen Resolution
    QHD 2880 x 1800 OLED
    Hard Drives
    M.2 512GB
    Antivirus
    Defender / Malwarebytes
    Other Info
    …still on a horse.
So no one has any idea how to get it to run silently without stalling? I can post the PS script tmrw if it helps that is running the .bat.

I have tested it without running it as system and it works fine as in it pops ip and runs through the menus automatically without issues.

so it cant be trying to update to 24h2 i mean even if it is that shouldnt be the issue.
 

My Computer

System One

  • OS
    Windows 11
I was 'informed' earlier that 24H2 is not coming to all computers at the same time so I'm waiting until it's automatically offered. It is offered for Copilot+ PCs but I don't have one of those.

My issue with automating using the MCT is that it's a small downloaded file that then has to been run and choices made a few times. I download the .iso file 'in case' but normally create the bootable USB Thumb drive to install. One choice that doesn't have to made is the one about whether 32-bit or 64-bit as the 32-bit isn't available for Win11.
To get it to run automatically as stated in the code you just rename it after download to auto theres various other names you rename it to if targeting a specific version.
 

My Computer

System One

  • OS
    Windows 11
Are you calling it with as 23H2? Otherwise the script's probably trying to pull 24H2 (since it's the latest), and it hasn't been updated for 24H2.

"auto 23H2 MediaCreationTool.bat"
Tried this as well its hanging still.
 

My Computer

System One

  • OS
    Windows 11
Have you tried running it as Administrator (not SYSTEM)? Sometimes an app or script which does its own privilege elevation gets confused when it's already running with SYSTEM rights.
 

My Computer

System One

  • OS
    Windows 7
Have you tried running it as Administrator (not SYSTEM)? Sometimes an app or script which does its own privilege elevation gets confused when it's already running with SYSTEM rights.
Yes and it works as admin the problem is I cant deploy it as admin because the rmm we use onlu runs scripts as system. But sonething else seems yo be the issue then permissions because i even tried setting up the task to be run as highest privileges on an admin account in task scheduler and that didnt work.
 

My Computer

System One

  • OS
    Windows 11
What arguments are you using in the task for the action?
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 23H2 Build 22631.5039
    Computer type
    PC/Desktop
    Manufacturer/Model
    Sin-built
    CPU
    Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz (4th Gen?)
    Motherboard
    ASUS ROG Maximus VI Formula
    Memory
    32.0 GB of I forget and the box is in storage.
    Graphics Card(s)
    Gigabyte nVidia GeForce GTX 1660 Super OC 6GB
    Sound Card
    Onboard
    Monitor(s) Displays
    5 x LG 25MS500-B - 1 x 24MK430H-B - 1 x Wacom Pro 22" Tablet
    Screen Resolution
    All over the place
    Hard Drives
    Too many to list.
    OS on Samsung 1TB 870 QVO SATA
    PSU
    Silverstone 1500
    Case
    NZXT Phantom 820 Full-Tower Case
    Cooling
    Noctua NH-D15 Elite Class Dual Tower CPU Cooler / 6 x EziDIY 120mm / 2 x Corsair 140mm somethings / 1 x 140mm Thermaltake something / 2 x 200mm Corsair.
    Keyboard
    Corsair K95 / Logitech diNovo Edge Wireless
    Mouse
    Logitech: G402 / G502 / Mx Masters / MX Air Cordless
    Internet Speed
    1000/400Mbps
    Browser
    All sorts
    Antivirus
    Kaspersky Premium
    Other Info
    I’m on a horse.
  • Operating System
    Windows 11 Pro 23H2 Build: 22631.4249
    Computer type
    Laptop
    Manufacturer/Model
    LENOVO Yoga 7i EVO OLED 14" Touchscreen i5 12 Core 16GB/512GB
    CPU
    Intel Core 12th Gen i5-1240P Processor (1.7 - 4.4GHz)
    Memory
    16GB LPDDR5 RAM
    Graphics card(s)
    Intel Iris Xe Graphics Processor
    Sound Card
    Optimized with Dolby Atmos®
    Screen Resolution
    QHD 2880 x 1800 OLED
    Hard Drives
    M.2 512GB
    Antivirus
    Defender / Malwarebytes
    Other Info
    …still on a horse.
For instance, my Sharex task windows startup, which ordinarily nags me for permissions, without the schtasks /run /tn

IMG_5054.png
 

My Computers

System One System Two

  • OS
    Windows 11 Pro 23H2 Build 22631.5039
    Computer type
    PC/Desktop
    Manufacturer/Model
    Sin-built
    CPU
    Intel(R) Core(TM) i7-4770K CPU @ 3.50GHz (4th Gen?)
    Motherboard
    ASUS ROG Maximus VI Formula
    Memory
    32.0 GB of I forget and the box is in storage.
    Graphics Card(s)
    Gigabyte nVidia GeForce GTX 1660 Super OC 6GB
    Sound Card
    Onboard
    Monitor(s) Displays
    5 x LG 25MS500-B - 1 x 24MK430H-B - 1 x Wacom Pro 22" Tablet
    Screen Resolution
    All over the place
    Hard Drives
    Too many to list.
    OS on Samsung 1TB 870 QVO SATA
    PSU
    Silverstone 1500
    Case
    NZXT Phantom 820 Full-Tower Case
    Cooling
    Noctua NH-D15 Elite Class Dual Tower CPU Cooler / 6 x EziDIY 120mm / 2 x Corsair 140mm somethings / 1 x 140mm Thermaltake something / 2 x 200mm Corsair.
    Keyboard
    Corsair K95 / Logitech diNovo Edge Wireless
    Mouse
    Logitech: G402 / G502 / Mx Masters / MX Air Cordless
    Internet Speed
    1000/400Mbps
    Browser
    All sorts
    Antivirus
    Kaspersky Premium
    Other Info
    I’m on a horse.
  • Operating System
    Windows 11 Pro 23H2 Build: 22631.4249
    Computer type
    Laptop
    Manufacturer/Model
    LENOVO Yoga 7i EVO OLED 14" Touchscreen i5 12 Core 16GB/512GB
    CPU
    Intel Core 12th Gen i5-1240P Processor (1.7 - 4.4GHz)
    Memory
    16GB LPDDR5 RAM
    Graphics card(s)
    Intel Iris Xe Graphics Processor
    Sound Card
    Optimized with Dolby Atmos®
    Screen Resolution
    QHD 2880 x 1800 OLED
    Hard Drives
    M.2 512GB
    Antivirus
    Defender / Malwarebytes
    Other Info
    …still on a horse.
Are you running this task in the background, without requiring an user session? AveYo's script works by trying to attach to a running Setup process, and sending keystroke events.

If you don't have the right execution context, then Setup is stuck in limbo for a mouse or keyboard event that never happens. You can't connect to another process' window unless you're in the same desktop session.
 

My Computer

System One

  • OS
    Windows 7
I found this open issue on the GitHub page:

This you? :unsure:
SYSTEM is a non-interactive identity and doesn't own a Desktop, so the script is making assumptions about the user profile and what environment variables are passed along.
 

My Computer

System One

  • OS
    Windows 7
  • Like
Reactions: OAT
I found this open issue on the GitHub page:

This you? :unsure:
SYSTEM is a non-interactive identity and doesn't own a Desktop, so the script is making assumptions about the user profile and what environment variables are passed along.
No, That is not me but I did see that as well. That was an issue I ran into as well when testing using the pexec tool. But if you simply create that directory that is in the error message before running the script it works fine.

So do you think there is no way to run this mediacreationtool.bat silently? Technically since I am creating a task in task scheduler to run it I can choose any user to run it as. I tried doing this as one of the admin profiles and like I said it opens it and runs it but stalls.

Here's the code I am using and yes I scrubbed the sensitive parts


Powershell:
# Define the system profile Desktop path
$SystemProfileDesktop = "C:\Windows\System32\config\systemprofile\Desktop"

# Check if the directory exists, and create it if it doesn't
If (-Not (Test-Path $SystemProfileDesktop)) {
    Write-Host "Directory does not exist. Creating: $SystemProfileDesktop"
    New-Item -Path $SystemProfileDesktop -ItemType Directory
} Else {
    Write-Host "Directory already exists: $SystemProfileDesktop"
}

# Define the URL for MediaCreationTool.bat
$MCT_URL = "https://github.com/AveYo/MediaCreationTool.bat/raw/main/MediaCreationTool.bat"

# Define the download location
$DownloadPath = "C:\Temp\MediaCreationTool.bat"

# Create the Temp directory if it doesn't exist
If (-Not (Test-Path "C:\Temp")) {
    New-Item -Path "C:\Temp" -ItemType Directory
}

# Download the MediaCreationTool.bat
Invoke-WebRequest -Uri $MCT_URL -OutFile $DownloadPath

# Define the new name for the script
$RenamedScriptPath = "C:\Temp\auto MediaCreationTool.bat"

# Check if the renamed script already exists, delete if it does
If (Test-Path $RenamedScriptPath) {
    Remove-Item -Path $RenamedScriptPath -Force
}

# Rename the script to "auto MediaCreationTool.bat"
Rename-Item -Path $DownloadPath -NewName $RenamedScriptPath

# Unblock the script to avoid execution policy issues
Unblock-File -Path $RenamedScriptPath

# Create a scheduled task action to run the batch file with the /auto upgrade switch
$action = New-ScheduledTaskAction -Execute "$RenamedScriptPath" -Argument "/auto upgrade"

# Create a scheduled task trigger to run the task once at 3 AM the following day
$trigger = New-ScheduledTaskTrigger -Once -At (Get-Date).AddDays(1).Date.AddHours(3)

# admin profile
$AdminUser = "admin"
$AdminPassword = "XXXX"

# Create a principal to run the task as 'admin' with highest privileges and password for 'whether user is logged on or not'
$principal = New-ScheduledTaskPrincipal -UserId $AdminUser -LogonType Password -RunLevel Highest


# Register the scheduled task with credentials provided
Register-ScheduledTask -Action $action -Trigger $trigger -Principal $principal -TaskName "RunMediaCreationTool" -Description "Runs MediaCreationTool.bat with /auto upgrade at 3 AM the following day" -User $AdminUser -Password $AdminPassword

# Optional: Confirm task creation
Write-Host "Scheduled task 'RunMediaCreationTool' created to run at 3 AM the following day, whether the user is logged in or not."
 

My Computer

System One

  • OS
    Windows 11
I think the problem is you can't run it "Logged on or not", because then there's no window session for MCT His script needs to attach to the running MCT by window session to send keystrokes. MCT will be running, but no way to access the isolated process.
 

My Computer

System One

  • OS
    Windows 7
I think the problem is you can't run it "Logged on or not", because then there's no window session for MCT His script needs to attach to the running MCT by window session to send keystrokes. MCT will be running, but no way to access the isolated process.
I see, dang so do you know of any other alternatives that might work to run an inplace upgrade remotely?
 

My Computer

System One

  • OS
    Windows 11
Honestly, you're using the wrong tool for upgrading Windows in a RMM environment.

What are the primary use cases for MCT.bat?
  • need to install older versions of W10/11, which are no longer available for download ❌
  • need to bypass upgrade checks ❌
  • don't know how to download a normal W10/11 ISO ❌
If you can download a normal W10 ISO or run MediaCreationTool to create one, then mount the extracted ISO's contents on a network share.

Make a scheduled task as Admin to start an automated in-place upgrade:
Code:
\\server\share\Setup.exe /auto upgrade /quiet /eula accept /installfrom \\server\share\sources\install.wim /imageindex N

Where N is the index number for the Windows Edition you want. If you need to bypass upgrade requirements, the reg files to apply are readily available on this forum and other websites.

 

My Computer

System One

  • OS
    Windows 7
The whole mounting and downloading the iso was the issue and some systems not meeting requirements. These end points are not in one lan either they are in lots of geographical locations so no domain groups or sccm.

Just some of the reasons i was trying to use the tool. But I'll see what I can do. Testing diwnloading the iso directly from msft.
 

My Computer

System One

  • OS
    Windows 11

Latest Support Threads

Back
Top Bottom