Deploy via User
Thanks to https://azurecloudai.blog/2023/03/20/76277/ , this is how to deploy User Apps
Make sure launched at User
cmd /c winget install -e –id Microsoft.VisualStudioCode.Insiders –silent –force –accept-package-agreements –accept-source-agreements
cmd /c winget uninstall -e –id Microsoft.VisualStudioCode.Insiders
To Deploy Apps as SYSTEM
No Need to package Individual Files now https://github.com/Romanitho/Winget-Install
Package up the two .ps1 files
#install App
$app_2upgrade = "TeamViewer.TeamViewer.Host"
try{
$Winget = Get-ChildItem -Path (Join-Path -Path (Join-Path -Path $env:ProgramFiles -ChildPath "WindowsApps") -ChildPath "Microsoft.DesktopAppInstaller*\winget.exe")
# install command
&$winget install --exact $app_2upgrade --silent --force --accept-package-agreements --accept-source-agreements
exit 0
}catch{
Write-Error "Error while installing upgrade for: $app_2upgrade"
exit 1
}
#uninstall app
$app_2upgrade = "TeamViewer.TeamViewer.Host"
try{
$Winget = Get-ChildItem -Path (Join-Path -Path (Join-Path -Path $env:ProgramFiles -ChildPath "WindowsApps") -ChildPath "Microsoft.DesktopAppInstaller*\winget.exe")
# upgrade command
&$winget uninstall --exact $app_2upgrade
exit 0
}catch{
Write-Error "Error while installing upgrade for: $app_2upgrade"
exit 1
}
Install Command
%SystemRoot%\SysNative\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass .\InstallTeamviewer.ps1
Uninstall Command
%SystemRoot%\SysNative\WindowsPowerShell\v1.0\powershell.exe -executionpolicy bypass .\Uninstallteamviewer.ps1
UPGRADE
https://github.com/JayRHa/EndpointAnalyticsRemediationScripts/tree/main/Winget-Update-All