After some testing and researching I found out three things:
- intune uses the
cmd.exe
-syntax under the hood and not powershell.exe
-syntax
- all commands are run in administrative mode
- the scoop-installer does not like elevated rights by default and needs therefore a certain option
With these things in mind I can give intune the right command for an silent-install.
powershell.exe -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -NonInteractive -File install.ps1 -RunAsAdmin
I am executing the powershell with different options which bypass the ExecutionPolicy (if not already set) and hides/silences/quiets the opening powershell console.
After the -File
option I declare the script which shall execute and the scoop-installer-specific -RunAsAdmin
option. It is important to put the -File
option at the end of the command, because everything after it, gets interpreted as part of install.ps1
.
For the sake of completeness, here is also the silent-uninstall-command:
powershell.exe -ExecutionPolicy Bypass -NoProfile -WindowStyle Hidden -NonInteractive -Command "del $HOME\scoop -Force -Recurse | Out-Null"
I know that the task of the uninstall-command, could also be achieved with pure cmd
-syntax, but I wanted to stay close to the documentation.