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:

"%SystemRoot%\System32\msiexec.exe" /i "%1" ROOTDRIVE=C:\ %*

"%SystemRoot%\System32\msiexec.exe" /f "%1" ROOTDRIVE=C:\ %*

"%SystemRoot%\System32\msiexec.exe" /x "%1" ROOTDRIVE=C:\ %*

"%SystemRoot%\System32\msiexec.exe" /p "%1" ROOTDRIVE=C:\ %*

Thank you, StackExchange.