Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Cover image for Intune appends «/qn ALLUSERS=1»
Andreas Brunner
Andreas Brunner

Posted on • Originally published atcloudxs.ch

     

Intune appends «/qn ALLUSERS=1»

Are you trying to run a Powershell script as an Intune install command and you have the string.msi in it and realized that your command fails, because Intune automatically modifies it? Here is the thing. As soon as Intune finds.msi in your install command, it appends/qn ALLUSERS=1 on its own. Even if they had good intentions to implement this, when we want to run a powershell script, they break our command.

Here is our install command in the Intune Administration GUI.

Install command in GUI

And here you see what is executed on the client.

Install command in log file

If you have named arguments in your Powershell script, the command will break. Powershell will throw an error because it does not know any parameter «/qn» or «ALLUSERS=1».

Here is an example. If you have the following Install command, you will get an error.

powershell -executionpolicy bypass -file .\installer.ps1 -myMSI "https://domain.com/myMsiPackage.msi"
Enter fullscreen modeExit fullscreen mode

The trick is to useunnamed arguments in your script. In the following example, we removed-myMSI.

powershell -executionpolicy bypass -file .\installer.ps1 "https://domain.com/myMsiPackage.msi"
Enter fullscreen modeExit fullscreen mode

Now, at the top of your script, don’t catch the parameters with aparam() block. Catch them with the$args array. Theinstaller.ps1 would start with the following line.

$myMSI = $args[0]# $myMSI will contain -> https://domain.com/myMsiPackage.msi# the rest can be ignored# $args[1] will contain -> /qn# $args[2] will contain -> ALLUSERS=1
Enter fullscreen modeExit fullscreen mode

Very easy if you know how.

Top comments(0)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

  • Work
    Application Engineer
  • Joined

Trending onDEV CommunityHot

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp