mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 02:22:34 -05:00
Compare commits
24 Commits
7d36a688a0
...
24.07.18
Author | SHA1 | Date | |
---|---|---|---|
e82870da89 | |||
e784604a1a | |||
e8022b8556 | |||
e7ed7829cf | |||
508f909fc9 | |||
60a6c387e2 | |||
1307abc1d6 | |||
45a103f76b | |||
b84c0d9248 | |||
f51c30023a | |||
bce4868896 | |||
8141baa879 | |||
280f8a7dbc | |||
0a472c06c4 | |||
1c72007a29 | |||
07434f706b | |||
4176435ebf | |||
a38cfb14d3 | |||
b319c32ae6 | |||
829e46b3a8 | |||
2304b06f68 | |||
c90363181c | |||
5d3d47eeb5 | |||
bc213d34d9 |
9
.github/dependabot.yml
vendored
Normal file
9
.github/dependabot.yml
vendored
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
version: 2
|
||||||
|
updates:
|
||||||
|
- package-ecosystem: "github-actions"
|
||||||
|
directory: "/"
|
||||||
|
schedule:
|
||||||
|
interval: "weekly"
|
||||||
|
ignore:
|
||||||
|
- dependency-name: "actions/stale"
|
||||||
|
versions: '>= 9'
|
2
.github/workflows/close-discussion.yml
vendored
2
.github/workflows/close-discussion.yml
vendored
@ -16,7 +16,7 @@ jobs:
|
|||||||
if: github.event.pull_request.merged == true
|
if: github.event.pull_request.merged == true
|
||||||
id: extract-discussion
|
id: extract-discussion
|
||||||
run: |
|
run: |
|
||||||
echo "::set-output name=discussion::$(echo "${{ github.event.pull_request.body }}" | grep -oP '(?<=Resolves #)\d+')"
|
echo "discussion=$(echo '${{ github.event.pull_request.body }}' | grep -oP '(?<=Resolves #)\d+')" >> $GITHUB_OUTPUT
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
||||||
- name: Close the discussion
|
- name: Close the discussion
|
||||||
|
26
.github/workflows/createchangelog.yml
vendored
26
.github/workflows/createchangelog.yml
vendored
@ -2,7 +2,8 @@ name: Update update.mb on Release
|
|||||||
|
|
||||||
on:
|
on:
|
||||||
release:
|
release:
|
||||||
types: [published]
|
types: [published, prereleased]
|
||||||
|
workflow_dispatch: # Add this line to enable manual triggering
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
update-file:
|
update-file:
|
||||||
@ -10,24 +11,25 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Get latest release and update update.mb file
|
- name: Get all releases and update update.mb file
|
||||||
run: |
|
run: |
|
||||||
# Fetch the latest release using GitHub CLI
|
# Fetch all releases including pre-releases using GitHub CLI
|
||||||
latest_release=$(gh release view --json tagName,name,body --jq '{tag: .tagName, name: .name, body: .body}')
|
gh release list --limit 5 > releases.txt
|
||||||
|
|
||||||
# Extract details
|
# Extract numeric versions and create update.mb content
|
||||||
tag=$(echo "$latest_release" | jq -r '.tag')
|
echo "" > docs/update.mb
|
||||||
name=$(echo "$latest_release" | jq -r '.name')
|
while read -r line; do
|
||||||
body=$(echo "$latest_release" | jq -r '.body')
|
tag=$(echo "$line" | awk '{print $1}')
|
||||||
|
name=$(echo "$line" | awk -F'\t' '{print $2}')
|
||||||
version_numeric=$(echo "$tag" | grep -o -E '[0-9.]+')
|
version_numeric=$(echo "$tag" | grep -o -E '[0-9.]+')
|
||||||
|
body=$(gh release view "$tag" --json body --jq .body)
|
||||||
# Append to update.mb
|
|
||||||
echo "## $version_numeric" >> docs/update.mb
|
echo "## $version_numeric" >> docs/update.mb
|
||||||
echo "Release name: $name" >> docs/update.mb
|
echo "Release name: $name" >> docs/update.mb
|
||||||
echo "Release body: $body" >> docs/update.mb
|
echo "Release body: $body" >> docs/update.mb
|
||||||
echo "" >> docs/update.mb
|
echo "" >> docs/update.mb
|
||||||
|
done < releases.txt
|
||||||
|
|
||||||
- name: Commit and Push Changes
|
- name: Commit and Push Changes
|
||||||
env:
|
env:
|
||||||
@ -36,5 +38,5 @@ jobs:
|
|||||||
git config --global user.name 'github-actions[bot]'
|
git config --global user.name 'github-actions[bot]'
|
||||||
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
|
||||||
git add docs/update.mb
|
git add docs/update.mb
|
||||||
git commit -m "Update update.mb with latest release"
|
git commit -m "Update update.mb with all releases"
|
||||||
git push
|
git push
|
11
.github/workflows/github-pages.yml
vendored
11
.github/workflows/github-pages.yml
vendored
@ -1,20 +1,19 @@
|
|||||||
name: GitHub Pages Deploy
|
name: GitHub Pages Deploy
|
||||||
on:
|
on:
|
||||||
push:
|
release:
|
||||||
branches:
|
types: [published, prereleased]
|
||||||
- master
|
workflow_dispatch:
|
||||||
- main
|
|
||||||
permissions:
|
permissions:
|
||||||
contents: write
|
contents: write
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
deploy:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v3
|
- uses: actions/checkout@v4
|
||||||
- uses: actions/setup-python@v4
|
- uses: actions/setup-python@v4
|
||||||
with:
|
with:
|
||||||
python-version: 3.x
|
python-version: 3.x
|
||||||
- uses: actions/cache@v2
|
- uses: actions/cache@v4
|
||||||
with:
|
with:
|
||||||
key: ${{ github.ref }}
|
key: ${{ github.ref }}
|
||||||
path: .cache
|
path: .cache
|
||||||
|
41
.github/workflows/pre-release.yaml
vendored
41
.github/workflows/pre-release.yaml
vendored
@ -1,17 +1,15 @@
|
|||||||
name: Pre-Release WinUtil
|
name: Pre-Release WinUtil
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
actions: read
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_run:
|
|
||||||
workflows: ["Compile"] #Ensure Compile winget.ps1 is done
|
|
||||||
types:
|
|
||||||
- completed
|
|
||||||
workflow_dispatch: # Manual trigger added
|
workflow_dispatch: # Manual trigger added
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-runspace:
|
build-runspace:
|
||||||
runs-on: windows-latest
|
runs-on: windows-latest
|
||||||
outputs:
|
|
||||||
version: ${{ steps.extract_version.outputs.version }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@ -19,18 +17,19 @@ jobs:
|
|||||||
- name: Extract Version from winutil.ps1
|
- name: Extract Version from winutil.ps1
|
||||||
id: extract_version
|
id: extract_version
|
||||||
run: |
|
run: |
|
||||||
$version = ''
|
$version = (Get-Date -Format "yy.MM.dd")
|
||||||
Get-Content ./winutil.ps1 -TotalCount 30 | ForEach-Object {
|
echo "version=$version" >> $env:GITHUB_ENV
|
||||||
if ($_ -match 'Version\s*:\s*(\d{2}\.\d{2}\.\d{2})') {
|
shell: pwsh
|
||||||
$version = "pre"+$matches[1]
|
|
||||||
echo "version=$version" >> $GITHUB_ENV
|
- name: Create Tag
|
||||||
echo "::set-output name=version::$version"
|
id: create_tag
|
||||||
break
|
run: |
|
||||||
}
|
$tagExists = git tag -l $env:VERSION
|
||||||
}
|
if ($tagExists -eq "") {
|
||||||
if (-not $version) {
|
git tag $env:VERSION
|
||||||
Write-Error "Version not found in winutil.ps1"
|
git push origin $env:VERSION
|
||||||
exit 1
|
} else {
|
||||||
|
Write-Host "Tag $env:VERSION already exists, skipping tag creation"
|
||||||
}
|
}
|
||||||
shell: pwsh
|
shell: pwsh
|
||||||
|
|
||||||
@ -38,9 +37,9 @@ jobs:
|
|||||||
id: create_release
|
id: create_release
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
tag_name: ${{ steps.extract_version.outputs.version }}
|
tag_name: ${{ env.VERSION }}
|
||||||
name: Pre-Release ${{ steps.extract_version.outputs.version }}
|
name: Pre-Release ${{ env.VERSION }}
|
||||||
body: ""
|
body: ""
|
||||||
append_body: false
|
append_body: false
|
||||||
files: ./winutil.ps1
|
files: ./winutil.ps1
|
||||||
prerelease: true
|
prerelease: true
|
||||||
|
3
.github/workflows/release.yaml
vendored
3
.github/workflows/release.yaml
vendored
@ -19,8 +19,7 @@ jobs:
|
|||||||
Get-Content ./winutil.ps1 -TotalCount 30 | ForEach-Object {
|
Get-Content ./winutil.ps1 -TotalCount 30 | ForEach-Object {
|
||||||
if ($_ -match 'Version\s*:\s*(\d{2}\.\d{2}\.\d{2})') {
|
if ($_ -match 'Version\s*:\s*(\d{2}\.\d{2}\.\d{2})') {
|
||||||
$version = $matches[1]
|
$version = $matches[1]
|
||||||
echo "version=$version" >> $GITHUB_ENV
|
echo "version=$version" >> $GITHUB_OUTPUT
|
||||||
echo "::set-output name=version::$version"
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
2
.github/workflows/sponsors.yml
vendored
2
.github/workflows/sponsors.yml
vendored
@ -10,7 +10,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout 🛎️
|
- name: Checkout 🛎️
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Generate Sponsors 💖
|
- name: Generate Sponsors 💖
|
||||||
uses: JamesIves/github-sponsors-readme-action@v1
|
uses: JamesIves/github-sponsors-readme-action@v1
|
||||||
|
4
.github/workflows/unittests.yaml
vendored
4
.github/workflows/unittests.yaml
vendored
@ -8,7 +8,7 @@ jobs:
|
|||||||
name: PS Script Analyzer
|
name: PS Script Analyzer
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v4
|
||||||
- name: lint
|
- name: lint
|
||||||
uses: devblackops/github-action-psscriptanalyzer@master
|
uses: devblackops/github-action-psscriptanalyzer@master
|
||||||
with:
|
with:
|
||||||
@ -22,7 +22,7 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Install Pester
|
- name: Install Pester
|
||||||
run: |
|
run: |
|
||||||
|
@ -54,7 +54,7 @@ If you have Issues, refer to [Known Issues](https://christitustech.github.io/win
|
|||||||
|
|
||||||
These are the sponsors that help keep this project alive with monthly contributions.
|
These are the sponsors that help keep this project alive with monthly contributions.
|
||||||
|
|
||||||
<!-- sponsors --><a href="https://github.com/GregoryNavasarkian"><img src="https://github.com/GregoryNavasarkian.png" width="60px" alt="Gregory Navasarkian" /></a><a href="https://github.com/ysaito8015"><img src="https://github.com/ysaito8015.png" width="60px" alt="Yusuke Saito" /></a><a href="https://github.com/TriHydera"><img src="https://github.com/TriHydera.png" width="60px" alt="TriHydera" /></a><a href="https://github.com/jozozovko"><img src="https://github.com/jozozovko.png" width="60px" alt="" /></a><a href="https://github.com/DelDongo"><img src="https://github.com/DelDongo.png" width="60px" alt="" /></a><a href="https://github.com/markamos"><img src="https://github.com/markamos.png" width="60px" alt="Mark Amos" /></a><a href="https://github.com/dwelfusius"><img src="https://github.com/dwelfusius.png" width="60px" alt="" /></a><a href="https://github.com/mews-se"><img src="https://github.com/mews-se.png" width="60px" alt="" /></a><a href="https://github.com/jdiegmueller"><img src="https://github.com/jdiegmueller.png" width="60px" alt="Jason A. Diegmueller" /></a><a href="https://github.com/AlanTristar"><img src="https://github.com/AlanTristar.png" width="60px" alt="" /></a><a href="https://github.com/JennJones89"><img src="https://github.com/JennJones89.png" width="60px" alt="" /></a><a href="https://github.com/broganbranstetter"><img src="https://github.com/broganbranstetter.png" width="60px" alt="Brogan Branstetter" /></a><a href="https://github.com/zepled112"><img src="https://github.com/zepled112.png" width="60px" alt="wyatt" /></a><a href="https://github.com/TDWillingham"><img src="https://github.com/TDWillingham.png" width="60px" alt="MetalliDan28" /></a><a href="https://github.com/frankolivares"><img src="https://github.com/frankolivares.png" width="60px" alt="" /></a><a href="https://github.com/Cube707"><img src="https://github.com/Cube707.png" width="60px" alt="Jan Wille" /></a><a href="https://github.com/Owen-3456"><img src="https://github.com/Owen-3456.png" width="60px" alt="Owen" /></a><a href="https://github.com/altugtekiner"><img src="https://github.com/altugtekiner.png" width="60px" alt="" /></a><a href="https://github.com/getsmor"><img src="https://github.com/getsmor.png" width="60px" alt="" /></a><a href="https://github.com/robertsandrock"><img src="https://github.com/robertsandrock.png" width="60px" alt="" /></a><a href="https://github.com/jeffnesbit"><img src="https://github.com/jeffnesbit.png" width="60px" alt="" /></a><a href="https://github.com/mmomega"><img src="https://github.com/mmomega.png" width="60px" alt="" /></a><a href="https://github.com/KenichiQaz"><img src="https://github.com/KenichiQaz.png" width="60px" alt="Stefan" /></a><!-- sponsors -->
|
<!-- sponsors --><a href="https://github.com/GregoryNavasarkian"><img src="https://github.com/GregoryNavasarkian.png" width="60px" alt="Gregory Navasarkian" /></a><a href="https://github.com/ysaito8015"><img src="https://github.com/ysaito8015.png" width="60px" alt="Yusuke Saito" /></a><a href="https://github.com/TriHydera"><img src="https://github.com/TriHydera.png" width="60px" alt="TriHydera" /></a><a href="https://github.com/jozozovko"><img src="https://github.com/jozozovko.png" width="60px" alt="" /></a><a href="https://github.com/DelDongo"><img src="https://github.com/DelDongo.png" width="60px" alt="" /></a><a href="https://github.com/markamos"><img src="https://github.com/markamos.png" width="60px" alt="Mark Amos" /></a><a href="https://github.com/dwelfusius"><img src="https://github.com/dwelfusius.png" width="60px" alt="" /></a><a href="https://github.com/mews-se"><img src="https://github.com/mews-se.png" width="60px" alt="" /></a><a href="https://github.com/jdiegmueller"><img src="https://github.com/jdiegmueller.png" width="60px" alt="Jason A. Diegmueller" /></a><a href="https://github.com/AlanTristar"><img src="https://github.com/AlanTristar.png" width="60px" alt="" /></a><a href="https://github.com/JennJones89"><img src="https://github.com/JennJones89.png" width="60px" alt="" /></a><a href="https://github.com/zepled112"><img src="https://github.com/zepled112.png" width="60px" alt="wyatt" /></a><a href="https://github.com/TDWillingham"><img src="https://github.com/TDWillingham.png" width="60px" alt="MetalliDan28" /></a><a href="https://github.com/frankolivares"><img src="https://github.com/frankolivares.png" width="60px" alt="" /></a><a href="https://github.com/Cube707"><img src="https://github.com/Cube707.png" width="60px" alt="Jan Wille" /></a><a href="https://github.com/Owen-3456"><img src="https://github.com/Owen-3456.png" width="60px" alt="Owen" /></a><a href="https://github.com/altugtekiner"><img src="https://github.com/altugtekiner.png" width="60px" alt="" /></a><a href="https://github.com/getsmor"><img src="https://github.com/getsmor.png" width="60px" alt="" /></a><a href="https://github.com/robertsandrock"><img src="https://github.com/robertsandrock.png" width="60px" alt="" /></a><a href="https://github.com/jeffnesbit"><img src="https://github.com/jeffnesbit.png" width="60px" alt="" /></a><a href="https://github.com/mmomega"><img src="https://github.com/mmomega.png" width="60px" alt="" /></a><a href="https://github.com/KenichiQaz"><img src="https://github.com/KenichiQaz.png" width="60px" alt="Stefan" /></a><a href="https://github.com/thaddl"><img src="https://github.com/thaddl.png" width="60px" alt="thaddl" /></a><a href="https://github.com/paulsheets"><img src="https://github.com/paulsheets.png" width="60px" alt="" /></a><a href="https://github.com/djones369"><img src="https://github.com/djones369.png" width="60px" alt="Dave Jones" /></a><!-- sponsors -->
|
||||||
|
|
||||||
## 🏅 Thanks to all Contributors
|
## 🏅 Thanks to all Contributors
|
||||||
Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻.
|
Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻.
|
||||||
|
@ -22,18 +22,17 @@ Function Install-WinUtilProgramWinget {
|
|||||||
[Parameter(Position=1)]
|
[Parameter(Position=1)]
|
||||||
[String]$manage = "Installing"
|
[String]$manage = "Installing"
|
||||||
)
|
)
|
||||||
|
$x = 0
|
||||||
$count = $ProgramsToInstall.Count
|
$count = $ProgramsToInstall.Count
|
||||||
|
|
||||||
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
|
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
Write-Host "-- Configuring winget packages ---"
|
Write-Host "-- Configuring winget packages ---"
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
for ($i = 0; $i -le $ProgramsToInstall.Count; $i++) {
|
Foreach ($Program in $ProgramsToInstall){
|
||||||
$Program = $ProgramsToInstall[$i]
|
|
||||||
$failedPackages = @()
|
$failedPackages = @()
|
||||||
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($i + 1) of $count" -PercentComplete $(($i/$count) * 100)
|
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($x + 1) of $count" -PercentComplete $($x/$count*100)
|
||||||
if($manage -eq "Installing") {
|
if($manage -eq "Installing"){
|
||||||
# Install package via ID, if it fails try again with different scope and then with an unelevated prompt.
|
# Install package via ID, if it fails try again with different scope and then with an unelevated prompt.
|
||||||
# Since Install-WinGetPackage might not be directly available, we use winget install command as a workaround.
|
# Since Install-WinGetPackage might not be directly available, we use winget install command as a workaround.
|
||||||
# Winget, not all installers honor any of the following: System-wide, User Installs, or Unelevated Prompt OR Silent Install Mode.
|
# Winget, not all installers honor any of the following: System-wide, User Installs, or Unelevated Prompt OR Silent Install Mode.
|
||||||
@ -41,21 +40,21 @@ Function Install-WinUtilProgramWinget {
|
|||||||
Write-Host "Starting install of $($Program.winget) with winget."
|
Write-Host "Starting install of $($Program.winget) with winget."
|
||||||
try {
|
try {
|
||||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
|
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
|
||||||
if($status -eq 0) {
|
if($status -eq 0){
|
||||||
Write-Host "$($Program.winget) installed successfully."
|
Write-Host "$($Program.winget) installed successfully."
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ($status -eq -1978335189) {
|
if ($status -eq -1978335189){
|
||||||
Write-Host "$($Program.winget) No applicable update found"
|
Write-Host "$($Program.winget) No applicable update found"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
Write-Host "Attempt with User scope"
|
Write-Host "Attempt with User scope"
|
||||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --scope user --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
|
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --scope user --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
|
||||||
if($status -eq 0) {
|
if($status -eq 0){
|
||||||
Write-Host "$($Program.winget) installed successfully with User scope."
|
Write-Host "$($Program.winget) installed successfully with User scope."
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ($status -eq -1978335189) {
|
if ($status -eq -1978335189){
|
||||||
Write-Host "$($Program.winget) No applicable update found"
|
Write-Host "$($Program.winget) No applicable update found"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -69,11 +68,11 @@ Function Install-WinUtilProgramWinget {
|
|||||||
} else {
|
} else {
|
||||||
Write-Host "Skipping installation with specific user credentials."
|
Write-Host "Skipping installation with specific user credentials."
|
||||||
}
|
}
|
||||||
if($status -eq 0) {
|
if($status -eq 0){
|
||||||
Write-Host "$($Program.winget) installed successfully with User prompt."
|
Write-Host "$($Program.winget) installed successfully with User prompt."
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ($status -eq -1978335189) {
|
if ($status -eq -1978335189){
|
||||||
Write-Host "$($Program.winget) No applicable update found"
|
Write-Host "$($Program.winget) No applicable update found"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -82,11 +81,11 @@ Function Install-WinUtilProgramWinget {
|
|||||||
$failedPackages += $Program
|
$failedPackages += $Program
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif($manage -eq "Uninstalling") {
|
if($manage -eq "Uninstalling"){
|
||||||
# Uninstall package via ID using winget directly.
|
# Uninstall package via ID using winget directly.
|
||||||
try {
|
try {
|
||||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "uninstall --id $($Program.winget) --silent" -Wait -PassThru -NoNewWindow).ExitCode
|
$status = $(Start-Process -FilePath "winget" -ArgumentList "uninstall --id $($Program.winget) --silent" -Wait -PassThru -NoNewWindow).ExitCode
|
||||||
if($status -ne 0) {
|
if($status -ne 0){
|
||||||
Write-Host "Failed to uninstall $($Program.winget)."
|
Write-Host "Failed to uninstall $($Program.winget)."
|
||||||
} else {
|
} else {
|
||||||
Write-Host "$($Program.winget) uninstalled successfully."
|
Write-Host "$($Program.winget) uninstalled successfully."
|
||||||
@ -97,9 +96,7 @@ Function Install-WinUtilProgramWinget {
|
|||||||
$failedPackages += $Program
|
$failedPackages += $Program
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
$X++
|
||||||
throw "[Install-WinUtilProgramWinget] Invalid Value for Parameter 'manage', Provided Value is: $manage"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
||||||
return $failedPackages;
|
return $failedPackages;
|
||||||
|
33
winutil.ps1
33
winutil.ps1
@ -8,7 +8,7 @@
|
|||||||
Author : Chris Titus @christitustech
|
Author : Chris Titus @christitustech
|
||||||
Runspace Author: @DeveloperDurp
|
Runspace Author: @DeveloperDurp
|
||||||
GitHub : https://github.com/ChrisTitusTech
|
GitHub : https://github.com/ChrisTitusTech
|
||||||
Version : 24.07.16
|
Version : 24.07.17
|
||||||
#>
|
#>
|
||||||
param (
|
param (
|
||||||
[switch]$Debug,
|
[switch]$Debug,
|
||||||
@ -45,7 +45,7 @@ Add-Type -AssemblyName System.Windows.Forms
|
|||||||
# Variable to sync between runspaces
|
# Variable to sync between runspaces
|
||||||
$sync = [Hashtable]::Synchronized(@{})
|
$sync = [Hashtable]::Synchronized(@{})
|
||||||
$sync.PSScriptRoot = $PSScriptRoot
|
$sync.PSScriptRoot = $PSScriptRoot
|
||||||
$sync.version = "24.07.16"
|
$sync.version = "24.07.17"
|
||||||
$sync.configs = @{}
|
$sync.configs = @{}
|
||||||
$sync.ProcessRunning = $false
|
$sync.ProcessRunning = $false
|
||||||
|
|
||||||
@ -1001,18 +1001,17 @@ Function Install-WinUtilProgramWinget {
|
|||||||
[Parameter(Position=1)]
|
[Parameter(Position=1)]
|
||||||
[String]$manage = "Installing"
|
[String]$manage = "Installing"
|
||||||
)
|
)
|
||||||
|
$x = 0
|
||||||
$count = $ProgramsToInstall.Count
|
$count = $ProgramsToInstall.Count
|
||||||
|
|
||||||
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
|
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
Write-Host "-- Configuring winget packages ---"
|
Write-Host "-- Configuring winget packages ---"
|
||||||
Write-Host "==========================================="
|
Write-Host "==========================================="
|
||||||
for ($i = 0; $i -le $ProgramsToInstall.Count; $i++) {
|
Foreach ($Program in $ProgramsToInstall){
|
||||||
$Program = $ProgramsToInstall[$i]
|
|
||||||
$failedPackages = @()
|
$failedPackages = @()
|
||||||
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($i + 1) of $count" -PercentComplete $(($i/$count) * 100)
|
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.winget) $($x + 1) of $count" -PercentComplete $($x/$count*100)
|
||||||
if($manage -eq "Installing") {
|
if($manage -eq "Installing"){
|
||||||
# Install package via ID, if it fails try again with different scope and then with an unelevated prompt.
|
# Install package via ID, if it fails try again with different scope and then with an unelevated prompt.
|
||||||
# Since Install-WinGetPackage might not be directly available, we use winget install command as a workaround.
|
# Since Install-WinGetPackage might not be directly available, we use winget install command as a workaround.
|
||||||
# Winget, not all installers honor any of the following: System-wide, User Installs, or Unelevated Prompt OR Silent Install Mode.
|
# Winget, not all installers honor any of the following: System-wide, User Installs, or Unelevated Prompt OR Silent Install Mode.
|
||||||
@ -1020,21 +1019,21 @@ Function Install-WinUtilProgramWinget {
|
|||||||
Write-Host "Starting install of $($Program.winget) with winget."
|
Write-Host "Starting install of $($Program.winget) with winget."
|
||||||
try {
|
try {
|
||||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
|
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
|
||||||
if($status -eq 0) {
|
if($status -eq 0){
|
||||||
Write-Host "$($Program.winget) installed successfully."
|
Write-Host "$($Program.winget) installed successfully."
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ($status -eq -1978335189) {
|
if ($status -eq -1978335189){
|
||||||
Write-Host "$($Program.winget) No applicable update found"
|
Write-Host "$($Program.winget) No applicable update found"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
Write-Host "Attempt with User scope"
|
Write-Host "Attempt with User scope"
|
||||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --scope user --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
|
$status = $(Start-Process -FilePath "winget" -ArgumentList "install --id $($Program.winget) --scope user --silent --accept-source-agreements --accept-package-agreements" -Wait -PassThru -NoNewWindow).ExitCode
|
||||||
if($status -eq 0) {
|
if($status -eq 0){
|
||||||
Write-Host "$($Program.winget) installed successfully with User scope."
|
Write-Host "$($Program.winget) installed successfully with User scope."
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ($status -eq -1978335189) {
|
if ($status -eq -1978335189){
|
||||||
Write-Host "$($Program.winget) No applicable update found"
|
Write-Host "$($Program.winget) No applicable update found"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -1048,11 +1047,11 @@ Function Install-WinUtilProgramWinget {
|
|||||||
} else {
|
} else {
|
||||||
Write-Host "Skipping installation with specific user credentials."
|
Write-Host "Skipping installation with specific user credentials."
|
||||||
}
|
}
|
||||||
if($status -eq 0) {
|
if($status -eq 0){
|
||||||
Write-Host "$($Program.winget) installed successfully with User prompt."
|
Write-Host "$($Program.winget) installed successfully with User prompt."
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
if ($status -eq -1978335189) {
|
if ($status -eq -1978335189){
|
||||||
Write-Host "$($Program.winget) No applicable update found"
|
Write-Host "$($Program.winget) No applicable update found"
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -1061,11 +1060,11 @@ Function Install-WinUtilProgramWinget {
|
|||||||
$failedPackages += $Program
|
$failedPackages += $Program
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elseif($manage -eq "Uninstalling") {
|
if($manage -eq "Uninstalling"){
|
||||||
# Uninstall package via ID using winget directly.
|
# Uninstall package via ID using winget directly.
|
||||||
try {
|
try {
|
||||||
$status = $(Start-Process -FilePath "winget" -ArgumentList "uninstall --id $($Program.winget) --silent" -Wait -PassThru -NoNewWindow).ExitCode
|
$status = $(Start-Process -FilePath "winget" -ArgumentList "uninstall --id $($Program.winget) --silent" -Wait -PassThru -NoNewWindow).ExitCode
|
||||||
if($status -ne 0) {
|
if($status -ne 0){
|
||||||
Write-Host "Failed to uninstall $($Program.winget)."
|
Write-Host "Failed to uninstall $($Program.winget)."
|
||||||
} else {
|
} else {
|
||||||
Write-Host "$($Program.winget) uninstalled successfully."
|
Write-Host "$($Program.winget) uninstalled successfully."
|
||||||
@ -1076,9 +1075,7 @@ Function Install-WinUtilProgramWinget {
|
|||||||
$failedPackages += $Program
|
$failedPackages += $Program
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
$X++
|
||||||
throw "[Install-WinUtilProgramWinget] Invalid Value for Parameter 'manage', Provided Value is: $manage"
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
||||||
return $failedPackages;
|
return $failedPackages;
|
||||||
|
Reference in New Issue
Block a user