This commit is contained in:
240
.github/workflows/release_build.yml
vendored
Normal file
240
.github/workflows/release_build.yml
vendored
Normal file
@@ -0,0 +1,240 @@
|
|||||||
|
name: Build, Push, Publish
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '28 5 * * *'
|
||||||
|
workflow_run:
|
||||||
|
workflows: ["Sync Repo"]
|
||||||
|
types:
|
||||||
|
- completed
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
release:
|
||||||
|
name: Build & Release
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
packages: write
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: 📥 Checkout code with full history and tags
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Check if any tags exist
|
||||||
|
id: check_tags_exist
|
||||||
|
run: |
|
||||||
|
git fetch --tags
|
||||||
|
TAG_COUNT=$(git tag | wc -l)
|
||||||
|
if [ "$TAG_COUNT" -eq 0 ]; then
|
||||||
|
echo "has_tags=false" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "latest_tag=v0.0.0" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "has_tags=true" >> "$GITHUB_OUTPUT"
|
||||||
|
LATEST_TAG=$(git describe --tags --abbrev=0)
|
||||||
|
echo "latest_tag=$LATEST_TAG" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Check if meaningful commits exist since latest tag
|
||||||
|
id: check_commits
|
||||||
|
run: |
|
||||||
|
if [ "${{ steps.check_tags_exist.outputs.has_tags }}" = "false" ]; then
|
||||||
|
# No tags exist, so we should create first release
|
||||||
|
echo "commit_count=1" >> "$GITHUB_OUTPUT"
|
||||||
|
CHANGED_FILES=$(git ls-files | grep -v '^manifest.json$' || true)
|
||||||
|
if [ -n "$CHANGED_FILES" ]; then
|
||||||
|
echo "changed_files<<EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
printf '%s\n' "$CHANGED_FILES" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "changed_files=Initial release" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
LATEST_TAG="${{ steps.check_tags_exist.outputs.latest_tag }}"
|
||||||
|
CHANGED_FILES="$(git diff --name-only "${LATEST_TAG}..HEAD" | grep -v '^manifest.json$' || true)"
|
||||||
|
if [ -n "$CHANGED_FILES" ]; then
|
||||||
|
echo "commit_count=1" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "changed_files<<EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
printf '%s\n' "$CHANGED_FILES" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "commit_count=0" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: Get latest release tag (from GitHub API)
|
||||||
|
id: get_latest_release
|
||||||
|
run: |
|
||||||
|
LATEST_RELEASE_TAG=$(curl -sL -H "Accept: application/vnd.github+json" \
|
||||||
|
-H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
|
||||||
|
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest" | jq -r .tag_name)
|
||||||
|
if [ -z "$LATEST_RELEASE_TAG" ] || [ "$LATEST_RELEASE_TAG" = "null" ]; then
|
||||||
|
LATEST_RELEASE_TAG="v1.0.0"
|
||||||
|
fi
|
||||||
|
echo "latest_release_tag=$LATEST_RELEASE_TAG" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "latest_release_version=${LATEST_RELEASE_TAG#v}" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Sync manifest.json to last release version if behind (only when no meaningful commits)
|
||||||
|
# -------------------------------
|
||||||
|
- name: 🛠 Ensure manifest.json matches latest release version
|
||||||
|
if: steps.check_commits.outputs.commit_count == '0'
|
||||||
|
run: |
|
||||||
|
if [ -f manifest.json ]; then
|
||||||
|
MANIFEST_VERSION=$(jq -r '.version // empty' manifest.json)
|
||||||
|
else
|
||||||
|
MANIFEST_VERSION=""
|
||||||
|
fi
|
||||||
|
LATEST_RELEASE_VERSION="${{ steps.get_latest_release.outputs.latest_release_version }}"
|
||||||
|
PYTHON_CODE="from packaging import version; \
|
||||||
|
print(version.parse('$LATEST_RELEASE_VERSION') > version.parse('$MANIFEST_VERSION') if '$MANIFEST_VERSION' else True)"
|
||||||
|
NEED_UPDATE=$(python3 -c "$PYTHON_CODE")
|
||||||
|
if [ "$NEED_UPDATE" = "True" ]; then
|
||||||
|
echo "Updating manifest.json to version $LATEST_RELEASE_VERSION (sync with release)"
|
||||||
|
jq --arg v "$LATEST_RELEASE_VERSION" '.version = $v' manifest.json > tmp.json && mv tmp.json manifest.json
|
||||||
|
git config user.name "github-actions"
|
||||||
|
git config user.email "github-actions@github.com"
|
||||||
|
git add manifest.json
|
||||||
|
git commit -m "Sync manifest.json to release $LATEST_RELEASE_VERSION [🔄]" || echo "Nothing to commit"
|
||||||
|
git push origin main || true
|
||||||
|
else
|
||||||
|
echo "Manifest.json is already up-to-date with the latest release."
|
||||||
|
fi
|
||||||
|
|
||||||
|
# -------------------------------
|
||||||
|
# Continue normal workflow if commits exist
|
||||||
|
# -------------------------------
|
||||||
|
- name: 📃 Get list of changed files (Markdown bullet list)
|
||||||
|
if: steps.check_commits.outputs.commit_count != '0'
|
||||||
|
id: changed_files
|
||||||
|
run: |
|
||||||
|
BULLET_LIST="$(printf '%s\n' "${{ steps.check_commits.outputs.changed_files }}" | sed 's/^/- /')"
|
||||||
|
echo "CHANGED<<EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
printf '%s\n' "$BULLET_LIST" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "EOF" >> "$GITHUB_OUTPUT"
|
||||||
|
COUNT="$(printf '%s\n' "${{ steps.check_commits.outputs.changed_files }}" | wc -l)"
|
||||||
|
echo "COUNT=$COUNT" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Get manifest version
|
||||||
|
if: steps.check_commits.outputs.commit_count != '0'
|
||||||
|
id: get_manifest_version
|
||||||
|
run: |
|
||||||
|
if [ -f manifest.json ]; then
|
||||||
|
MANIFEST_VERSION=$(jq -r '.version // empty' manifest.json)
|
||||||
|
if [ -z "$MANIFEST_VERSION" ] || [ "$MANIFEST_VERSION" = "null" ]; then
|
||||||
|
MANIFEST_VERSION="1.0.0"
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
MANIFEST_VERSION="1.0.0"
|
||||||
|
fi
|
||||||
|
echo "manifest_version=$MANIFEST_VERSION" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: Pick base version
|
||||||
|
if: steps.check_commits.outputs.commit_count != '0'
|
||||||
|
id: pick_base_version
|
||||||
|
run: |
|
||||||
|
LATEST_RELEASE="${{ steps.get_latest_release.outputs.latest_release_version }}"
|
||||||
|
MANIFEST="${{ steps.get_manifest_version.outputs.manifest_version }}"
|
||||||
|
BASE_VERSION=$(python3 -c "from packaging import version; \
|
||||||
|
print(str(max(version.parse('$LATEST_RELEASE'), version.parse('$MANIFEST'))))")
|
||||||
|
echo "base_version=$BASE_VERSION" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: 🔢 Determine version
|
||||||
|
if: steps.check_commits.outputs.commit_count != '0'
|
||||||
|
id: version
|
||||||
|
run: |
|
||||||
|
BASE_VERSION="${{ steps.pick_base_version.outputs.base_version }}"
|
||||||
|
IFS='.' read -r MAJOR MINOR PATCH <<< "$BASE_VERSION"
|
||||||
|
COUNT="${{ steps.changed_files.outputs.COUNT }}"
|
||||||
|
if [ "$COUNT" -ge 5 ]; then
|
||||||
|
MAJOR=$((MAJOR + 1))
|
||||||
|
MINOR=0
|
||||||
|
PATCH=0
|
||||||
|
elif [ "$COUNT" -ge 3 ]; then
|
||||||
|
MINOR=$((MINOR + 1))
|
||||||
|
PATCH=0
|
||||||
|
else
|
||||||
|
PATCH=$((PATCH + 1))
|
||||||
|
fi
|
||||||
|
NEW_VERSION="${MAJOR}.${MINOR}.${PATCH}"
|
||||||
|
REPO_NAME="$(basename "$GITHUB_REPOSITORY")"
|
||||||
|
ZIP_NAME="${REPO_NAME}-${NEW_VERSION}.zip"
|
||||||
|
echo "VERSION=$NEW_VERSION" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "ZIP_NAME=$ZIP_NAME" >> "$GITHUB_OUTPUT"
|
||||||
|
echo "REPO_NAME=$REPO_NAME" >> "$GITHUB_OUTPUT"
|
||||||
|
|
||||||
|
- name: 🛠 Update or create manifest.json
|
||||||
|
if: steps.check_commits.outputs.commit_count != '0'
|
||||||
|
run: |
|
||||||
|
VERSION="${{ steps.version.outputs.VERSION }}"
|
||||||
|
AUTHOR="Ivan Carlos"
|
||||||
|
VERSION_FILE="manifest.json"
|
||||||
|
if [ -f "$VERSION_FILE" ]; then
|
||||||
|
jq --arg v "$VERSION" --arg a "$AUTHOR" \
|
||||||
|
'.version = $v | .author = $a' "$VERSION_FILE" > tmp.json && mv tmp.json "$VERSION_FILE"
|
||||||
|
else
|
||||||
|
echo "{ \"version\": \"$VERSION\", \"author\": \"$AUTHOR\" }" > "$VERSION_FILE"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 💾 Commit and push updated manifest.json
|
||||||
|
if: steps.check_commits.outputs.commit_count != '0'
|
||||||
|
run: |
|
||||||
|
git config user.name "github-actions"
|
||||||
|
git config user.email "github-actions@github.com"
|
||||||
|
git add manifest.json
|
||||||
|
git commit -m "Update manifest version to ${{ steps.version.outputs.VERSION }} [▶️]" || echo "Nothing to commit"
|
||||||
|
git push origin main
|
||||||
|
|
||||||
|
- name: 📦 Create ZIP package (excluding certain files)
|
||||||
|
if: steps.check_commits.outputs.commit_count != '0'
|
||||||
|
run: |
|
||||||
|
ZIP_NAME="${{ steps.version.outputs.ZIP_NAME }}"
|
||||||
|
zip -r "$ZIP_NAME" . -x ".git/*" ".github/*" "docker/*" ".dockerignore" "CNAME" "Dockerfile" "README.md" "LICENSE"
|
||||||
|
|
||||||
|
- name: 🚀 Create GitHub Release
|
||||||
|
if: steps.check_commits.outputs.commit_count != '0'
|
||||||
|
uses: softprops/action-gh-release@v2
|
||||||
|
with:
|
||||||
|
tag_name: "v${{ steps.version.outputs.VERSION }}"
|
||||||
|
name: "${{ steps.version.outputs.REPO_NAME }} v${{ steps.version.outputs.VERSION }}"
|
||||||
|
body: |
|
||||||
|
### Changelog
|
||||||
|
Files changed in this release:
|
||||||
|
${{ steps.changed_files.outputs.CHANGED }}
|
||||||
|
files: ${{ steps.version.outputs.ZIP_NAME }}
|
||||||
|
|
||||||
|
# ----- Docker steps -----
|
||||||
|
- name: 🔍 Check if Dockerfile exists
|
||||||
|
if: steps.check_commits.outputs.commit_count != '0'
|
||||||
|
id: dockerfile_check
|
||||||
|
run: |
|
||||||
|
if [ -f Dockerfile ]; then
|
||||||
|
echo "exists=true" >> "$GITHUB_OUTPUT"
|
||||||
|
else
|
||||||
|
echo "exists=false" >> "$GITHUB_OUTPUT"
|
||||||
|
fi
|
||||||
|
|
||||||
|
- name: 🛠 Set up Docker Buildx
|
||||||
|
if: steps.check_commits.outputs.commit_count != '0' && steps.dockerfile_check.outputs.exists == 'true'
|
||||||
|
uses: docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: 🔐 Login to GitHub Container Registry
|
||||||
|
if: steps.check_commits.outputs.commit_count != '0' && steps.dockerfile_check.outputs.exists == 'true'
|
||||||
|
uses: docker/login-action@v3
|
||||||
|
with:
|
||||||
|
registry: ghcr.io
|
||||||
|
username: ${{ github.actor }}
|
||||||
|
password: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
||||||
|
- name: 🐳 Build and Push Docker image
|
||||||
|
if: steps.check_commits.outputs.commit_count != '0' && steps.dockerfile_check.outputs.exists == 'true'
|
||||||
|
uses: docker/build-push-action@v5
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ghcr.io/${{ github.repository }}:latest
|
||||||
78
.github/workflows/update_readme.yml
vendored
Normal file
78
.github/workflows/update_readme.yml
vendored
Normal file
@@ -0,0 +1,78 @@
|
|||||||
|
name: Update README
|
||||||
|
|
||||||
|
# Allow GitHub Actions to commit and push changes
|
||||||
|
permissions:
|
||||||
|
contents: write
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
schedule:
|
||||||
|
- cron: '0 4 * * *' # Every day at 4 AM UTC
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
update-readme:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
|
env:
|
||||||
|
SOURCE_REPO: ivancarlosti/.github
|
||||||
|
SOURCE_BRANCH: main
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout current repository
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Checkout source README template
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
repository: ${{ env.SOURCE_REPO }}
|
||||||
|
ref: ${{ env.SOURCE_BRANCH }}
|
||||||
|
path: source_readme
|
||||||
|
|
||||||
|
- name: Update README.md (buttons and footer)
|
||||||
|
run: |
|
||||||
|
set -e
|
||||||
|
REPO_NAME="${GITHUB_REPOSITORY##*/}"
|
||||||
|
|
||||||
|
# --- Extract buttons block from source ---
|
||||||
|
BUTTONS=$(awk '/<!-- buttons -->/{flag=1;next}/<!-- endbuttons -->/{flag=0}flag' source_readme/README.md)
|
||||||
|
BUTTONS_UPDATED=$(echo "$BUTTONS" | sed "s/\.github/${REPO_NAME}/g")
|
||||||
|
|
||||||
|
# --- Extract footer block from source (everything from <!-- footer --> onward) ---
|
||||||
|
FOOTER=$(awk '/<!-- footer -->/{flag=1}flag' source_readme/README.md)
|
||||||
|
|
||||||
|
# --- Replace buttons section in README.md ---
|
||||||
|
UPDATED=$(awk -v buttons="$BUTTONS_UPDATED" '
|
||||||
|
BEGIN { skip=0 }
|
||||||
|
/<!-- buttons -->/ {
|
||||||
|
print
|
||||||
|
print buttons
|
||||||
|
skip=1
|
||||||
|
next
|
||||||
|
}
|
||||||
|
/<!-- endbuttons -->/ && skip {
|
||||||
|
print
|
||||||
|
skip=0
|
||||||
|
next
|
||||||
|
}
|
||||||
|
!skip { print }
|
||||||
|
' README.md)
|
||||||
|
|
||||||
|
# --- Replace everything after <!-- footer --> with FOOTER ---
|
||||||
|
echo "$UPDATED" | awk -v footer="$FOOTER" '
|
||||||
|
/<!-- footer -->/ {
|
||||||
|
print footer
|
||||||
|
found=1
|
||||||
|
exit
|
||||||
|
}
|
||||||
|
{ print }
|
||||||
|
' > README.tmp && mv README.tmp README.md
|
||||||
|
|
||||||
|
- name: Remove source_readme from git index
|
||||||
|
run: git rm --cached -r source_readme || true
|
||||||
|
|
||||||
|
- name: Commit and push changes
|
||||||
|
uses: stefanzweifel/git-auto-commit-action@v5
|
||||||
|
with:
|
||||||
|
file_pattern: README.md
|
||||||
|
commit_message: "Sync README from template [▶️]"
|
||||||
|
branch: ${{ github.ref_name }}
|
||||||
21
LICENSE
Normal file
21
LICENSE
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2025 Ivan Carlos de Almeida
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
||||||
39
README.md
39
README.md
@@ -1,2 +1,39 @@
|
|||||||
# wincomputerinfo
|
# Win Compute Info
|
||||||
|
|
||||||
|
<!-- buttons -->
|
||||||
|
[](https://github.com/ivancarlosti/wincomputerinfo/stargazers)
|
||||||
|
[](https://github.com/sponsors/ivancarlosti)
|
||||||
|
[](https://github.com/sponsors/ivancarlosti)
|
||||||
|
[](https://github.com/ivancarlosti/wincomputerinfo/pulse)
|
||||||
|
[](https://github.com/ivancarlosti/wincomputerinfo/issues)
|
||||||
|
[](LICENSE)
|
||||||
|
[](https://github.com/ivancarlosti/wincomputerinfo/commits)
|
||||||
|
[](https://github.com/ivancarlosti/wincomputerinfo/security)
|
||||||
|
[](https://github.com/ivancarlosti/wincomputerinfo?tab=coc-ov-file)
|
||||||
|
[][sponsor]
|
||||||
|
<!-- endbuttons -->
|
||||||
|
|
||||||
|
<!-- footer -->
|
||||||
|
---
|
||||||
|
|
||||||
|
## 🧑💻 Consulting and technical support
|
||||||
|
* For personal support and queries, please submit a new issue to have it addressed.
|
||||||
|
* For commercial related questions, please [**contact me**][ivancarlos] for consulting costs.
|
||||||
|
|
||||||
|
## 🩷 Project support
|
||||||
|
| If you found this project helpful, consider |
|
||||||
|
| :---: |
|
||||||
|
[**buying me a coffee**][buymeacoffee], [**donate by paypal**][paypal], [**sponsor this project**][sponsor] or just [**leave a star**](../..)⭐
|
||||||
|
|Thanks for your support, it is much appreciated!|
|
||||||
|
|
||||||
|
[cc]: https://docs.github.com/en/communities/setting-up-your-project-for-healthy-contributions/adding-a-code-of-conduct-to-your-project
|
||||||
|
[contributing]: https://docs.github.com/en/articles/setting-guidelines-for-repository-contributors
|
||||||
|
[security]: https://docs.github.com/en/code-security/getting-started/adding-a-security-policy-to-your-repository
|
||||||
|
[support]: https://docs.github.com/en/articles/adding-support-resources-to-your-project
|
||||||
|
[it]: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/configuring-issue-templates-for-your-repository#configuring-the-template-chooser
|
||||||
|
[prt]: https://docs.github.com/en/communities/using-templates-to-encourage-useful-issues-and-pull-requests/creating-a-pull-request-template-for-your-repository
|
||||||
|
[funding]: https://docs.github.com/en/articles/displaying-a-sponsor-button-in-your-repository
|
||||||
|
[ivancarlos]: https://ivancarlos.it
|
||||||
|
[buymeacoffee]: https://www.buymeacoffee.com/ivancarlos
|
||||||
|
[paypal]: https://icc.gg/donate
|
||||||
|
[sponsor]: https://github.com/sponsors/ivancarlosti
|
||||||
|
|||||||
50
cleariconcache.bat
Normal file
50
cleariconcache.bat
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
@echo off
|
||||||
|
set iconcache=%localappdata%\IconCache.db
|
||||||
|
set iconcache_x=%localappdata%\Microsoft\Windows\Explorer\iconcache*
|
||||||
|
|
||||||
|
echo.
|
||||||
|
echo The explorer process must be temporarily killed before deleting the IconCache.db file.
|
||||||
|
echo.
|
||||||
|
echo Please SAVE ALL OPEN WORK before continuing.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
echo.
|
||||||
|
If exist "%iconcache%" goto delete
|
||||||
|
echo.
|
||||||
|
echo The %localappdata%\IconCache.db file has already been deleted.
|
||||||
|
echo.
|
||||||
|
If exist "%iconcache_x%" goto delete
|
||||||
|
echo.
|
||||||
|
echo The %localappdata%\Microsoft\Windows\Explorer\IconCache_*.db files have already been deleted.
|
||||||
|
echo.
|
||||||
|
exit /B
|
||||||
|
|
||||||
|
|
||||||
|
:delete
|
||||||
|
echo.
|
||||||
|
echo Attempting to delete IconCache.db files...
|
||||||
|
echo.
|
||||||
|
ie4uinit.exe -show
|
||||||
|
taskkill /IM explorer.exe /F
|
||||||
|
If exist del /A /F /Q "%iconcache%"
|
||||||
|
If exist del /A /F /Q "%iconcache_x%"
|
||||||
|
start explorer.exe
|
||||||
|
echo.
|
||||||
|
echo IconCache database files have been successfully deleted.
|
||||||
|
goto restart
|
||||||
|
|
||||||
|
|
||||||
|
:restart
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo You will need to restart the PC to finish rebuilding your icon cache.
|
||||||
|
echo.
|
||||||
|
CHOICE /C:YN /M "Do you want to restart the PC now?"
|
||||||
|
IF ERRORLEVEL 2 goto no
|
||||||
|
IF ERRORLEVEL 1 goto yes
|
||||||
|
|
||||||
|
:yes
|
||||||
|
shutdown /r /f /t 00
|
||||||
|
|
||||||
|
:no
|
||||||
|
exit /B
|
||||||
20
clearspooler.bat
Normal file
20
clearspooler.bat
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
:: Prompt to Run as administrator
|
||||||
|
Set "Variable=0" & if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
|
||||||
|
fsutil dirty query %systemdrive% >nul 2>&1 && goto :(Privileges_got)
|
||||||
|
If "%1"=="%Variable%" (echo. &echo. Please right-click on the file and select &echo. "Run as administrator". &echo. Press any key to exit. &pause>nul 2>&1& exit)
|
||||||
|
cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%Variable%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs" & exit
|
||||||
|
:(Privileges_got)
|
||||||
|
|
||||||
|
net stop spooler
|
||||||
|
DEL /F /S /Q %systemroot%\System32\spool\PRINTERS\*
|
||||||
|
net start spooler
|
||||||
|
|
||||||
|
:endSuccess
|
||||||
|
echo Printer Spool tasks completed
|
||||||
|
echo.
|
||||||
|
|
||||||
|
:end
|
||||||
|
pause
|
||||||
|
exit
|
||||||
18
computerinfo.bat
Normal file
18
computerinfo.bat
Normal file
@@ -0,0 +1,18 @@
|
|||||||
|
@echo off
|
||||||
|
chcp 65001
|
||||||
|
cls
|
||||||
|
|
||||||
|
echo ### Please wait, collecting system information... ###
|
||||||
|
echo.
|
||||||
|
|
||||||
|
:: General system information
|
||||||
|
PowerShell -NoProfile -Command "$cs = Get-CimInstance Win32_ComputerSystem; $os = Get-CimInstance Win32_OperatingSystem; $version = $os.Version; $build = $os.BuildNumber; $ver = (Get-ItemProperty 'HKLM:\SOFTWARE\Microsoft\Windows NT\CurrentVersion' -ErrorAction SilentlyContinue).DisplayVersion; if (-not $ver) { $map = @{ '19041'='2004'; '19042'='20H2'; '19043'='21H1'; '19044'='21H2'; '19045'='22H2'; '22000'='21H2'; '22621'='22H2'; '22631'='23H2'; '26100'='24H2' }; $ver = $map[$build]; if (-not $ver) { $ver = 'Unknown' } }; $bios = Get-WmiObject -Class Win32_BIOS | Select-Object -ExpandProperty SerialNumber; $ram = [Math]::Round((Get-WmiObject -Class Win32_ComputerSystem).TotalPhysicalMemory / 1GB); $cpu = Get-WmiObject -Class Win32_Processor | Select-Object Name, NumberOfCores, NumberOfLogicalProcessors; $disk = Get-PhysicalDisk | Select-Object FriendlyName, MediaType; $logicalDisks = Get-WmiObject Win32_LogicalDisk -Filter 'DriveType=3'; $gpu = Get-WmiObject Win32_VideoController | Select-Object -ExpandProperty Name; $user = $env:USERNAME; $ip = (Get-NetIPAddress -AddressFamily IPv4 | Where-Object { $_.IPAddress -notlike '169.*' -and $_.IPAddress -ne '127.0.0.1' }).IPAddress; Write-Host '=== SYSTEM INFORMATION ============================================================'; Write-Host ('{0,-25} {1}' -f 'Host Name:', $cs.Name); Write-Host ('{0,-25} {1}' -f 'OS Name:', $os.Caption); Write-Host ('{0,-25} {1}' -f 'Windows Version:', $ver + ' (Build ' + $build + ')'); Write-Host ('{0,-25} {1}' -f 'Manufacturer / Model:', $cs.Manufacturer+' / '+$cs.Model); Write-Host ('{0,-25} {1}' -f 'Logged Username:', $user); Write-Host ('{0,-25} {1}' -f 'BIOS Serial Number:', $bios); Write-Host ('{0,-25} {1} GB' -f 'Installed RAM:', $ram); foreach ($item in $cpu) { Write-Host ('{0,-25} {1}' -f 'CPU Name:', $item.Name); Write-Host ('{0,-25} {1}' -f 'CPU Core / vCore:', $item.NumberOfCores+' Cores / '+$item.NumberOfLogicalProcessors+' Virtual Cores'); }; foreach ($g in $gpu) { Write-Host ('{0,-25} {1}' -f 'GPU:', $g); }; Write-Host ('{0,-25} {1}' -f 'IP Address:', ($ip -join ', ')); $i = 0; foreach ($d in $disk) { $i++; Write-Host ('{0,-25} {1}' -f ('Disk ' + $i + ' Name / Type:'), $d.FriendlyName+' / '+$d.MediaType); }; Write-Host ''; Write-Host '=== DISK USAGE ===================================================================='; foreach ($ld in $logicalDisks) { $total = [math]::Round($ld.Size / 1GB, 2); $free = [math]::Round($ld.FreeSpace / 1GB, 2); $used = $total - $free; $percentUsed = if ($total -ne 0) { [math]::Round(($used / $total) * 100, 2) } else { 0 }; Write-Host ('Drive {0} - Total: {1} GB, Used: {2} GB ({3}%%)' -f $ld.DeviceID, $total, $used, $percentUsed); }"
|
||||||
|
|
||||||
|
echo.
|
||||||
|
|
||||||
|
:: Antivirus detection with translated productState
|
||||||
|
echo === ANTIVIRUS SOFTWARE ============================================================
|
||||||
|
PowerShell -NoProfile -Command "Get-CimInstance -Namespace root/SecurityCenter2 -ClassName AntiVirusProduct | ForEach-Object { $state = $_.productState; $status = switch ($state) { 397568 {'Enabled'}; 393472 {'Disabled'}; 262144 {'Enabled'}; 262160 {'Enabled'}; 266240 {'Enabled'}; 266256 {'Enabled'}; 393216 {'Disabled'}; 397312 {'Disabled'}; default {'Unknown State (' + $state + ')'} }; Write-Host ('{0,-25} {1} / {2}' -f 'Name / State:', $_.displayName, $status); Write-Host ('{0,-25} {1}' -f 'Path:', $_.pathToSignedProductExe); Write-Host '' }"
|
||||||
|
|
||||||
|
echo ### Data collection completed. Please print or save the above ###
|
||||||
|
set /p dummyVar=
|
||||||
4
manifest.json
Normal file
4
manifest.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"version": "2.1.18",
|
||||||
|
"author": "Ivan Carlos"
|
||||||
|
}
|
||||||
197
repairwindowsupdate.bat
Normal file
197
repairwindowsupdate.bat
Normal file
@@ -0,0 +1,197 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
:: Prompt to Run as administrator
|
||||||
|
Set "Variable=0" & if exist "%temp%\getadmin.vbs" del "%temp%\getadmin.vbs"
|
||||||
|
fsutil dirty query %systemdrive% >nul 2>&1 && goto :(Privileges_got)
|
||||||
|
If "%1"=="%Variable%" (echo. &echo. Please right-click on the file and select &echo. "Run as administrator". &echo. Press any key to exit. &pause>nul 2>&1& exit)
|
||||||
|
cmd /u /c echo Set UAC = CreateObject^("Shell.Application"^) : UAC.ShellExecute "%~0", "%Variable%", "", "runas", 1 > "%temp%\getadmin.vbs"&cscript //nologo "%temp%\getadmin.vbs" & exit
|
||||||
|
:(Privileges_got)
|
||||||
|
|
||||||
|
:: Checking and Stopping the Windows Update services
|
||||||
|
set b=0
|
||||||
|
|
||||||
|
:bits
|
||||||
|
set /a b=%b%+1
|
||||||
|
if %b% equ 3 (
|
||||||
|
goto end1
|
||||||
|
)
|
||||||
|
net stop bits
|
||||||
|
echo Checking the bits service status.
|
||||||
|
sc query bits | findstr /I /C:"STOPPED"
|
||||||
|
if not %errorlevel%==0 (
|
||||||
|
goto bits
|
||||||
|
)
|
||||||
|
goto loop2
|
||||||
|
|
||||||
|
:end1
|
||||||
|
cls
|
||||||
|
echo.
|
||||||
|
echo Cannot reset Windows Update since "Background Intelligent Transfer Service" (bits) service failed to stop. Please restart the computer, and try again.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto Start
|
||||||
|
|
||||||
|
|
||||||
|
:loop2
|
||||||
|
set w=0
|
||||||
|
|
||||||
|
:wuauserv
|
||||||
|
set /a w=%w%+1
|
||||||
|
if %w% equ 3 (
|
||||||
|
goto end2
|
||||||
|
)
|
||||||
|
net stop wuauserv
|
||||||
|
echo Checking the wuauserv service status.
|
||||||
|
sc query wuauserv | findstr /I /C:"STOPPED"
|
||||||
|
if not %errorlevel%==0 (
|
||||||
|
goto wuauserv
|
||||||
|
)
|
||||||
|
goto loop3
|
||||||
|
|
||||||
|
:end2
|
||||||
|
cls
|
||||||
|
echo.
|
||||||
|
echo Cannot reset Windows Update since "Windows Update" (wuauserv) service failed to stop. Please restart the computer, and try again.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto Start
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
:loop3
|
||||||
|
set c=0
|
||||||
|
|
||||||
|
:cryptsvc
|
||||||
|
set /a c=%c%+1
|
||||||
|
if %c% equ 3 (
|
||||||
|
goto end4
|
||||||
|
)
|
||||||
|
net stop cryptsvc
|
||||||
|
echo Checking the cryptsvc service status.
|
||||||
|
sc query cryptsvc | findstr /I /C:"STOPPED"
|
||||||
|
if not %errorlevel%==0 (
|
||||||
|
goto cryptsvc
|
||||||
|
)
|
||||||
|
goto Reset
|
||||||
|
|
||||||
|
:end4
|
||||||
|
cls
|
||||||
|
echo.
|
||||||
|
echo Cannot reset Windows Update since "Cryptographic Services" (cryptsvc) service failed to stop. Please restart the computer, and try again.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
goto Start
|
||||||
|
|
||||||
|
|
||||||
|
:Reset
|
||||||
|
Ipconfig /flushdns
|
||||||
|
del /s /q /f "%ALLUSERSPROFILE%\Application Data\Microsoft\Network\Downloader\qmgr*.dat"
|
||||||
|
del /s /q /f "%ALLUSERSPROFILE%\Microsoft\Network\Downloader\qmgr*.dat"
|
||||||
|
del /s /q /f "%SYSTEMROOT%\Logs\WindowsUpdate\*"
|
||||||
|
|
||||||
|
if exist "C:\$WinREAgent" rmdir /s /q "C:\$WinREAgent"
|
||||||
|
|
||||||
|
if exist "%SYSTEMROOT%\winsxs\pending.xml.bak" del /s /q /f "%SYSTEMROOT%\winsxs\pending.xml.bak"
|
||||||
|
if exist "%SYSTEMROOT%\winsxs\pending.xml" (
|
||||||
|
takeown /f "%SYSTEMROOT%\winsxs\pending.xml"
|
||||||
|
attrib -r -s -h /s /d "%SYSTEMROOT%\winsxs\pending.xml"
|
||||||
|
ren "%SYSTEMROOT%\winsxs\pending.xml" pending.xml.bak
|
||||||
|
)
|
||||||
|
|
||||||
|
if exist "%SYSTEMROOT%\SoftwareDistribution\DataStore.bak" rmdir /s /q "%SYSTEMROOT%\SoftwareDistribution\DataStore.bak"
|
||||||
|
if exist "%SYSTEMROOT%\SoftwareDistribution\DataStore" (
|
||||||
|
attrib -r -s -h /s /d "%SYSTEMROOT%\SoftwareDistribution\DataStore"
|
||||||
|
ren "%SYSTEMROOT%\SoftwareDistribution\DataStore" DataStore.bak
|
||||||
|
)
|
||||||
|
|
||||||
|
if exist "%SYSTEMROOT%\SoftwareDistribution\Download.bak" rmdir /s /q "%SYSTEMROOT%\SoftwareDistribution\Download.bak"
|
||||||
|
if exist "%SYSTEMROOT%\SoftwareDistribution\Download" (
|
||||||
|
attrib -r -s -h /s /d "%SYSTEMROOT%\SoftwareDistribution\Download"
|
||||||
|
ren "%SYSTEMROOT%\SoftwareDistribution\Download" Download.bak
|
||||||
|
)
|
||||||
|
|
||||||
|
if exist "%SYSTEMROOT%\system32\Catroot2.bak" rmdir /s /q "%SYSTEMROOT%\system32\Catroot2.bak"
|
||||||
|
if exist "%SYSTEMROOT%\system32\Catroot2" (
|
||||||
|
attrib -r -s -h /s /d "%SYSTEMROOT%\system32\Catroot2"
|
||||||
|
ren "%SYSTEMROOT%\system32\Catroot2" Catroot2.bak
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
:: Reset Windows Update policies
|
||||||
|
reg delete "HKCU\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f
|
||||||
|
reg delete "HKCU\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\WindowsUpdate" /f
|
||||||
|
reg delete "HKLM\SOFTWARE\Policies\Microsoft\Windows\WindowsUpdate" /f
|
||||||
|
reg delete "HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\WindowsUpdate" /f
|
||||||
|
gpupdate /force
|
||||||
|
|
||||||
|
|
||||||
|
:: Reset the BITS service and the Windows Update service to the default security descriptor
|
||||||
|
sc.exe sdset bits D:(A;CI;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCLCSWLOCRRC;;;IU)(A;;CCLCSWLOCRRC;;;SU)
|
||||||
|
sc.exe sdset wuauserv D:(A;;CCLCSWRPLORC;;;AU)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;BA)(A;;CCDCLCSWRPWPDTLOCRSDRCWDWO;;;SY)
|
||||||
|
|
||||||
|
|
||||||
|
:: Reregister the BITS files and the Windows Update files
|
||||||
|
cd /d %windir%\system32
|
||||||
|
regsvr32.exe /s atl.dll
|
||||||
|
regsvr32.exe /s urlmon.dll
|
||||||
|
regsvr32.exe /s mshtml.dll
|
||||||
|
regsvr32.exe /s shdocvw.dll
|
||||||
|
regsvr32.exe /s browseui.dll
|
||||||
|
regsvr32.exe /s jscript.dll
|
||||||
|
regsvr32.exe /s vbscript.dll
|
||||||
|
regsvr32.exe /s scrrun.dll
|
||||||
|
regsvr32.exe /s msxml.dll
|
||||||
|
regsvr32.exe /s msxml3.dll
|
||||||
|
regsvr32.exe /s msxml6.dll
|
||||||
|
regsvr32.exe /s actxprxy.dll
|
||||||
|
regsvr32.exe /s softpub.dll
|
||||||
|
regsvr32.exe /s wintrust.dll
|
||||||
|
regsvr32.exe /s dssenh.dll
|
||||||
|
regsvr32.exe /s rsaenh.dll
|
||||||
|
regsvr32.exe /s gpkcsp.dll
|
||||||
|
regsvr32.exe /s sccbase.dll
|
||||||
|
regsvr32.exe /s slbcsp.dll
|
||||||
|
regsvr32.exe /s cryptdlg.dll
|
||||||
|
regsvr32.exe /s oleaut32.dll
|
||||||
|
regsvr32.exe /s ole32.dll
|
||||||
|
regsvr32.exe /s shell32.dll
|
||||||
|
regsvr32.exe /s initpki.dll
|
||||||
|
regsvr32.exe /s wuapi.dll
|
||||||
|
regsvr32.exe /s wuaueng.dll
|
||||||
|
regsvr32.exe /s wuaueng1.dll
|
||||||
|
regsvr32.exe /s wucltui.dll
|
||||||
|
regsvr32.exe /s wups.dll
|
||||||
|
regsvr32.exe /s wups2.dll
|
||||||
|
regsvr32.exe /s wuweb.dll
|
||||||
|
regsvr32.exe /s qmgr.dll
|
||||||
|
regsvr32.exe /s qmgrprxy.dll
|
||||||
|
regsvr32.exe /s wucltux.dll
|
||||||
|
regsvr32.exe /s muweb.dll
|
||||||
|
regsvr32.exe /s wuwebv.dll
|
||||||
|
netsh winsock reset
|
||||||
|
netsh winsock reset proxy
|
||||||
|
|
||||||
|
:: Set the startup type as automatic
|
||||||
|
sc config wuauserv start= auto
|
||||||
|
sc config bits start= auto
|
||||||
|
sc config DcomLaunch start= auto
|
||||||
|
|
||||||
|
:Start
|
||||||
|
net start bits
|
||||||
|
net start wuauserv
|
||||||
|
net start cryptsvc
|
||||||
|
|
||||||
|
:: Restart computer
|
||||||
|
cls
|
||||||
|
echo It is required to restart the computer to finish resetting Windows Update.
|
||||||
|
echo.
|
||||||
|
echo Please save and close anything open now, before the computer is restarted.
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo.
|
||||||
|
echo *** Restart computer now. ***
|
||||||
|
echo.
|
||||||
|
pause
|
||||||
|
shutdown /r /f /t 0
|
||||||
Reference in New Issue
Block a user