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.
Example
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
Comments
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.
https://learn.microsoft.com/en-us/windows/package-manager/winget/install#:~:text=%2D%2Daccept%2Dpackage%2Dagreements,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)
{
$ProgressPreference='Silent'
Invoke-WebRequest -Uri https://github.com/microsoft/winget-cli/releases/download/v1.3.2691/Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle -OutFile .\Microsoft.DesktopAppInstaller_8wekyb3d8bbwe.msixbundle
Invoke-WebRequest -Uri https://aka.ms/Microsoft.VCLibs.x64.14.00.Desktop.appx -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....
I had the same issue to deploy the non commercial version of vantage. You can run single steps as a different users than System or the service account.
In the "Options" tab of the specific step you are running your script in, select Run As -> Logged in user.
My command is literally just:
winget install "Lenovo Vantage" --source msstore --accept-package-agreements
Anyone trying to get winget upgrades to work?
I'm trying to get "winget upgrade" to work by wrapping it in a .ps1 file with some code that updates winget if it's missing:
It fails most of the time with this error. Any ideas?
Failed when searching source: winget
An unexpected error occurred while executing the command:
0x8a15000f : Data required by the source is missing
I tried resetting the sources, and setting --locale en-us --source winget and that didn't help.
I have also tried running as Logged on user, but then it can't find winget.
WinGet can be ran as System. If you wanted to install VLC for example, using WinGet as System:
(Credit to Reddit user u/naps1saps)
I modified it a little to silently install Creative Cloud, as System, using PDQ Connect:
Hammond, Ed Did you figure out how to use WInget to upgrade?
I totally missed Brad's post until just now.
I took the code he posted and modified it for Upgrade --all running as System and it worked!