How do I install multiple programs via autounattend.xml ?


james73

Well-known member
Member
Local time
11:47 AM
Posts
46
Location
Glaschu, Alba
OS
Win 10 LTSC + Win 11 Pro + Linux Mint + Debian KDE
I've used the schneegans.de website to create an unattended xml file.

Using VirtualBox to test it, everything works ok until I get to the bit where I'm trying to automatically install 3 programs at first logon as a test. All that happens is, the first program in the list installs, but I have to click the 'ok' button for it to install. Changing the order of the programs makes no difference. The next two programs dont install.

Code I'm using here:
<File path="C:\Windows\Setup\Scripts\unattend-03.ps1">
foreach( $drive in [System.IO.DriveInfo]::GetDrives() ) {
if( $found = Join-Path -Path $drive.RootDirectory -ChildPath '7z*-x64.exe' -Resolve -ErrorAction 'SilentlyContinue' ) {
Start-Process -FilePath $found -ArgumentList '/S /D="C:\Program Files\7-Zip"' -Wait;
return;
}
}
'Cannot find any files that match pattern.' | Write-Warning;

foreach( $drive in [System.IO.DriveInfo]::GetDrives() ) {
if( $found = Join-Path -Path $drive.RootDirectory -ChildPath 'npp*x64.exe' -Resolve -ErrorAction 'SilentlyContinue' ) {
Start-Process -FilePath $found -ArgumentList '/S /D="C:\Program Files\Notepad++"' -Wait;
return;
}
}
'Cannot find any files that match pattern.' | Write-Warning;

foreach( $drive in [System.IO.DriveInfo]::GetDrives() ) {
if( $found = Join-Path -Path $drive.RootDirectory -ChildPath 'OpenShellSetup*.exe' -Resolve -ErrorAction 'SilentlyContinue' ) {
Start-Process -FilePath $found -ArgumentList '/S /D="C:\Program Files\Open-Shell"' -Wait;
return;
}
}
'Cannot find any files that match pattern.' | Write-Warning;
</File>

I've created a Powershell script that installs as many programs as I want, but it would be good if I could get this to work in the autounattend.xml file instead.


Anyone any pointers?

Thanks in advance.
 

My Computer

System One

  • OS
    Win 10 LTSC + Win 11 Pro + Linux Mint + Debian KDE
    Computer type
    PC/Desktop
    Manufacturer/Model
    Self built
    CPU
    Intel i5-13600K
    Motherboard
    ASRock Z790 PG Riptide
    Memory
    Corsair VENGEANCE 64GB (2 x 32GB) DDR5 6000MHz
    Graphics Card(s)
    Radeon RX 9070 16GB
    Sound Card
    Creative AE-5X
    Monitor(s) Displays
    HP 24" 1080p
    Screen Resolution
    1920 x 1080
    Hard Drives
    • Boot drive (Windows) - Kingston FURY 2TB Renegade PCIe 4.0 NVMe M.2
    • Boot drive (Linux) - WD BLACK 1TB SN770 M.2 2280 Gen4 NVMe
    • Data drive - Crucial BX500 2TB SATA SSD
    • Games drive - Crucial BX500 2TB SATA SSD
    • VMs drive - Crucial MX500 1TB SSD
    • Back-up (internal) - Seagate 4TB HDD
    • Back-up (external) - Seagate 8TB HDD
    PSU
    Corsair RM850 850 Watt 80 Plus Gold Fully Modular ATX PSU
    Case
    Fractal Design Define 7 XL Full-Tower
    Cooling
    • CPU cooler - Scythe FUMA 2 Rev B • 7 x 140mm case fans: 3 x PWM + 4 x non-PWM
    Keyboard
    Microsoft Wired Keyboard 600
    Mouse
    Dell MOCZUL 6-Button 400-1600 DPI
    Browser
    Firefox
I've used the schneegans.de website to create an unattended xml file.



I've created a Powershell script that installs as many programs as I want, but it would be good if I could get this to work in the autounattend.xml file instead.


