Install winget AppID from Mods Template/Functions

pull/270/head
KnifMelti 2023-02-01 21:39:40 +01:00
parent 086fd00fec
commit 90c1d106e1
2 changed files with 15 additions and 1 deletions

View File

@ -59,6 +59,10 @@ $ReplaceText = ''
#Grant "Modify" for directory/file to "Authenticated Users" - multiple: "dir1","dir2"
$GrantPath = @("")
#Install App from Winget Repo, multiple: "appID1","appID2". Example:
#$AppID = @("Microsoft.PowerToys")
$AppID = @("")
#App to Run (as current logged-on user)
$RunUser = ""
$User = $True
@ -100,6 +104,9 @@ if ($File -and $FindText -and $ReplaceText) {
if ($GrantPath) {
Grant-ModsPath $GrantPath
}
if ($AppID) {
Install-ModsApp $AppID
}
if ($RunUser) {
Invoke-ModsApp $RunUser "" "" $User
}

View File

@ -152,7 +152,6 @@ function Uninstall-ModsApp ($App) {
}
Return
}
function Remove-ModsLnk ($Lnk) {
foreach ($link in $Lnk)
{
@ -230,3 +229,11 @@ function Grant-ModsPath ($GrantPath) {
}
Return
}
function Install-ModsApp ($AppID) {
foreach ($app in $AppID)
{
& $Winget install --id $app --accept-package-agreements --accept-source-agreements -h
}
Return
}