Solved

Trouble with getting software to install and update using WINGET -- Clourdflare WARP

  • 16 February 2024
  • 5 replies
  • 119 views

Badge

I have a script that works just fine locally through PowerShell. However I am running into a major pain. It seems that winget wont work with automox as it runs in the system context which is incompatible with winget. Has anyone found a solution to this. I have tried set-location i have tried uploading winget.exe to the worklet. This is causing my brain to hurt. Specifically this is checking if Cloudflare WARP is installed and if not installing it and if so updating it all using winget.

icon

Best answer by MarkH-Automox 16 February 2024, 22:12

View original

5 replies

Userlevel 4
Badge

Hi Joseph, 

We had a similar post this morning. This should get you squared away:
 

 

 

Userlevel 4
Badge

I just went ahead and threw a policy together for you if you want to install it, otherwise a Worklet will list installed apps would totally work if you just want the visibility. I want to include however, that WARP will be found on the Software page so you can just do a quick audit on that page to get the same information.

 

 

Badge

I just went ahead and threw a policy together for you if you want to install it, otherwise a Worklet will list installed apps would totally work if you just want the visibility. I want to include however, that WARP will be found on the Software page so you can just do a quick audit on that page to get the same information.

 

 

This worked for installation AMAZINGLY

I have one question. I am also trying to script it to check for updates to WARP….
 

#Cloudflare install
# this works Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -like "*$CloudFlare WARP*"} to find
# Define the name of the software to check
$ResolveWingetPath = Resolve-Path "C:\Program Files\WindowsApps\Microsoft.DesktopAppInstaller_*_x64__8wekyb3d8bbwe"
if ($ResolveWingetPath){
$WingetPath = $ResolveWingetPath[-1].Path
}

$config
Set-Location $wingetpath
$softwareName = "Cloudflare WARP"

# Check if the software is installed. This will find the software no matter the installation method whether through the CloudFlare-Warp
# msi/exe or through the Winget command. Essetially it is saying "if there isn't a wmi object with the name "CloudFlare Warp
if (-not (Get-WmiObject -Class Win32_Product | Where-Object {$_.Name -like "*$softwareName*"})) {
# Software is not installed, proceed with installation

# Start the installation process. This will install via Winget (may require elevated commands to bypass UAC)
Write-Host "Installing $softwareName"
.\winget install --id=Cloudflare.Warp -s winget -h

}
else {
# this will check installed version vs most recent available and if need upgrade if not will not
Write-Host "Upgrading $softwareName"
.\winget upgrade --id=Cloudflare.Warp
}

The above script works when ran locally. It will install if not present and update it if present. However when ran via automox it will install if not present and “appears” to update according to logs (see image below)
 

However the software remains at an older version.

Any thoughts/ideas what may be preventing the update when ran through Automox when the install function works perfectly.

Userlevel 4
Badge

My recommendation might just be to utilize Winget to know if there is an update. This was the argument I came up with, basically if ‘Available’ shows up in my query I know it is out of date. If you specifically list the app id and it is up to date, you won’t see ‘Available’ anywhere (case sensitive).

if (./winget list --id winscp.winscp | findstr Available) {
# this will check installed version vs most recent available and if need upgrade if not will not
Write-Host "Upgrading Winscp"
.\winget upgrade --id=winscp.winscp
}


This would be good code for a Worklet instead of a RS policy.
Evaluation:

if (./winget list --id winscp.winscp | findstr Available) {
Write-Host "WinSCP out of date"
exit 1
}
else
{
exit 0
}

Hope that helps.

Badge

Thanks so much for all your help. I will run this by my manager and see which direction he wants to go. Though I have to admit you are some kinda automox powershell guru

Reply