Anyone any pointers?

Thanks in advance.
Can you post that PS script?
 

My Computer

System One

  • OS
    Windows 11 2H25
    Computer type
    PC/Desktop
    Manufacturer/Model
    DIY
    CPU
    AMD 9900X
    Motherboard
    MSI X870E Carbon
    Memory
    64 GB
    Graphics Card(s)
    AMD 9070 XT
    Sound Card
    built-in
    Monitor(s) Displays
    Dell 24"
    Hard Drives
    Sabrent 1 TB NVMe, 4 x SSD (need to check models), 4 x 3.5" HDD, 8-16 TB, all WD
    PSU
    Seasonic 850
    Case
    Fractal Design North XL (which I likw)
    Cooling
    Corsair AIO for CPU, fans for case
    Keyboard
    Das Keyboard 4
    Mouse
    Corsair M65 (white)
    Internet Speed
    1 TB download
    Browser
    Firefox
    Antivirus
    Bitdefender
    Other Info
    Also have Lenovo T14S laptop (me) and Lenovo Slim 71 (wife)
I've used the schneegans.de website to create an unattended xml file.

Using VirtualBox to test it, everything works ok until I get to the bit where I'm trying to automatically install 3 programs at first logon as a test. All that happens is, the first program in the list installs, but I have to click the 'ok' button for it to install. Changing the order of the programs makes no difference. The next two programs dont install.

Code I'm using here:

foreach( $drive in [System.IO.DriveInfo]::GetDrives() ) {
if( $found = Join-Path -Path $drive.RootDirectory -ChildPath '7z*-x64.exe' -Resolve -ErrorAction 'SilentlyContinue' ) {
Start-Process -FilePath $found -ArgumentList '/S /D="C:\Program Files\7-Zip"' -Wait;
return;
}
}

This script uses Start-Process -Wait, which requires the called application to exit before proceeding to the script command.
On paper, this is the correct silent install arguments for 7-Zip & Notepad++

OpenShellSetup
is supposed to be "/qb ADDLOCAL=StartMenu".

If you don't research the right silent install arguments for an app (or the dev's terrible and never supported them), Unattended mode app installs will hang or never run correctly. Part of the benefits of winget or Chocolatey package managers, is someone already figured out the install flags for you.
 
Last edited:

My Computer

System One

  • OS
    Windows 7
PowerShell script uses return after each install, which stops the script from continuing. Also, if you're getting an "OK" prompt, the silent install parameters you're using might not be working correctly for that installer. Honestly, this method isn't ideal. You're manually hunting for .exe files, hoping the switches work, and packaging everything with your image. It's clunky and fragile.

A cleaner and more modern way is to use winget. It's built into Windows, it pulls the latest versions directly from the web, handles silent installs automatically, and you don’t need to include any installers.

expample:

Powershell:
winget install --id 7zip.7zip --accept-package-agreements --accept-source-agreements

It's also possible to use --silent or even --override to force specific installer arguments, but the package has to support them, not all do. If you're not sure what switches are accepted, it's usually safest to skip those and let winget handle it by default.
 

My Computer

System One

  • OS
    Win11
    Computer type
    Laptop
PowerShell script uses return after each install, which stops the script from continuing. Also, if you're getting an "OK" prompt, the silent install parameters you're using might not be working correctly for that installer. Honestly, this method isn't ideal. You're manually hunting for .exe files, hoping the switches work, and packaging everything with your image. It's clunky and fragile.

A cleaner and more modern way is to use winget. It's built into Windows, it pulls the latest versions directly from the web, handles silent installs automatically, and you don’t need to include any installers.

expample:

Powershell:
winget install --id 7zip.7zip --accept-package-agreements --accept-source-agreements

It's also possible to use --silent or even --override to force specific installer arguments, but the package has to support them, not all do. If you're not sure what switches are accepted, it's usually safest to skip those and let winget handle it by default.
The one drawback is if you're using unattended files, winget (or rather its parent DesktopAppInstaller package) hasn't been properly provisioned as an UWP app, and won't run correctly under the SYSTEM context. It will work much later in the install process, after acquiring a license and when called by an interactive user account.
 

My Computer

System One

  • OS
    Windows 7
The one drawback is if you're using unattended files, winget (or rather its parent DesktopAppInstaller package) hasn't been properly provisioned as an UWP app, and won't run correctly under the SYSTEM context. It will work much later in the install process, after acquiring a license and when called by an interactive user account.
I don’t get why anyone would try to install apps during setup in SYSTEM context. If you really want them pre-installed, just put them in the .wim. If not, winget after login is way simpler.
 

My Computer

System One

  • OS
    Win11
    Computer type
    Laptop
I don’t get why anyone would try to install apps during setup in SYSTEM context. If you really want them pre-installed, just put them in the .wim. If not, winget after login is way simpler.
If you check the GitHub issues, the PM team acknowledges winget isn't really supposed to work correctly as SYSTEM, and it's something they may address one day (on the backburner). It works, but you have to be careful.
 

My Computer

System One

  • OS
    Windows 7
If you check the GitHub issues, the PM team acknowledges winget isn't really supposed to work correctly as SYSTEM, and it's something they may address one day (on the backburner). It works, but you have to be careful.
You're right, it's safer to avoid SYSTEM context and just trigger a script after user login if needed. Personally, I don't think installers should run under SYSTEM at all. I don't really see the point. In larger environments, apps are baked into the image or deployed with tools like Autopilot. For home or power users, a login-time script is the easiest and most reliable option. I wouldn't run any installs as SYSTEM myself.
 

My Computer

System One

  • OS
    Win11
    Computer type
    Laptop
Can you post that PS script?

I've used this on several virtual machines, both Win10 and Win11, and it works fine.

# Ensure winget is available
if (!(Get-Command winget -ErrorAction SilentlyContinue)) {
Write-Host "winget is not installed. Please install Windows Package Manager first." -ForegroundColor Red
exit 1
}

# List of apps to install
$apps = @(
"Google.Chrome",
"Mythicsoft.AgentRansack",
"7zip.7zip",
"valinet.ExplorerPatcher",
"Notepad++.Notepad++",
"TheDocumentFoundation.LibreOffice",
"GIMP.GIMP",
"CodeSector.TeraCopy",
"Open-Shell.Open-Shell-Menu",
"IrfanSkiljan.IrfanView",
"WinDirStat.WinDirStat",
"FastStone.Viewer",
"XnSoft.XnView.Classic",
"VideoLAN.VLC",
"Adobe.Acrobat.Reader.64-bit",
"CLechasseur.PathCopyCopy"
)

foreach ($app in $apps) {
Write-Host "Installing $app..."
winget install --id $app --silent --accept-source-agreements --accept-package-agreements
}
 

My Computer

System One

  • OS
    Win 10 LTSC + Win 11 Pro + Linux Mint + Debian KDE
    Computer type
    PC/Desktop
    Manufacturer/Model
    Self built
    CPU
    Intel i5-13600K
    Motherboard
    ASRock Z790 PG Riptide
    Memory
    Corsair VENGEANCE 64GB (2 x 32GB) DDR5 6000MHz
    Graphics Card(s)
    Radeon RX 9070 16GB
    Sound Card
    Creative AE-5X
    Monitor(s) Displays
    HP 24" 1080p
    Screen Resolution
    1920 x 1080
    Hard Drives
    • Boot drive (Windows) - Kingston FURY 2TB Renegade PCIe 4.0 NVMe M.2
    • Boot drive (Linux) - WD BLACK 1TB SN770 M.2 2280 Gen4 NVMe
    • Data drive - Crucial BX500 2TB SATA SSD
    • Games drive - Crucial BX500 2TB SATA SSD
    • VMs drive - Crucial MX500 1TB SSD
    • Back-up (internal) - Seagate 4TB HDD
    • Back-up (external) - Seagate 8TB HDD
    PSU
    Corsair RM850 850 Watt 80 Plus Gold Fully Modular ATX PSU
    Case
    Fractal Design Define 7 XL Full-Tower
    Cooling
    • CPU cooler - Scythe FUMA 2 Rev B • 7 x 140mm case fans: 3 x PWM + 4 x non-PWM
    Keyboard
    Microsoft Wired Keyboard 600
    Mouse
    Dell MOCZUL 6-Button 400-1600 DPI
    Browser
    Firefox
