Forum Discussion
EPNAdam
Nov 27, 2024Brass Contributor
Winget in Remediation scripts
Does the remediation scripts and the execution envrionment support winget? Running this returns nothing: $version = winget --version | Out-String Have also tried to use the Start-Process app...
- Nov 28, 2024
Managed to get it working.
# Find the path to winget.exe $winget = Get-ChildItem "C:\Program Files\WindowsApps\" -Recurse -File | Where-Object { $_.Name -eq 'winget.exe' } | Select-Object -ExpandProperty FullName -First 1 if($winget) { Write-Host "- Found winget.exe at: $winget" Write-Host "- Checking winget version" $wingetVersion = & "$winget" --version Write-Host "Winget version: $wingetVersion" }
EPNAdam
Nov 28, 2024Brass Contributor
Managed to get it working.
# Find the path to winget.exe
$winget = Get-ChildItem "C:\Program Files\WindowsApps\" -Recurse -File | Where-Object { $_.Name -eq 'winget.exe' } | Select-Object -ExpandProperty FullName -First 1
if($winget) {
Write-Host "- Found winget.exe at: $winget"
Write-Host "- Checking winget version"
$wingetVersion = & "$winget" --version
Write-Host "Winget version: $wingetVersion"
}