Using winget with pdq deploy?

So i am trying to install an app driectly from the microsoft store. I am able to do it on the machine using winget. I cannot do it through pdq is there a way to make this work?

James D solution is at the bottom wrap the winget in a ps1 file then run it that way.


winget install "lenovo commercial vantage" --accept-package-agreements --accept-source-agreements

is what i put directly into the ps section of pdq deploy and it threw errors. 

If i wrap that ps code into a ps1 file then execute that it worked flawlessly.

Thanks again James D



Date Votes
  • Can you share how you have your package setup and any errors you are getting when it fails through PDQ?

  • winget install "lenovo commercial vantage"

    after that it i hit enter on the remote machine. i tried the same command and it just doesnt work.

  • My guess is it's related to the user PDQ runs the commands as. Either the install is prompting for agreements, so it's not silent and it's asking for interaction. Or the session doesn't have access to Winget. This is just an assumption, it would help to see the errors you're getting and screenshots of the package configuration.

    See if you can integrate --accept-package-agreements and --accept-source-agreements into your script.,source%20license%20agreement%2C%20and%20avoid%20the%20prompt.

  • winget : The term 'winget' is not recognized as the name of a cmdlet, function, script file, or operable program. 
    Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
    At C:\Windows\AdminArsenal\PDQDeployRunner\service-1\exec\user.ps1:1 char:1
    + winget install "lenovo commercial vantage" --accept-package-agreement ...

    this is the ps output

  • Side Note. If your not, run the PowerShell step calling a PS1 file instead of pasting the script into the PowerShell step itself. This has helped alleviate issues for me, don't understand why it works better though.

    I don't think the PDQ user has access to the Winget app. I'd verifying the app is installed and run the install prior if it's not. Something like this.

    $Winget = Get-AppxPackage -AllUsers "*DesktopAppInstaller*"

    if($Null -eq $Winget)
        Invoke-WebRequest -Uri -OutFile .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
        Invoke-WebRequest -Uri -OutFile Microsoft.VCLibs.x64.14.00.Desktop.appx
        Add-AppxPackage Microsoft.VCLibs.x64.14.00.Desktop.appx
        Add-AppxPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle

  • James D this works. I just wrapped my script in a ps1 file and it worked... Kinda dumb but ive done worse work arounds....


Please sign in to leave a comment.

Didn't find what you were looking for?

New post