This script uses Start-Process -Wait, which requires the called application to exit before proceeding to the script command.
On paper, this is the correct silent install arguments for 7-Zip & Notepad++

OpenShellSetup
is supposed to be "/qb ADDLOCAL=StartMenu".

If you don't research the right silent install arguments for an app (or the dev's terrible and never supported them), Unattended mode app installs will hang or never run correctly. Part of the benefits of winget or Chocolatey package managers, is someone already figured out the install flags for you.
Just wondering. What about UnigetUI? UniGetUI - Martí Climent
 

My Computer

System One

  • OS
    Windows 11 2H25
    Computer type
    PC/Desktop
    Manufacturer/Model
    DIY
    CPU
    AMD 9900X
    Motherboard
    MSI X870E Carbon
    Memory
    64 GB
    Graphics Card(s)
    AMD 9070 XT
    Sound Card
    built-in
    Monitor(s) Displays
    Dell 24"
    Hard Drives
    Sabrent 1 TB NVMe, 4 x SSD (need to check models), 4 x 3.5" HDD, 8-16 TB, all WD
    PSU
    Seasonic 850
    Case
    Fractal Design North XL (which I likw)
    Cooling
    Corsair AIO for CPU, fans for case
    Keyboard
    Das Keyboard 4
    Mouse
    Corsair M65 (white)
    Internet Speed
    1 TB download
    Browser
    Firefox
    Antivirus
    Bitdefender
    Other Info
    Also have Lenovo T14S laptop (me) and Lenovo Slim 71 (wife)
UniGetUI/WingetUI is a GUI tool, which can't be used for unattended installs. You could launch it from FirstLogonCommand, when you reach the desktop for the first time, but that defeats the purpose of script automation.
 

My Computer

System One

  • OS
    Windows 7
UniGetUI/WingetUI is a GUI tool, which can't be used for unattended installs. You could launch it from FirstLogonCommand, when you reach the desktop for the first time, but that defeats the purpose of script automation.
True but once you have it set up, it's basically a one-click solution and installs everything it is set up to do.
 

My Computer

System One

  • OS
    Windows 11 2H25
    Computer type
    PC/Desktop
    Manufacturer/Model
    DIY
    CPU
    AMD 9900X
    Motherboard
    MSI X870E Carbon
    Memory
    64 GB
    Graphics Card(s)
    AMD 9070 XT
    Sound Card
    built-in
    Monitor(s) Displays
    Dell 24"
    Hard Drives
    Sabrent 1 TB NVMe, 4 x SSD (need to check models), 4 x 3.5" HDD, 8-16 TB, all WD
    PSU
    Seasonic 850
    Case
    Fractal Design North XL (which I likw)
    Cooling
    Corsair AIO for CPU, fans for case
    Keyboard
    Das Keyboard 4
    Mouse
    Corsair M65 (white)
    Internet Speed
    1 TB download
    Browser
    Firefox
    Antivirus
    Bitdefender
    Other Info
    Also have Lenovo T14S laptop (me) and Lenovo Slim 71 (wife)
That's not a full hands-free solution. If you don't know how to automate 3rd-party app installs, UniGetUI or (free) Ninite might look attractive. But you're still clicking apps, and waiting for them to finish before selecting the next one.

It might work for you, but the folks asking these questions tend to be busy and asked to install multiple PC's. They can't sit there.
 

My Computer

System One

  • OS
    Windows 7
Back
Top Bottom