Hello!
I need to distribute ArduinoIDE 2.3.6 silently via SCCM to our Computer Labs at the uni.
I've managed to make a powershell script that installs the application, boards, libs, drivers and certs silent.
As default, boards and libs are installed in the userprofile folder. I need them installed for all users though. And I've managed to get boards and libs to install for all users. But when starting ArduinoIDE it only sees the installed boards, not the libs.
Help appreciated.
Hi @balterz .
Please provide a detailed description of what you did to accomplish that. That information will allow us to better understand the reason for the problem you are encountering, and the best way to proceed to solve the problem.
Here is my current code.
$ErrorActionPreference = "Stop"
# --- Variables ---
$scriptRoot = Split-Path -Parent $MyInvocation.MyCommand.Definition
$ideMsi = Join-Path $scriptRoot "Installer\arduino-ide_2.3.6_Windows_64bit.msi"
$cliMsi = Join-Path $scriptRoot "Installer\arduino-cli_1.2.2_Windows_64bit.msi"
$cliExe = "C:\Program Files\Arduino CLI\arduino-cli.exe"
$globalArduinoDir = "C:\ProgramData\ArduinoData"
$configPath = Join-Path $globalArduinoDir "arduino-cli.yaml"
$logFile = Join-Path $globalArduinoDir "install-log.txt"
# --- Ensure the global ArduinoData directory exists BEFORE logging ---
if (-Not (Test-Path $globalArduinoDir)) {
New-Item -ItemType Directory -Path $globalArduinoDir -Force | Out-Null
}
# --- Logging Helper ---
function Log {
$timestamp = Get-Date -Format "yyyy-MM-dd HH:mm:ss"
"$timestamp`t$($args -join ' ')" | Out-File -FilePath $logFile -Append -Encoding UTF8
}
Log "Starting Arduino IDE and CLI installation."
# --- Setup ---
Log "Starting Arduino IDE and CLI installation."
New-Item -ItemType Directory -Path $globalArduinoDir -Force | Out-Null
# --- Install IDE ---
Log "Installing Arduino IDE..."
Start-Process msiexec.exe -ArgumentList "/i `"$ideMsi`" /quiet /norestart ALLUSERS=1 REBOOT=ReallySuppress" -Wait
# --- Install CLI ---
Log "Installing Arduino CLI..."
Start-Process msiexec.exe -ArgumentList "/i `"$cliMsi`" /quiet /norestart ALLUSERS=1 REBOOT=ReallySuppress" -Wait
# --- Set permissions and env variable ---
Log "Granting Users full control over $globalArduinoDir"
icacls $globalArduinoDir /grant "Users:(OI)(CI)F" /T | Out-Null
Log "Setting ARDUINO_DATA_DIR system-wide"
[Environment]::SetEnvironmentVariable("ARDUINO_DATA_DIR", $globalArduinoDir, "Machine")
# --- Write CLI config ---
Log "Writing global CLI config..."
@"
directories:
user: $globalArduinoDir
"@ | Set-Content -Path $configPath -Encoding UTF8
# Install certificates if available
$certPath = Join-Path $scriptRoot "Installer\Cert"
if (Test-Path $certPath) {
Get-ChildItem -Path $certPath -Filter *.cer -Recurse | ForEach-Object {
Log "Installing certificate: $($_.FullName)"
certutil.exe -addstore -enterprise -f "TrustedPublisher" "$($_.FullName)" | Out-Null
certutil.exe -addstore -enterprise -f "Root" "$($_.FullName)" | Out-Null
}
} else {
Log "No certificates found at $certPath"
}
# --- Update boards and install ---
Log "Updating board index..."
& $cliExe core update-index --config-file $configPath
$boards = @(
"arduino:avr",
"arduino:mbed_nano",
"arduino:mbed_nicla",
"arduino:mbed_opta",
"arduino:mbed_portenta",
"arduino:renesas_portenta",
"arduino:renesas_uno",
"arduino:mbed"
# Add more if needed
)
foreach ($board in $boards) {
Log "Installing board: $board"
& $cliExe core install $board --config-file $configPath
}
$libs = @(
"ArduinoBLE",
"Arduino_LSM6DSOX",
"WiFiNINA",
"Adafruit TensorFlow Lite",
"Arduino_LSM9DS1",
"Arduino_LPS22HB",
"Arduino_APDS9960",
"Arduino_HTS221",
"Ethernet",
"Firmata",
"Keyboard",
"LiquidCrystal",
"Stepper",
"TFT",
"Arduino_BuiltIn",
"Servo",
"Mouse",
"SD"
# Add more if needed
)
foreach ($lib in $libs) {
Log "Installing library: $lib"
& $cliExe lib install "$lib" --config-file $configPath
}
# --- Configure per-user ---
Log "Configuring all user profiles..."
$userProfiles = Get-ChildItem 'C:\Users' | Where-Object { Test-Path "$($_.FullName)\AppData\Roaming" }
foreach ($profile in $userProfiles) {
$userArduinoDir = "$($profile.FullName)\AppData\Roaming\Arduino15"
$userConfig = Join-Path $userArduinoDir "arduino-cli.yaml"
if (-Not (Test-Path $userArduinoDir)) {
New-Item -ItemType Directory -Path $userArduinoDir -Force | Out-Null
}
@"
directories:
user: $globalArduinoDir
"@ | Set-Content -Path $userConfig -Encoding UTF8
Log "Configured: $userConfig"
}
# Remove public desktop shortcut
$shortcutPath = "$env:Public\Desktop\Arduino IDE.lnk"
if (Test-Path -Path $shortcutPath -PathType Leaf) {
Log "Removing desktop shortcut: $shortcutPath"
Remove-Item "$shortcutPath" -Force
}
Log "Finished Arduino IDE and CLI installation."
OK, great. That information makes the situation clear.
This has no effect. The reason is that Arduino IDE always uses the Arduino CLI configuration file that is located at $Env:HOMEDRIVE$Env:HOMEPATH\.arduinoIDE\arduino-cli.yaml. So, although the file you created at C:\ProgramData\ArduinoData\arduino-cli.yaml is used when you run arduino-cli commands directly, it is completely ignored when using Arduino IDE .
I submitted a request to allow the user to set a custom location for the Arduino CLI configuration file used by Arduino IDE :
opened 09:00PM - 17 May 25 UTC
type: enhancement
topic: code
topic: theia
### Describe the request
Allow advanced users to cause the instances of **Ardui… no CLI** used by Arduino IDE to be configured via a configuration file from any arbitrary path.
🙂 This will significantly facilitate certain advanced use cases.
### Describe the current behavior
Many of the non-GUI capabilities of Arduino IDE are provided by the [**Arduino CLI**](https://arduino.github.io/arduino-cli/latest/) tool.
**Arduino CLI** is configured via a configuration file. When Arduino IDE invokes **Arduino CLI**, it specifies the use of the configuration file from a specific hardcoded path:
https://github.com/arduino/arduino-ide/blob/0f9f0d07b7d5ff0cdefda3e77eb6b5ce2854c4a8/arduino-ide-extension/src/node/arduino-daemon-impl.ts#L132-L133
This hardcoded path is `$HOME/.arduinoIDE/arduino-cli.yaml`.
For some advanced use cases, the location under the user home directory is very inconvenient:
- Institutional installations where the system administrator wishes a single configuration to be used by all users
- "Portable" use cases where the user wants to carry a self-contained installation of Arduino IDE and project dependencies on a portable drive for use on any computer.
- Having a dedicated configuration and dependencies environment for each specific project.
🙁 The user either cannot achieve their desired use case, or is forced to use inconvenient and convoluted means to do so.
### Arduino IDE version
0f9f0d07b7d5ff0cdefda3e77eb6b5ce2854c4a8
### Operating system
- Linux
- macOS
- Windows
### Operating system version
- Ubuntu 24.04
- macOS Sequoia
- Windows 11
### Additional context
This is a capability that is only required by advanced users, so it is not necessary to provide the capability in a beginner friendly manner. _**The complexity of Arduino IDE's primary UI MUST NOT be increased through the implementation of this feature.**_ It is perfectly fine for the configuration to only be available through an environment variable or command line flag.
There are a couple of possibilities by which this might be accomplished:
#### Allow the user to set the Arduino IDE configuration folder path
The hardcoded location for the Arduino CLI configuration file used by Arduino IDE is under the Arduino IDE configuration folder (i.e., `$HOME/.arduinoIDE`), so if the Arduino IDE configuration folder location was made configurable, this would also make the Arduino CLI configuration file location configurable.
The [**Eclipse Theia Platform** IDE framework](https://theia-ide.org/theia-platform/) upon which Arduino IDE is built already has the capability for the user to set an arbitrary configuration folder location via the `THEIA_CONFIG_DIR` environment variable:
https://github.com/eclipse-theia/theia/blob/v1.57.0/packages/core/src/node/env-variables/env-variables-server.ts#L49-L53
```ts
protected async createConfigDirUri(): Promise<string> {
if (process.env.THEIA_CONFIG_DIR) {
// this has been explicitly set by the user, so we do not override its value
return FileUri.create(process.env.THEIA_CONFIG_DIR).toString();
}
```
However, that system is overridden in the Arduino IDE codebase:
https://github.com/arduino/arduino-ide/blob/0f9f0d07b7d5ff0cdefda3e77eb6b5ce2854c4a8/arduino-ide-extension/src/node/theia/env-variables/env-variables-server.ts#L19-L30
```ts
join(homedir(), BackendApplicationConfigProvider.get().configDirName)
```
I believe the reason for this override was that, at the time it was implemented, Theia hardcoded the default configuration folder path as `$HOME/.theia` and we wanted a folder name that matches the application. However, the ability for each application to configure a custom default configuration folder name has since been added to Theia:
https://github.com/eclipse-theia/theia/pull/14319
So there is now no point in us maintaining the override code in this project.
#### Respect the `ARDUINO_CONFIG_FILE` environment variable
**Arduino CLI** supports specifying the configuration file location via an environment variable:
https://arduino.github.io/arduino-cli/dev/configuration/#locations
> The configuration file is searched in the following locations, in order of priority:
>
> 1. Location specified by the `--config-file` command line flag
> 1. Location specified by the `ARDUINO_CONFIG_FILE` environment variable
Arduino IDE's use of the `--config-file` flag in the `arduino-cli daemon` invocation makes it impossible for the user to configure the path via the `ARDUINO_CONFIG_FILE` environment variable. This could be allowed if Arduino IDE checked whether the `ARDUINO_CONFIG_FILE` environment variable was set, and if so omitted the `--config-file` command line flag from the invocation (and also using that path if it does any direct access of the configuration file).
#### Additional requests
- https://forum.arduino.cc/t/arduino-ide-2-0-portable/1031833/20
- https://forum.arduino.cc/t/arduino-ide-2-0-portable/1031833/23
- https://forum.arduino.cc/t/arduino-ide-2-0-portable/1031833/24
- https://forum.arduino.cc/t/shared-libraries-on-a-classroom-pc-windows/1157040
- https://forum.arduino.cc/t/change-board-package-folder-for-shared-access/1231038
- https://forum.arduino.cc/t/where-could-we-find-arduino-code-source-in-ide-v2-x/1347261/14
- https://forum.arduino.cc/t/arduinoide-2-3-6-silent-with-libs-for-all-users/1380305
#### Related
- https://github.com/arduino/arduino-ide/issues/122
- https://forum.arduino.cc/t/arduino-ide-2-0-rc-silent-install/960245/12
- https://forum.arduino.cc/t/arduino-ide-2-2-1-request-for-administrative-privileges-on-first-run/1212198
- https://forum.arduino.cc/t/platform-tools-in-to-install-directory/1271985
- https://forum.arduino.cc/t/arduino-2-x-in-the-classroom/1296515
- https://forum.arduino.cc/t/compile-error-permissions-denied-for-student-user/1377240
---
<details>
<summary><b>Keywords</b></summary>
<p>
- "configuration directory"
</p>
</details>
### Issue checklist
- [x] I searched for previous requests in [the issue tracker](https://github.com/arduino/arduino-ide/issues?q=)
- [x] I verified the feature was still missing when using the latest [nightly build](https://www.arduino.cc/en/software#nightly-builds)
- [x] My request contains all necessary details
If you have a GitHub account, you can subscribe to that thread to get notifications of any new developments related to this subject:
Please only comment on the GitHub issue thread if you have new technical information that will assist with the resolution. General discussion and support requests are always welcome here on the Arduino Forum.
For now, you have two options for configuring the location of the Arduino sketchbook folder (which is referred to as the "user directory" by Arduino CLI ):
Make your custom configuration of directories.user in the Arduino CLI configuration file that is actually used by Arduino IDE ($Env:HOMEDRIVE$Env:HOMEPATH\.arduinoIDE\arduino-cli.yaml).
Use the ARDUINO_DIRECTORIES_USER environment variable , just as you are already doing with the ARDUINO_DATA_DIR environment variable.
FYI, the canonical environment variable is ARDUINO_DIRECTORIES_DATA. The ARDUINO_DATA_DIR variable you are using is legacy from a very old version of Arduino CLI . Arduino CLI does still recognize the ARDUINO_DATA_DIR variable for backwards compatibility, but I recommend using the canonical configuration environment variables as specified in the documentation as it is possible that support for these old variables could be lost at some point in the future.