I have several external drives, used for backups and for storing large files. They are usually sleeping, spinning up only when needed.
Except that Windows has this annoying habit of accessing external drives on its own, without asking.
One particular case concerns the Windows installer (which is invoked surprisingly often, e.g., when it installs virus definition updates for Windows Defender.) But at least for this case, I found a solution, in the form of the following modified Registry entries:
HKEY_CLASSES_ROOT\Msi.Package\shell\Open\command
"%SystemRoot%\System32\msiexec.exe" /i "%1" ROOTDRIVE=C:\ %*
HKEY_CLASSES_ROOT\Msi.Package\shell\Repair\command
"%SystemRoot%\System32\msiexec.exe" /f "%1" ROOTDRIVE=C:\ %*
HKEY_CLASSES_ROOT\Msi.Package\shell\Uninstall\command
"%SystemRoot%\System32\msiexec.exe" /x "%1" ROOTDRIVE=C:\ %*
HKEY_CLASSES_ROOT\Msi.Patch\shell\Open\command
"%SystemRoot%\System32\msiexec.exe" /p "%1" ROOTDRIVE=C:\ %*
Thank you, StackExchange.