mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-07-01 10:32:35 -05:00
Compare commits
23 Commits
24.11.25
...
18466bc496
Author | SHA1 | Date | |
---|---|---|---|
18466bc496 | |||
a17080f13b | |||
c056bbcfe4 | |||
6175c0889c | |||
210f321a34 | |||
f0b4660478 | |||
c24129387e | |||
80ca474891 | |||
a22d6b0d10 | |||
4c6990b515 | |||
3f48c8aa70 | |||
cdf36857c5 | |||
e6e449af94 | |||
506c015496 | |||
3be1999c22 | |||
b15f31fdf8 | |||
47e80010d1 | |||
1132d53944 | |||
bb39be794b | |||
ec4cb1d520 | |||
eaa19eba8a | |||
dfe7dc4044 | |||
4402c5cf31 |
128
.github/CODE_OF_CONDUCT.md
vendored
128
.github/CODE_OF_CONDUCT.md
vendored
@ -1,128 +0,0 @@
|
||||
# Contributor Covenant Code of Conduct
|
||||
|
||||
## Our Pledge
|
||||
|
||||
We as members, contributors, and leaders pledge to make participation in our
|
||||
community a harassment-free experience for everyone, regardless of age, body
|
||||
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
||||
identity and expression, level of experience, education, socio-economic status,
|
||||
nationality, personal appearance, race, religion, or sexual identity
|
||||
and orientation.
|
||||
|
||||
We pledge to act and interact in ways that contribute to an open, welcoming,
|
||||
diverse, inclusive, and healthy community.
|
||||
|
||||
## Our Standards
|
||||
|
||||
Examples of behavior that contributes to a positive environment for our
|
||||
community include:
|
||||
|
||||
* Demonstrating empathy and kindness toward other people
|
||||
* Being respectful of differing opinions, viewpoints, and experiences
|
||||
* Giving and gracefully accepting constructive feedback
|
||||
* Accepting responsibility and apologizing to those affected by our mistakes,
|
||||
and learning from the experience
|
||||
* Focusing on what is best not just for us as individuals, but for the
|
||||
overall community
|
||||
|
||||
Examples of unacceptable behavior include:
|
||||
|
||||
* The use of sexualized language or imagery, and sexual attention or
|
||||
advances of any kind
|
||||
* Trolling, insulting or derogatory comments, and personal or political attacks
|
||||
* Public or private harassment
|
||||
* Publishing others' private information, such as a physical or email
|
||||
address, without their explicit permission
|
||||
* Other conduct which could reasonably be considered inappropriate in a
|
||||
professional setting
|
||||
|
||||
## Enforcement Responsibilities
|
||||
|
||||
Community leaders are responsible for clarifying and enforcing our standards of
|
||||
acceptable behavior and will take appropriate and fair corrective action in
|
||||
response to any behavior that they deem inappropriate, threatening, offensive,
|
||||
or harmful.
|
||||
|
||||
Community leaders have the right and responsibility to remove, edit, or reject
|
||||
comments, commits, code, wiki edits, issues, and other contributions that are
|
||||
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
||||
decisions when appropriate.
|
||||
|
||||
## Scope
|
||||
|
||||
This Code of Conduct applies within all community spaces, and also applies when
|
||||
an individual is officially representing the community in public spaces.
|
||||
Examples of representing our community include using an official e-mail address,
|
||||
posting via an official social media account, or acting as an appointed
|
||||
representative at an online or offline event.
|
||||
|
||||
## Enforcement
|
||||
|
||||
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
||||
reported to the community leaders responsible for enforcement at
|
||||
contact@christitus.com.
|
||||
All complaints will be reviewed and investigated promptly and fairly.
|
||||
|
||||
All community leaders are obligated to respect the privacy and security of the
|
||||
reporter of any incident.
|
||||
|
||||
## Enforcement Guidelines
|
||||
|
||||
Community leaders will follow these Community Impact Guidelines in determining
|
||||
the consequences for any action they deem in violation of this Code of Conduct:
|
||||
|
||||
### 1. Correction
|
||||
|
||||
**Community Impact**: Use of inappropriate language or other behavior deemed
|
||||
unprofessional or unwelcome in the community.
|
||||
|
||||
**Consequence**: A private, written warning from community leaders, providing
|
||||
clarity around the nature of the violation and an explanation of why the
|
||||
behavior was inappropriate. A public apology may be requested.
|
||||
|
||||
### 2. Warning
|
||||
|
||||
**Community Impact**: A violation through a single incident or series
|
||||
of actions.
|
||||
|
||||
**Consequence**: A warning with consequences for continued behavior. No
|
||||
interaction with the people involved, including unsolicited interaction with
|
||||
those enforcing the Code of Conduct, for a specified period of time. This
|
||||
includes avoiding interactions in community spaces as well as external channels
|
||||
like social media. Violating these terms may lead to a temporary or
|
||||
permanent ban.
|
||||
|
||||
### 3. Temporary Ban
|
||||
|
||||
**Community Impact**: A serious violation of community standards, including
|
||||
sustained inappropriate behavior.
|
||||
|
||||
**Consequence**: A temporary ban from any sort of interaction or public
|
||||
communication with the community for a specified period of time. No public or
|
||||
private interaction with the people involved, including unsolicited interaction
|
||||
with those enforcing the Code of Conduct, is allowed during this period.
|
||||
Violating these terms may lead to a permanent ban.
|
||||
|
||||
### 4. Permanent Ban
|
||||
|
||||
**Community Impact**: Demonstrating a pattern of violation of community
|
||||
standards, including sustained inappropriate behavior, harassment of an
|
||||
individual, or aggression toward or disparagement of classes of individuals.
|
||||
|
||||
**Consequence**: A permanent ban from any sort of public interaction within
|
||||
the community.
|
||||
|
||||
## Attribution
|
||||
|
||||
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
||||
version 2.0, available at
|
||||
https://www.contributor-covenant.org/version/2/0/code_of_conduct.html.
|
||||
|
||||
Community Impact Guidelines were inspired by [Mozilla's code of conduct
|
||||
enforcement ladder](https://github.com/mozilla/diversity).
|
||||
|
||||
[homepage]: https://www.contributor-covenant.org
|
||||
|
||||
For answers to common questions about this code of conduct, see the FAQ at
|
||||
https://www.contributor-covenant.org/faq. Translations are available at
|
||||
https://www.contributor-covenant.org/translations.
|
@ -68,9 +68,9 @@ graph TD
|
||||
### Fork the Repo
|
||||
* Fork the WinUtil Repository [here](https://github.com/ChrisTitusTech/winutil) to create a copy that will be available in your repository list.
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
|
||||
### Clone the Fork
|
||||
!!! tip
|
10
.github/ISSUE_TEMPLATE/bug_report.md
vendored
10
.github/ISSUE_TEMPLATE/bug_report.md
vendored
@ -2,12 +2,12 @@
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
title: ''
|
||||
labels: 'bug'
|
||||
labels: ''
|
||||
assignees: ''
|
||||
---
|
||||
|
||||
## Describe the bug
|
||||
<!-- A clear and concise description of what the bug is. -->
|
||||
A clear and concise description of what the bug is.
|
||||
|
||||
## To Reproduce
|
||||
Steps to reproduce the behavior:
|
||||
@ -17,10 +17,10 @@ Steps to reproduce the behavior:
|
||||
4. See error
|
||||
|
||||
## Expected behavior
|
||||
<!-- A clear and concise description of what you expected to happen. -->
|
||||
A clear and concise description of what you expected to happen.
|
||||
|
||||
## Screenshots
|
||||
<!-- If applicable, add screenshots to help explain your problem. -->
|
||||
If applicable, add screenshots to help explain your problem.
|
||||
|
||||
## Additional context
|
||||
<!-- Add any other context about the problem here. -->
|
||||
Add any other context about the problem here.
|
||||
|
10
.github/ISSUE_TEMPLATE/feature_request.md
vendored
10
.github/ISSUE_TEMPLATE/feature_request.md
vendored
@ -2,19 +2,19 @@
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
title: ''
|
||||
labels: 'enhancement'
|
||||
labels: ''
|
||||
assignees: ''
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
<!-- A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] -->
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
<!-- A clear and concise description of what you want to happen. -->
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
<!-- A clear and concise description of any alternative solutions or features you've considered. -->
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
<!-- Add any other context or screenshots about the feature request here. -->
|
||||
Add any other context or screenshots about the feature request here.
|
||||
|
2
LICENSE → .github/LICENSE
vendored
2
LICENSE → .github/LICENSE
vendored
@ -1,6 +1,6 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2022 CT Tech Group LLC
|
||||
Copyright (c) 2022 Chris Titus
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
15
.github/PULL_REQUEST_TEMPLATE.md
vendored
15
.github/PULL_REQUEST_TEMPLATE.md
vendored
@ -1,4 +1,7 @@
|
||||
<!--Before you make this PR have you followed the docs here? - https://christitustech.github.io/winutil/contribute/ -->
|
||||
# Pull Request
|
||||
|
||||
## Title
|
||||
[Provide a succinct and descriptive title for the pull request.]
|
||||
|
||||
## Type of Change
|
||||
- [ ] New feature
|
||||
@ -10,20 +13,20 @@
|
||||
- [ ] UI/UX improvement
|
||||
|
||||
## Description
|
||||
<!--[Provide a detailed explanation of the changes you have made. Include the reasons behind these changes and any relevant context. Link any related issues.]-->
|
||||
[Provide a detailed explanation of the changes you have made. Include the reasons behind these changes and any relevant context. Link any related issues.]
|
||||
|
||||
## Testing
|
||||
<!--[Detail the testing you have performed to ensure that these changes function as intended. Include information about any added tests.]-->
|
||||
[Detail the testing you have performed to ensure that these changes function as intended. Include information about any added tests.]
|
||||
|
||||
## Impact
|
||||
<!--[Discuss the impact of your changes on the project. This might include effects on performance, new dependencies, or changes in behaviour.]-->
|
||||
[Discuss the impact of your changes on the project. This might include effects on performance, new dependencies, or changes in behaviour.]
|
||||
|
||||
## Issue related to PR
|
||||
<!--[What issue/discussion is related to this PR (if any)]-->
|
||||
[What issue/discussion is related to this PR (if any)]
|
||||
- Resolves #
|
||||
|
||||
## Additional Information
|
||||
<!--[Any additional information that reviewers should be aware of.]-->
|
||||
[Any additional information that reviewers should be aware of.]
|
||||
|
||||
## Checklist
|
||||
- [ ] My code adheres to the coding and style guidelines of the project.
|
||||
|
5
.github/mkdocs.yml
vendored
5
.github/mkdocs.yml
vendored
@ -5,15 +5,12 @@ repo_url: https://github.com/ChrisTitusTech/winutil
|
||||
nav:
|
||||
- Introduction: 'index.md'
|
||||
- User Guide: 'userguide.md'
|
||||
- Contributing Guide: 'CONTRIBUTING.md'
|
||||
- Contributing Guide: 'contribute.md'
|
||||
- Documentation:
|
||||
- Dev Docs: 'devdocs.md'
|
||||
- Known Issues: 'KnownIssues.md'
|
||||
- FAQ: 'faq.md'
|
||||
|
||||
not_in_nav: |
|
||||
dev/
|
||||
|
||||
theme:
|
||||
name: material
|
||||
custom_dir: '../overrides'
|
||||
|
54
.github/release-drafter.yml
vendored
54
.github/release-drafter.yml
vendored
@ -1,54 +0,0 @@
|
||||
tag-prefix: ''
|
||||
categories:
|
||||
- title: '🚀 Features'
|
||||
labels:
|
||||
- 'feature'
|
||||
- 'enhancement'
|
||||
- title: '🐛 Bug Fixes'
|
||||
labels:
|
||||
- 'fix'
|
||||
- 'bugfix'
|
||||
- 'bug'
|
||||
- title: '📚 Documentation'
|
||||
label: 'documentation'
|
||||
- title: '🔒 Security'
|
||||
label: 'security'
|
||||
change-template: '- $TITLE @$AUTHOR (#$NUMBER)'
|
||||
template: |
|
||||
## Changes
|
||||
|
||||
$CHANGES
|
||||
|
||||
change-title-escapes: '\<*_&"'''
|
||||
autolabeler:
|
||||
- label: 'documentation'
|
||||
files:
|
||||
- '*.md'
|
||||
branch:
|
||||
- '/docs{0,1}\/.+/'
|
||||
- label: 'bug'
|
||||
branch:
|
||||
- '/fix\/.+/'
|
||||
title:
|
||||
- '/fix/i'
|
||||
- label: 'enhancement'
|
||||
branch:
|
||||
- '/feature\/.+/'
|
||||
body:
|
||||
- '/[A-Z]+-[0-9]+/'
|
||||
- label: 'documentation'
|
||||
files:
|
||||
- '**/*.md'
|
||||
- 'docs/**/*'
|
||||
- label: 'security'
|
||||
branch:
|
||||
- '/security\/.+/'
|
||||
replacers:
|
||||
- search: /"/g
|
||||
replace: ''
|
||||
- search: /'/g
|
||||
replace: ''
|
||||
exclude-labels:
|
||||
- 'skip-changelog'
|
||||
|
||||
filter-by-commitish: true
|
40
.github/workflows/close-issue-command.yaml
vendored
40
.github/workflows/close-issue-command.yaml
vendored
@ -15,33 +15,18 @@ jobs:
|
||||
contents: read
|
||||
|
||||
steps:
|
||||
- run: echo "command=false" >> $GITHUB_ENV
|
||||
|
||||
- name: Check for /close command
|
||||
id: check_close_command
|
||||
- name: Check for /close comment
|
||||
id: check_comment
|
||||
run: |
|
||||
if [[ "${{ contains(github.event.comment.body, '/close') }}" == "true" ]]; then
|
||||
echo "command=true" >> $GITHUB_ENV
|
||||
echo "close_command=true" >> $GITHUB_ENV
|
||||
echo "reopen_command=false" >> $GITHUB_ENV
|
||||
echo "comment=true" >> $GITHUB_ENV
|
||||
else
|
||||
echo "close_command=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Check for /open or /reopen command
|
||||
id: check_reopen_command
|
||||
run: |
|
||||
if [[ "${{ contains(github.event.comment.body, '/open') }}" == "true" ]] || [[ "${{ contains(github.event.comment.body, '/reopen') }}" == "true" ]]; then
|
||||
echo "command=true" >> $GITHUB_ENV
|
||||
echo "reopen_command=true" >> $GITHUB_ENV
|
||||
echo "close_command=false" >> $GITHUB_ENV
|
||||
else
|
||||
echo "reopen_command=false" >> $GITHUB_ENV
|
||||
echo "comment=false" >> $GITHUB_ENV
|
||||
fi
|
||||
|
||||
- name: Check if the user is allowed
|
||||
id: check_user
|
||||
if: env.command == 'true'
|
||||
if: env.comment == 'true'
|
||||
run: |
|
||||
ALLOWED_USERS=("ChrisTitusTech" "og-mrk" "Marterich" "MyDrift-user" "Real-MullaC")
|
||||
if [[ " ${ALLOWED_USERS[@]} " =~ " ${{ github.event.comment.user.login }} " ]]; then
|
||||
@ -51,23 +36,10 @@ jobs:
|
||||
fi
|
||||
|
||||
- name: Close issue if conditions are met
|
||||
if: env.close_command == 'true' && env.user == 'true'
|
||||
if: env.comment == 'true' && env.user == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
run: |
|
||||
echo Closing the issue...
|
||||
if [[ "${{ contains(github.event.comment.body, 'not planned') }}" == "true" ]]; then
|
||||
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }} --reason 'not planned'
|
||||
else
|
||||
gh issue close $ISSUE_NUMBER --repo ${{ github.repository }}
|
||||
fi
|
||||
|
||||
- name: Reopen issue if conditions are met
|
||||
if: env.reopen_command == 'true' && env.user == 'true'
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
ISSUE_NUMBER: ${{ github.event.issue.number }}
|
||||
run: |
|
||||
echo Reopening the issue...
|
||||
gh issue reopen $ISSUE_NUMBER --repo ${{ github.repository }}
|
||||
|
4
.github/workflows/close-old-issues.yaml
vendored
4
.github/workflows/close-old-issues.yaml
vendored
@ -22,8 +22,8 @@ jobs:
|
||||
exempt-issue-labels: "Keep Issue Open"
|
||||
# Split it into two weeks, after one week the issue will be marked as stale,
|
||||
# after another week have pasted without any update.. the issue will then be closed.
|
||||
days-before-issue-stale: 90
|
||||
days-before-issue-close: 365
|
||||
days-before-issue-stale: 7
|
||||
days-before-issue-close: 7
|
||||
# NEVER mark PRs as Stale or Close + this workflow should never have write permissions on PRs, EVER!
|
||||
days-before-pr-stale: -1
|
||||
days-before-pr-close: -1
|
||||
|
1
.github/workflows/github-pages.yaml
vendored
1
.github/workflows/github-pages.yaml
vendored
@ -7,7 +7,6 @@ on:
|
||||
- '.github/requirements.txt'
|
||||
- 'docs/**'
|
||||
- 'overrides/**'
|
||||
- '.github/CONTRIBUTING.md'
|
||||
workflow_dispatch:
|
||||
|
||||
jobs:
|
||||
|
15
.github/workflows/pre-release.yaml
vendored
15
.github/workflows/pre-release.yaml
vendored
@ -74,27 +74,16 @@ jobs:
|
||||
name: winutil
|
||||
path: ./winutil.ps1
|
||||
|
||||
- name: Generate Release Notes
|
||||
id: generate_notes
|
||||
uses: release-drafter/release-drafter@v6
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
with:
|
||||
config-name: release-drafter.yml
|
||||
version: ${{ env.VERSION }} # Pass the version variable
|
||||
|
||||
- name: Create and Upload Release
|
||||
id: create_release
|
||||
uses: softprops/action-gh-release@v2
|
||||
with:
|
||||
tag_name: ${{ env.VERSION }}
|
||||
name: Pre-Release ${{ env.VERSION }}
|
||||
body: |
|
||||
${{ steps.generate_notes.outputs.body }}
|
||||
|
||||

|
||||
body: ""
|
||||
append_body: false
|
||||
files: ./winutil.ps1
|
||||
prerelease: true
|
||||
generate_release_notes: true
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
110
Compile.ps1
110
Compile.ps1
@ -1,21 +1,12 @@
|
||||
param (
|
||||
[switch]$Debug,
|
||||
[switch]$Run,
|
||||
[switch]$SkipPreprocessing,
|
||||
[string]$Arguments
|
||||
[switch]$SkipPreprocessing
|
||||
)
|
||||
|
||||
if ((Get-Item ".\winutil.ps1" -ErrorAction SilentlyContinue).IsReadOnly) {
|
||||
Remove-Item ".\winutil.ps1" -Force
|
||||
}
|
||||
|
||||
$OFS = "`r`n"
|
||||
$scriptname = "winutil.ps1"
|
||||
$workingdir = $PSScriptRoot
|
||||
|
||||
Push-Location
|
||||
Set-Location $workingdir
|
||||
|
||||
# Variable to sync between runspaces
|
||||
$sync = [Hashtable]::Synchronized(@{})
|
||||
$sync.PSScriptRoot = $workingdir
|
||||
@ -50,11 +41,11 @@ if (-NOT $SkipPreprocessing) {
|
||||
|
||||
# Dot source the 'Invoke-Preprocessing' Function from 'tools/Invoke-Preprocessing.ps1' Script
|
||||
$preprocessingFilePath = ".\tools\Invoke-Preprocessing.ps1"
|
||||
. $preprocessingFilePath
|
||||
. "$(($workingdir -replace ('\\$', '')) + '\' + ($preprocessingFilePath -replace ('\.\\', '')))"
|
||||
|
||||
$excludedFiles = @('.\.git\', '.\.gitignore', '.\.gitattributes', '.\.github\CODEOWNERS', '.\LICENSE', "$preprocessingFilePath", '*.png', '*.exe')
|
||||
$msg = "Pre-req: Code Formatting"
|
||||
Invoke-Preprocessing -WorkingDir "$workingdir" -ExcludedFiles $excludedFiles -ProgressStatusMessage $msg -ThrowExceptionOnEmptyFilesList
|
||||
Invoke-Preprocessing -WorkingDir "$workingdir" -ExcludedFiles $excludedFiles -ProgressStatusMessage $msg
|
||||
}
|
||||
|
||||
# Create the script in memory.
|
||||
@ -65,83 +56,96 @@ Update-Progress "Adding: Header" 5
|
||||
$script_content.Add($header)
|
||||
|
||||
Update-Progress "Adding: Version" 10
|
||||
$script_content.Add($(Get-Content "scripts\start.ps1").replace('#{replaceme}',"$(Get-Date -Format yy.MM.dd)"))
|
||||
$script_content.Add($(Get-Content "$workingdir\scripts\start.ps1").replace('#{replaceme}',"$(Get-Date -Format yy.MM.dd)"))
|
||||
|
||||
Update-Progress "Adding: Functions" 20
|
||||
Get-ChildItem "functions" -Recurse -File | ForEach-Object {
|
||||
Get-ChildItem "$workingdir\functions" -Recurse -File | ForEach-Object {
|
||||
$script_content.Add($(Get-Content $psitem.FullName))
|
||||
}
|
||||
Update-Progress "Adding: Config *.json" 40
|
||||
Get-ChildItem "config" | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object {
|
||||
$json = (Get-Content $psitem.FullName -Raw)
|
||||
$jsonAsObject = $json | ConvertFrom-Json
|
||||
Get-ChildItem "$workingdir\config" | Where-Object {$psitem.extension -eq ".json"} | ForEach-Object {
|
||||
|
||||
$json = (Get-Content $psitem.FullName).replace("'","''")
|
||||
|
||||
# Replace every XML Special Character so it'll render correctly in final build
|
||||
# Only do so if json files has content to be displayed (for example the applications, tweaks, features json files)
|
||||
# Make an Array List containing every name at first level of Json File
|
||||
$jsonAsObject = $json | convertfrom-json
|
||||
$firstLevelJsonList = [System.Collections.ArrayList]::new()
|
||||
$jsonAsObject.PSObject.Properties.Name | ForEach-Object {$null = $firstLevelJsonList.Add($_)}
|
||||
# Note:
|
||||
# Avoid using HTML Entity Codes, for example '”' (stands for "Right Double Quotation Mark"),
|
||||
# Use **HTML decimal/hex codes instead**, as using HTML Entity Codes will result in XML parse Error when running the compiled script.
|
||||
for ($i = 0; $i -lt $firstLevelJsonList.Count; $i += 1) {
|
||||
$firstLevelName = $firstLevelJsonList[$i]
|
||||
if ($jsonAsObject.$firstLevelName.content -ne $null) {
|
||||
$jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('&','&').replace('“','“').replace('”','”').replace("'",''').replace('<','<').replace('>','>').replace('—','—')
|
||||
$jsonAsObject.$firstLevelName.content = $jsonAsObject.$firstLevelName.content.replace('''',"'") # resolves the Double Apostrophe caused by the first replace function in the main loop
|
||||
}
|
||||
if ($jsonAsObject.$firstLevelName.description -ne $null) {
|
||||
$jsonAsObject.$firstLevelName.description = $jsonAsObject.$firstLevelName.description.replace('&','&').replace('“','“').replace('”','”').replace("'",''').replace('<','<').replace('>','>').replace('—','—')
|
||||
$jsonAsObject.$firstLevelName.description = $jsonAsObject.$firstLevelName.description.replace('''',"'") # resolves the Double Apostrophe caused by the first replace function in the main loop
|
||||
}
|
||||
}
|
||||
|
||||
# Add 'WPFInstall' as a prefix to every entry-name in 'applications.json' file
|
||||
if ($psitem.Name -eq "applications.json") {
|
||||
foreach ($appEntryName in $jsonAsObject.PSObject.Properties.Name) {
|
||||
for ($i = 0; $i -lt $firstLevelJsonList.Count; $i += 1) {
|
||||
$appEntryName = $firstLevelJsonList[$i]
|
||||
$appEntryContent = $jsonAsObject.$appEntryName
|
||||
# Remove the entire app entry, so we could add it later with a different name
|
||||
$jsonAsObject.PSObject.Properties.Remove($appEntryName)
|
||||
# Add the app entry, but with a different name (WPFInstall + The App Entry Name)
|
||||
$jsonAsObject | Add-Member -MemberType NoteProperty -Name "WPFInstall$appEntryName" -Value $appEntryContent
|
||||
}
|
||||
}
|
||||
|
||||
# Line 90 requires no whitespace inside the here-strings, to keep formatting of the JSON in the final script.
|
||||
$json = @"
|
||||
$($jsonAsObject | ConvertTo-Json -Depth 3)
|
||||
"@
|
||||
# The replace at the end is required, as without it the output of 'converto-json' will be somewhat weird for Multiline Strings
|
||||
# Most Notably is the scripts in some json files, making it harder for users who want to review these scripts, which're found in the compiled script
|
||||
$json = ($jsonAsObject | convertto-json -Depth 3).replace('\r\n',"`r`n")
|
||||
|
||||
$sync.configs.$($psitem.BaseName) = $json | ConvertFrom-Json
|
||||
$script_content.Add($(Write-Output "`$sync.configs.$($psitem.BaseName) = @'`r`n$json`r`n'@ `| ConvertFrom-Json" ))
|
||||
$sync.configs.$($psitem.BaseName) = $json | convertfrom-json
|
||||
$script_content.Add($(Write-output "`$sync.configs.$($psitem.BaseName) = '$json' `| convertfrom-json" ))
|
||||
}
|
||||
|
||||
# Read the entire XAML file as a single string, preserving line breaks
|
||||
$xaml = Get-Content "$workingdir\xaml\inputXML.xaml" -Raw
|
||||
$xaml = (Get-Content "$workingdir\xaml\inputXML.xaml").replace("'","''")
|
||||
|
||||
Update-Progress "Adding: Xaml " 90
|
||||
|
||||
# Add the XAML content to $script_content using a here-string
|
||||
$script_content.Add(@"
|
||||
`$inputXML = @'
|
||||
$xaml
|
||||
'@
|
||||
"@)
|
||||
$script_content.Add($(Write-output "`$inputXML = '$xaml'"))
|
||||
|
||||
$script_content.Add($(Get-Content "scripts\main.ps1"))
|
||||
$script_content.Add($(Get-Content "$workingdir\scripts\main.ps1"))
|
||||
|
||||
if ($Debug) {
|
||||
Update-Progress "Writing debug files" 95
|
||||
$appXamlContent | Out-File -FilePath "xaml\inputApp.xaml" -Encoding ascii
|
||||
$tweaksXamlContent | Out-File -FilePath "xaml\inputTweaks.xaml" -Encoding ascii
|
||||
$featuresXamlContent | Out-File -FilePath "xaml\inputFeatures.xaml" -Encoding ascii
|
||||
$appXamlContent | Out-File -FilePath "$workingdir\xaml\inputApp.xaml" -Encoding ascii
|
||||
$tweaksXamlContent | Out-File -FilePath "$workingdir\xaml\inputTweaks.xaml" -Encoding ascii
|
||||
$featuresXamlContent | Out-File -FilePath "$workingdir\xaml\inputFeatures.xaml" -Encoding ascii
|
||||
} else {
|
||||
Update-Progress "Removing temporary files" 99
|
||||
Remove-Item "xaml\inputApp.xaml" -ErrorAction SilentlyContinue
|
||||
Remove-Item "xaml\inputTweaks.xaml" -ErrorAction SilentlyContinue
|
||||
Remove-Item "xaml\inputFeatures.xaml" -ErrorAction SilentlyContinue
|
||||
Remove-Item "$workingdir\xaml\inputApp.xaml" -ErrorAction SilentlyContinue
|
||||
Remove-Item "$workingdir\xaml\inputTweaks.xaml" -ErrorAction SilentlyContinue
|
||||
Remove-Item "$workingdir\xaml\inputFeatures.xaml" -ErrorAction SilentlyContinue
|
||||
}
|
||||
|
||||
Set-Content -Path "$scriptname" -Value ($script_content -join "`r`n") -Encoding ascii
|
||||
Set-Content -Path "$workingdir\$scriptname" -Value ($script_content -join "`r`n") -Encoding ascii
|
||||
Write-Progress -Activity "Compiling" -Completed
|
||||
|
||||
Update-Progress -Activity "Validating" -StatusMessage "Checking winutil.ps1 Syntax" -Percent 0
|
||||
try {
|
||||
Get-Command -Syntax .\winutil.ps1 | Out-Null
|
||||
} catch {
|
||||
$null = Get-Command -Syntax .\winutil.ps1
|
||||
}
|
||||
catch {
|
||||
Write-Warning "Syntax Validation for 'winutil.ps1' has failed"
|
||||
Write-Host "$($Error[0])" -ForegroundColor Red
|
||||
Pop-Location # Restore previous location before exiting...
|
||||
exit 1
|
||||
}
|
||||
Write-Progress -Activity "Validating" -Completed
|
||||
|
||||
if ($run) {
|
||||
$script = "& '$workingdir\$scriptname' $Arguments"
|
||||
|
||||
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
|
||||
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd }
|
||||
|
||||
Start-Process $processCmd -ArgumentList "$powershellcmd -NoProfile -Command $script"
|
||||
|
||||
break
|
||||
try {
|
||||
Start-Process -FilePath "pwsh" -ArgumentList "$workingdir\$scriptname"
|
||||
} catch {
|
||||
Start-Process -FilePath "powershell" -ArgumentList "$workingdir\$scriptname"
|
||||
}
|
||||
|
||||
}
|
||||
Pop-Location
|
||||
|
@ -52,7 +52,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.
|
||||
|
||||
<!-- sponsors --><a href="https://github.com/TriHydera"><img src="https://avatars.githubusercontent.com/u/39857764?u=5dbda638f45530582eee1703b4473f2a5e229e28&v=4" width="60px" alt="TriHydera" /></a><a href="https://github.com/jozozovko"><img src="https://avatars.githubusercontent.com/u/3272468?u=4391ed4655e4fd8b56e23b4169e44e2ac9b6cd97&v=4" width="60px" alt="" /></a><a href="https://github.com/DelDongo"><img src="https://avatars.githubusercontent.com/u/127976398?v=4" width="60px" alt="" /></a><a href="https://github.com/markamos"><img src="https://avatars.githubusercontent.com/u/9561861?u=3cca179dcff0413538591e57a3abea116d65ce56&v=4" width="60px" alt="Mark Amos" /></a><a href="https://github.com/dwelfusius"><img src="https://avatars.githubusercontent.com/u/54533224?u=a49ea000a8f52adb31382ea69a1a7501b27fefdd&v=4" width="60px" alt="" /></a><a href="https://github.com/mews-se"><img src="https://avatars.githubusercontent.com/u/58894405?v=4" width="60px" alt="" /></a><a href="https://github.com/jdiegmueller"><img src="https://avatars.githubusercontent.com/u/18660571?u=601d0a23040a271c86b5d40339f899a6dbf27086&v=4" width="60px" alt="Jason A. Diegmueller" /></a><a href="https://github.com/AlanTristar"><img src="https://avatars.githubusercontent.com/u/105566568?v=4" width="60px" alt="" /></a><a href="https://github.com/zepled112"><img src="https://avatars.githubusercontent.com/u/65176625?v=4" width="60px" alt="wyatt" /></a><a href="https://github.com/altugtekiner"><img src="https://avatars.githubusercontent.com/u/105917451?u=ee73ff639c7bd9feb4708ab4ba7b14eff80196f7&v=4" width="60px" alt="" /></a><a href="https://github.com/robertsandrock"><img src="https://avatars.githubusercontent.com/u/12015331?v=4" width="60px" alt="RMS" /></a><a href="https://github.com/mmomega"><img src="https://avatars.githubusercontent.com/u/71956566?v=4" width="60px" alt="" /></a><a href="https://github.com/KenichiQaz"><img src="https://avatars.githubusercontent.com/u/31177857?u=efdbae734a4c60a7bb95df4659d0535e60a6fd57&v=4" width="60px" alt="Stefan" /></a><a href="https://github.com/paulsheets"><img src="https://avatars.githubusercontent.com/u/45240946?u=d4db66f8e8d7a2606fe7a5521daf48ca9f097105&v=4" width="60px" alt="Paul" /></a><a href="https://github.com/djones369"><img src="https://avatars.githubusercontent.com/u/4107092?v=4" width="60px" alt="Dave Jones" /></a><a href="https://github.com/anthonymendez"><img src="https://avatars.githubusercontent.com/u/19240897?u=f82b4be098cac65c8421421b70ebd2d1da85c67e&v=4" width="60px" alt="Anthony Mendez" /></a><a href="https://github.com/claudemods"><img src="https://avatars.githubusercontent.com/u/73653396?u=d64c656fb8db24ef56bb000197532df9b618d06c&v=4" width="60px" alt="Claudemods" /></a><a href="https://github.com/FatBastard0"><img src="https://avatars.githubusercontent.com/u/173957728?v=4" width="60px" alt="" /></a><a href="https://github.com/Ascent7910"><img src="https://avatars.githubusercontent.com/u/118260621?v=4" width="60px" alt="Max" /></a><a href="https://github.com/DursleyGuy"><img src="https://avatars.githubusercontent.com/u/140165544?v=4" width="60px" alt="DursleyGuy" /></a><a href="https://github.com/YamiSandman616"><img src="https://avatars.githubusercontent.com/u/183505690?u=c3bd20157058b6215e28f7568d4f8c4fbbe92838&v=4" width="60px" alt="Sandman616" /></a><a href="https://github.com/realmuddy"><img src="https://avatars.githubusercontent.com/u/30978236?v=4" width="60px" alt="Phillip Waters" /></a><a href="https://github.com/Tariq-Al-Zahrani"><img src="https://avatars.githubusercontent.com/u/187593049?v=4" width="60px" alt="" /></a><a href="https://github.com/quaszi"><img src="https://avatars.githubusercontent.com/u/51266738?u=2e3185214607e51239c5969c866ddd5eb1bdee48&v=4" width="60px" alt="" /></a><!-- sponsors -->
|
||||
<!-- sponsors --><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/altugtekiner"><img src="https://github.com/altugtekiner.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/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="Paul" /></a><a href="https://github.com/djones369"><img src="https://github.com/djones369.png" width="60px" alt="Dave Jones" /></a><a href="https://github.com/anthonymendez"><img src="https://github.com/anthonymendez.png" width="60px" alt="Anthony Mendez" /></a><a href="https://github.com/woobe-studio"><img src="https://github.com/woobe-studio.png" width="60px" alt="Michael Wozniak" /></a><a href="https://github.com/xBandaku"><img src="https://github.com/xBandaku.png" width="60px" alt="xPandaku" /></a><a href="https://github.com/claudemods"><img src="https://github.com/claudemods.png" width="60px" alt="Claudemods" /></a><a href="https://github.com/hkolatan"><img src="https://github.com/hkolatan.png" width="60px" alt="Halil Kolatan" /></a><!-- sponsors -->
|
||||
|
||||
## 🏅 Thanks to all Contributors
|
||||
Thanks a lot for spending your time helping Winutil grow. Thanks a lot! Keep rocking 🍻.
|
||||
|
@ -87,6 +87,14 @@
|
||||
"link": "https://anydesk.com/",
|
||||
"winget": "AnyDeskSoftwareGmbH.AnyDesk"
|
||||
},
|
||||
"ATLauncher": {
|
||||
"category": "Games",
|
||||
"choco": "na",
|
||||
"content": "ATLauncher",
|
||||
"description": "ATLauncher is a Launcher for Minecraft which integrates multiple different ModPacks to allow you to download and install ModPacks easily and quickly.",
|
||||
"link": "https://github.com/ATLauncher/ATLauncher",
|
||||
"winget": "ATLauncher.ATLauncher"
|
||||
},
|
||||
"audacity": {
|
||||
"category": "Multimedia Tools",
|
||||
"choco": "audacity",
|
||||
@ -445,7 +453,7 @@
|
||||
"category": "Utilities",
|
||||
"content": "Dual Monitor Tools",
|
||||
"link": "https://dualmonitortool.sourceforge.net/",
|
||||
"description": "Dual Monitor Tools (DMT) is a FOSS app that allows you to customize the handling of multiple monitors. Useful for fullscreen games and apps that handle a second monitor poorly and can improve your workflow."
|
||||
"description": "Dual Monitor Tools (DMT) is a FOSS app that customize handling multiple monitors and even lock the mouse on specific monitor. Useful for full screen games and apps that does not handle well a second monitor or helps the workflow."
|
||||
},
|
||||
"duplicati": {
|
||||
"category": "Utilities",
|
||||
@ -503,6 +511,14 @@
|
||||
"link": "https://www.epicgames.com/store/en-US/",
|
||||
"winget": "EpicGames.EpicGamesLauncher"
|
||||
},
|
||||
"errorlookup": {
|
||||
"category": "Utilities",
|
||||
"choco": "na",
|
||||
"content": "Windows Error Code Lookup",
|
||||
"description": "ErrorLookup is a tool for looking up Windows error codes and their descriptions.",
|
||||
"link": "https://github.com/HenryPP/ErrorLookup",
|
||||
"winget": "Henry++.ErrorLookup"
|
||||
},
|
||||
"esearch": {
|
||||
"category": "Utilities",
|
||||
"choco": "everything",
|
||||
@ -797,7 +813,7 @@
|
||||
"content": "Google Drive",
|
||||
"description": "File syncing across devices all tied to your google account",
|
||||
"link": "https://www.google.com/drive/",
|
||||
"winget": "Google.GoogleDrive"
|
||||
"winget": "Google.Drive"
|
||||
},
|
||||
"gpuz": {
|
||||
"category": "Utilities",
|
||||
@ -1892,7 +1908,7 @@
|
||||
"choco": "sdio",
|
||||
"content": "Snappy Driver Installer Origin",
|
||||
"description": "Snappy Driver Installer Origin is a free and open-source driver updater with a vast driver database for Windows.",
|
||||
"link": "https://www.glenn.delahoy.com/snappy-driver-installer-origin/",
|
||||
"link": "https://sourceforge.net/projects/snappy-driver-installer-origin",
|
||||
"winget": "GlennDelahoy.SnappyDriverInstallerOrigin"
|
||||
},
|
||||
"session": {
|
||||
@ -2855,6 +2871,14 @@
|
||||
"link": "https://www.kicad.org/",
|
||||
"winget": "KiCad.KiCad"
|
||||
},
|
||||
"FormatFactory": {
|
||||
"category": "Utilities",
|
||||
"choco": "formatfactory",
|
||||
"content": "Format Factory",
|
||||
"description":"FormatFactory is an ad-supported freeware multimedia converter that can convert video, audio, and picture files. It is also capable of ripping DVDs and CDs to other file formats, as well as creating .iso images. It can also join multiple video files together into one.",
|
||||
"link": "http://www.pcfreetime.com/formatfactory/",
|
||||
"winget": "na"
|
||||
},
|
||||
"dropox": {
|
||||
"category": "Utilities",
|
||||
"choco": "na",
|
||||
|
@ -113,7 +113,7 @@
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>19</Order>
|
||||
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\Microwin-RemovePackages.ps1' -Raw | Invoke-Expression;"</Path>
|
||||
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\remove-packages.ps1' -Raw | Invoke-Expression;"</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>20</Order>
|
||||
@ -312,7 +312,7 @@ foreach( $file in $Document.unattend.Extensions.File ) {
|
||||
[System.IO.File]::WriteAllBytes( $path, ( $encoding.GetPreamble() + $encoding.GetBytes( $file.InnerText.Trim() ) ) );
|
||||
}
|
||||
</ExtractScript>
|
||||
<File path="C:\Windows\Temp\Microwin-RemovePackages.ps1">
|
||||
<File path="C:\Windows\Temp\remove-packages.ps1">
|
||||
$selectors = @(
|
||||
'Microsoft.Microsoft3DViewer';
|
||||
'Microsoft.BingSearch';
|
||||
@ -359,7 +359,7 @@ $removeCommand = {
|
||||
}
|
||||
};
|
||||
$type = 'Package';
|
||||
$logfile = 'C:\Windows\Temp\Microwin-RemovePackages.log';
|
||||
$logfile = 'C:\Windows\Temp\remove-packages.log';
|
||||
& {
|
||||
$installed = & $getCommand;
|
||||
foreach( $selector in $selectors ) {
|
||||
|
@ -46,23 +46,5 @@
|
||||
"Secondary": "94.140.15.16",
|
||||
"Primary6": "2a10:50c0::bad1:ff",
|
||||
"Secondary6": "2a10:50c0::bad2:ff"
|
||||
},
|
||||
"dns0.eu_Open":{
|
||||
"Primary": "193.110.81.254",
|
||||
"Secondary": "185.253.5.254",
|
||||
"Primary6": "2a0f:fc80::ffff",
|
||||
"Secondary6": "2a0f:fc81::ffff"
|
||||
},
|
||||
"dns0.eu_ZERO":{
|
||||
"Primary": "193.110.81.9",
|
||||
"Secondary": "185.253.5.9",
|
||||
"Primary6": "2a0f:fc80::9",
|
||||
"Secondary6": "2a0f:fc81::9"
|
||||
},
|
||||
"dns0.eu_KIDS":{
|
||||
"Primary": "193.110.81.1",
|
||||
"Secondary": "185.253.5.1",
|
||||
"Primary6": "2a0f:fc80::1",
|
||||
"Secondary6": "2a0f:fc81::1"
|
||||
}
|
||||
}
|
||||
|
@ -282,14 +282,6 @@
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Legacy-Windows-Panels/sound"
|
||||
},
|
||||
"WPFPanelprinter": {
|
||||
"Content": "Printer Panel",
|
||||
"category": "Legacy Windows Panels",
|
||||
"panel": "2",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Legacy-Windows-Panels/printer"
|
||||
},
|
||||
"WPFPanelsystem": {
|
||||
"Content": "System Properties",
|
||||
"category": "Legacy Windows Panels",
|
||||
@ -305,31 +297,5 @@
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Legacy-Windows-Panels/user"
|
||||
},
|
||||
"WPFWinUtilInstallPSProfile": {
|
||||
"Content": "Install CTT PowerShell Profile",
|
||||
"category": "Powershell Profile",
|
||||
"panel": "2",
|
||||
"Order": "a083_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Powershell-Profile/PSProfileInstall"
|
||||
},
|
||||
"WPFWinUtilUninstallPSProfile": {
|
||||
"Content": "Uninstall CTT PowerShell Profile",
|
||||
"category": "Powershell Profile",
|
||||
"panel": "2",
|
||||
"Order": "a084_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Powershell-Profile/PSProfileUninstall"
|
||||
},
|
||||
"WPFWinUtilSSHServer": {
|
||||
"Content": "Enable OpenSSH Server",
|
||||
"category": "Remote Access",
|
||||
"panel": "2",
|
||||
"Order": "a084_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300"
|
||||
}
|
||||
}
|
||||
|
@ -14,7 +14,7 @@
|
||||
"WPFTweaksDeleteTempFiles",
|
||||
"WPFTweaksEndTaskOnTaskbar",
|
||||
"WPFTweaksRestorePoint",
|
||||
"WPFTweaksIPv46",
|
||||
"WPFTweaksTeredo",
|
||||
"WPFTweaksPowershell7Tele"
|
||||
],
|
||||
"Minimal": [
|
||||
|
@ -1,109 +1,220 @@
|
||||
{
|
||||
"shared":{
|
||||
"Classic": {
|
||||
"CustomDialogFontSize": "12",
|
||||
"CustomDialogFontSizeHeader": "14",
|
||||
"CustomDialogIconSize": "25",
|
||||
"CustomDialogWidth": "400",
|
||||
"CustomDialogHeight": "200",
|
||||
|
||||
"FontSize": "12",
|
||||
"FontFamily": "Arial",
|
||||
"FontSizeHeading": "16",
|
||||
"FontSizeHeading": "14",
|
||||
"HeaderFontFamily": "Consolas, Monaco",
|
||||
"CheckBoxBulletDecoratorSize": "14",
|
||||
"CheckBoxMargin": "15,0,0,2",
|
||||
"TabContentMargin": "5",
|
||||
|
||||
"CheckBoxBulletDecoratorFontSize": "14",
|
||||
"CheckBoxMargin": "5,0,0,2",
|
||||
|
||||
"TabButtonFontSize": "14",
|
||||
"TabButtonWidth": "110",
|
||||
"TabButtonHeight": "26",
|
||||
"TabButtonWidth": "100",
|
||||
"TabButtonHeight": "25",
|
||||
"TabRowHeightInPixels": "50",
|
||||
"IconFontSize": "14",
|
||||
"IconButtonSize": "35",
|
||||
"WinUtilIconSize": "Auto",
|
||||
"SettingsIconFontSize": "18",
|
||||
"CloseIconFontSize": "18",
|
||||
|
||||
"MicroWinLogoSize": "10",
|
||||
"MicrowinCheckBoxMargin": "-10,5,0,0",
|
||||
"GroupBorderBackgroundColor": "#232629",
|
||||
|
||||
"ProgressBarForegroundColor": "#FFAC1C",
|
||||
"ProgressBarBackgroundColor": "Transparent",
|
||||
"ProgressBarTextColor": "#000000",
|
||||
|
||||
"ComboBoxBackgroundColor": "#FFFFFF",
|
||||
"LabelboxForegroundColor": "#000000",
|
||||
"MainForegroundColor": "#000000",
|
||||
"MainBackgroundColor": "#FFFFFF",
|
||||
"LabelBackgroundColor": "#FAFAFA",
|
||||
"LinkForegroundColor": "#000000",
|
||||
"LinkHoverForegroundColor": "#000000",
|
||||
"GroupBorderBackgroundColor": "#000000",
|
||||
"ComboBoxForegroundColor": "#000000",
|
||||
|
||||
"ButtonFontSize": "12",
|
||||
"ButtonFontFamily": "Arial",
|
||||
"ButtonWidth": "200",
|
||||
"ButtonHeight": "25",
|
||||
"ConfigTabButtonFontSize": "16",
|
||||
"SearchBarWidth": "200",
|
||||
"SearchBarHeight": "26",
|
||||
"SearchBarTextBoxFontSize": "12",
|
||||
"SearchBarClearButtonFontSize": "14",
|
||||
"CheckboxMouseOverColor": "#999999",
|
||||
"ButtonBorderThickness": "1",
|
||||
"ButtonMargin": "1",
|
||||
"ButtonCornerRadius": "2"
|
||||
},
|
||||
"Light": {
|
||||
"ComboBoxForegroundColor": "#232629",
|
||||
"ComboBoxBackgroundColor": "#F7F7F7",
|
||||
"LabelboxForegroundColor": "#232629",
|
||||
"MainForegroundColor": "#232629",
|
||||
"MainBackgroundColor": "#F7F7F7",
|
||||
"LabelBackgroundColor": "#F7F7F7",
|
||||
"LinkForegroundColor": "#232629",
|
||||
"LinkHoverForegroundColor": "#232629",
|
||||
"ScrollBarBackgroundColor": "#4A4D52",
|
||||
"ScrollBarHoverColor": "#5A5D62",
|
||||
"ScrollBarDraggingColor": "#6A6D72",
|
||||
|
||||
"ProgressBarForegroundColor": "#2e77ff",
|
||||
"ProgressBarBackgroundColor": "Transparent",
|
||||
"ProgressBarTextColor": "#232629",
|
||||
"ButtonInstallBackgroundColor": "#F7F7F7",
|
||||
"ButtonTweaksBackgroundColor": "#F7F7F7",
|
||||
"ButtonConfigBackgroundColor": "#F7F7F7",
|
||||
"ButtonUpdatesBackgroundColor": "#F7F7F7",
|
||||
"ButtonInstallForegroundColor": "#232629",
|
||||
"ButtonTweaksForegroundColor": "#232629",
|
||||
"ButtonConfigForegroundColor": "#232629",
|
||||
"ButtonUpdatesForegroundColor": "#232629",
|
||||
"SearchBarWidth": "200",
|
||||
"SearchBarHeight": "25",
|
||||
"SearchBarTextBoxFontSize": "16",
|
||||
"SearchBarClearButtonFontSize": "14",
|
||||
|
||||
"ButtonInstallBackgroundColor": "#FFFFFF",
|
||||
"ButtonTweaksBackgroundColor": "#FFFFFF",
|
||||
"ButtonConfigBackgroundColor": "#FFFFFF",
|
||||
"ButtonUpdatesBackgroundColor": "#FFFFFF",
|
||||
"ButtonInstallForegroundColor": "#000000",
|
||||
"ButtonTweaksForegroundColor": "#000000",
|
||||
"ButtonConfigForegroundColor": "#000000",
|
||||
"ButtonUpdatesForegroundColor": "#000000",
|
||||
"ButtonBackgroundColor": "#F5F5F5",
|
||||
"ButtonBackgroundPressedColor": "#1A1A1A",
|
||||
"CheckboxMouseOverColor": "#999999",
|
||||
"ButtonBackgroundMouseoverColor": "#C2C2C2",
|
||||
"ButtonBackgroundSelectedColor": "#F0F0F0",
|
||||
"ButtonForegroundColor": "#232629",
|
||||
"ButtonForegroundColor": "#000000",
|
||||
"ToggleButtonOnColor": "#2e77ff",
|
||||
"ToggleButtonOffColor": "#707070",
|
||||
"BorderColor": "#232629",
|
||||
"BorderOpacity": "0.2"
|
||||
|
||||
"ButtonBorderThickness": "1",
|
||||
"ButtonMargin": "1",
|
||||
"ButtonCornerRadius": "2",
|
||||
"BorderColor": "#000000",
|
||||
"BorderOpacity": "0.2",
|
||||
"ShadowPulse": "Forever"
|
||||
},
|
||||
"Dark": {
|
||||
"ComboBoxForegroundColor": "#F7F7F7",
|
||||
"ComboBoxBackgroundColor": "#1E3747",
|
||||
"LabelboxForegroundColor": "#0567ff",
|
||||
"MainForegroundColor": "#F7F7F7",
|
||||
"MainBackgroundColor": "#232629",
|
||||
"LabelBackgroundColor": "#232629",
|
||||
"LinkForegroundColor": "#add8e6",
|
||||
"LinkHoverForegroundColor": "#F7F7F7",
|
||||
"ScrollBarBackgroundColor": "#2E3135",
|
||||
"ScrollBarHoverColor": "#3B4252",
|
||||
"ScrollBarDraggingColor": "#5E81AC",
|
||||
"Matrix": {
|
||||
"CustomDialogFontSize": "12",
|
||||
"CustomDialogFontSizeHeader": "14",
|
||||
"CustomDialogIconSize": "25",
|
||||
"CustomDialogWidth": "400",
|
||||
"CustomDialogHeight": "200",
|
||||
|
||||
"FontSize": "12",
|
||||
"FontFamily": "Arial",
|
||||
"FontSizeHeading": "14",
|
||||
"HeaderFontFamily": "Consolas, Monaco",
|
||||
|
||||
"CheckBoxBulletDecoratorFontSize": "14",
|
||||
"CheckBoxMargin": "5,0,0,1",
|
||||
|
||||
"TabButtonFontSize": "14",
|
||||
"TabButtonWidth": "100",
|
||||
"TabButtonHeight": "25",
|
||||
"TabRowHeightInPixels": "50",
|
||||
"IconFontSize": "14",
|
||||
"IconButtonSize": "35",
|
||||
"WinUtilIconSize": "Auto",
|
||||
"SettingsIconFontSize": "18",
|
||||
|
||||
"MicroWinLogoSize": "10",
|
||||
|
||||
"ProgressBarForegroundColor": "#222222",
|
||||
"ProgressBarBackgroundColor": "Transparent",
|
||||
"ProgressBarTextColor": "#cccccc",
|
||||
|
||||
"ComboBoxBackgroundColor": "#000000",
|
||||
"LabelboxForegroundColor": "#FFEE58",
|
||||
"MainForegroundColor": "#9CCC65",
|
||||
"MainBackgroundColor": "#000000",
|
||||
"LabelBackgroundColor": "#000000",
|
||||
"LinkForegroundColor": "#add8e6",
|
||||
"LinkHoverForegroundColor": "#FFFFFF",
|
||||
"ComboBoxForegroundColor": "#FFEE58",
|
||||
|
||||
"ButtonFontSize": "12",
|
||||
"ButtonFontFamily": "Arial",
|
||||
"ButtonWidth": "200",
|
||||
"ButtonHeight": "25",
|
||||
"ConfigTabButtonFontSize": "16",
|
||||
|
||||
"SearchBarWidth": "200",
|
||||
"SearchBarHeight": "25",
|
||||
"SearchBarTextBoxFontSize": "16",
|
||||
"SearchBarClearButtonFontSize": "14",
|
||||
|
||||
"ButtonInstallBackgroundColor": "#222222",
|
||||
"ButtonTweaksBackgroundColor": "#333333",
|
||||
"ButtonConfigBackgroundColor": "#444444",
|
||||
"ButtonUpdatesBackgroundColor": "#555555",
|
||||
"ButtonInstallForegroundColor": "#F7F7F7",
|
||||
"ButtonTweaksForegroundColor": "#F7F7F7",
|
||||
"ButtonConfigForegroundColor": "#F7F7F7",
|
||||
"ButtonUpdatesForegroundColor": "#F7F7F7",
|
||||
"ButtonBackgroundColor": "#1E3747",
|
||||
"ButtonBackgroundPressedColor": "#F7F7F7",
|
||||
"ButtonBackgroundMouseoverColor": "#3B4252",
|
||||
"ButtonBackgroundSelectedColor": "#5E81AC",
|
||||
"ButtonForegroundColor": "#F7F7F7",
|
||||
"ButtonInstallForegroundColor": "#FFFFFF",
|
||||
"ButtonTweaksForegroundColor": "#FFFFFF",
|
||||
"ButtonConfigForegroundColor": "#FFFFFF",
|
||||
"ButtonUpdatesForegroundColor": "#FFFFFF",
|
||||
"ButtonBackgroundColor": "#000019",
|
||||
"ButtonBackgroundPressedColor": "#FFFFFF",
|
||||
"ButtonBackgroundMouseoverColor": "#A55A64",
|
||||
"ButtonBackgroundSelectedColor": "#FF5733",
|
||||
"ButtonForegroundColor": "#9CCC65",
|
||||
"ToggleButtonOnColor": "#2e77ff",
|
||||
"ToggleButtonOffColor": "#707070",
|
||||
"BorderColor": "#2F373D",
|
||||
"BorderOpacity": "0.2"
|
||||
|
||||
"ButtonBorderThickness": "1",
|
||||
"ButtonMargin": "1",
|
||||
"ButtonCornerRadius": "2",
|
||||
"BorderColor": "#FFAC1C",
|
||||
"BorderOpacity": "0.8",
|
||||
"ShadowPulse": "0:0:3"
|
||||
},
|
||||
"Dark": {
|
||||
"CustomDialogFontSize": "12",
|
||||
"CustomDialogFontSizeHeader": "14",
|
||||
"CustomDialogIconSize": "25",
|
||||
"CustomDialogWidth": "400",
|
||||
"CustomDialogHeight": "200",
|
||||
|
||||
"FontSize": "12",
|
||||
"FontFamily": "Arial",
|
||||
"FontSizeHeading": "14",
|
||||
"HeaderFontFamily": "Consolas, Monaco",
|
||||
|
||||
"CheckBoxBulletDecoratorFontSize": "14",
|
||||
"CheckBoxMargin": "5,0,0,0.8",
|
||||
|
||||
"TabButtonFontSize": "14",
|
||||
"TabButtonWidth": "100",
|
||||
"TabButtonHeight": "25",
|
||||
"TabRowHeightInPixels": "50",
|
||||
"IconFontSize": "14",
|
||||
"IconButtonSize": "35",
|
||||
"WinUtilIconSize": "Auto",
|
||||
"SettingsIconFontSize": "18",
|
||||
|
||||
"MicroWinLogoSize": "10",
|
||||
|
||||
"ProgressBarForegroundColor": "#222222",
|
||||
"ProgressBarBackgroundColor": "Transparent",
|
||||
"ProgressBarTextColor": "#FFFFFF",
|
||||
|
||||
"ComboBoxBackgroundColor": "#000000",
|
||||
"LabelboxForegroundColor": "#FFEE58",
|
||||
"MainForegroundColor": "#9CCC65",
|
||||
"MainBackgroundColor": "#000000",
|
||||
"LabelBackgroundColor": "#000000",
|
||||
"LinkForegroundColor": "#add8e6",
|
||||
"LinkHoverForegroundColor": "#FFFFFF",
|
||||
"ComboBoxForegroundColor": "#FFEE58",
|
||||
|
||||
"ButtonFontSize": "12",
|
||||
"ButtonFontFamily": "Arial",
|
||||
"ButtonWidth": "200",
|
||||
"ButtonHeight": "25",
|
||||
"ConfigTabButtonFontSize": "16",
|
||||
|
||||
"SearchBarWidth": "200",
|
||||
"SearchBarHeight": "25",
|
||||
"SearchBarTextBoxFontSize": "16",
|
||||
"SearchBarClearButtonFontSize": "14",
|
||||
|
||||
"ButtonInstallBackgroundColor": "#222222",
|
||||
"ButtonTweaksBackgroundColor": "#333333",
|
||||
"ButtonConfigBackgroundColor": "#444444",
|
||||
"ButtonUpdatesBackgroundColor": "#555555",
|
||||
"ButtonInstallForegroundColor": "#FFFFFF",
|
||||
"ButtonTweaksForegroundColor": "#FFFFFF",
|
||||
"ButtonConfigForegroundColor": "#FFFFFF",
|
||||
"ButtonUpdatesForegroundColor": "#FFFFFF",
|
||||
"ButtonBackgroundColor": "#000019",
|
||||
"ButtonBackgroundPressedColor": "#9CCC65",
|
||||
"ButtonBackgroundMouseoverColor": "#FF5733",
|
||||
"ButtonBackgroundSelectedColor": "#FF5733",
|
||||
"ButtonForegroundColor": "#9CCC65",
|
||||
"ToggleButtonOnColor": "#2e77ff",
|
||||
|
||||
"ButtonBorderThickness": "1",
|
||||
"ButtonMargin": "1",
|
||||
"ButtonCornerRadius": "2",
|
||||
"BorderColor": "#FFAC1C",
|
||||
"BorderOpacity": "0.2",
|
||||
"ShadowPulse": "Forever"
|
||||
}
|
||||
}
|
||||
|
@ -11,21 +11,21 @@
|
||||
"Name": "EnableActivityFeed",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System",
|
||||
"Name": "PublishUserActivities",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\System",
|
||||
"Name": "UploadUserActivities",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
}
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/AH"
|
||||
@ -1598,126 +1598,147 @@
|
||||
"Name": "CreateDesktopShortcutDefault",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "EdgeEnhanceImagesEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "PersonalizationReportingEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "ShowRecommendationsEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "HideFirstRunExperience",
|
||||
"Type": "DWord",
|
||||
"Value": "1",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "0"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "UserFeedbackAllowed",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "ConfigureDoNotTrack",
|
||||
"Type": "DWord",
|
||||
"Value": "1",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "0"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "AlternateErrorPagesEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "EdgeCollectionsEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "EdgeFollowEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "EdgeShoppingAssistantEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "MicrosoftEdgeInsiderPromotionEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "PersonalizationReportingEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "ShowMicrosoftRewards",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "WebWidgetAllowed",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "DiagnosticData",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "EdgeAssetDeliveryServiceEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "EdgeCollectionsEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "CryptoWalletEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "ConfigureDoNotTrack",
|
||||
"Type": "DWord",
|
||||
"Value": "1",
|
||||
"OriginalValue": "0"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Edge",
|
||||
"Name": "WalletDonationEnabled",
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
}
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/EdgeDebloat"
|
||||
@ -1731,7 +1752,7 @@
|
||||
"registry": [
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\CloudContent",
|
||||
"OriginalValue": "<RemoveEntry>",
|
||||
"OriginalValue": "0",
|
||||
"Name": "DisableWindowsConsumerFeatures",
|
||||
"Value": "1",
|
||||
"Type": "DWord"
|
||||
@ -1818,11 +1839,11 @@
|
||||
"Type": "DWord",
|
||||
"Value": "0",
|
||||
"Name": "AllowTelemetry",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "1"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection",
|
||||
"OriginalValue": "<RemoveEntry>",
|
||||
"OriginalValue": "1",
|
||||
"Name": "AllowTelemetry",
|
||||
"Value": "0",
|
||||
"Type": "DWord"
|
||||
@ -1906,21 +1927,21 @@
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\DataCollection",
|
||||
"OriginalValue": "<RemoveEntry>",
|
||||
"OriginalValue": "0",
|
||||
"Name": "DoNotShowFeedbackNotifications",
|
||||
"Value": "1",
|
||||
"Type": "DWord"
|
||||
},
|
||||
{
|
||||
"Path": "HKCU:\\SOFTWARE\\Policies\\Microsoft\\Windows\\CloudContent",
|
||||
"OriginalValue": "<RemoveEntry>",
|
||||
"OriginalValue": "0",
|
||||
"Name": "DisableTailoredExperiencesWithDiagnosticData",
|
||||
"Value": "1",
|
||||
"Type": "DWord"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\AdvertisingInfo",
|
||||
"OriginalValue": "<RemoveEntry>",
|
||||
"OriginalValue": "0",
|
||||
"Name": "DisabledByGroupPolicy",
|
||||
"Value": "1",
|
||||
"Type": "DWord"
|
||||
@ -2047,7 +2068,7 @@
|
||||
},
|
||||
{
|
||||
"Path": "HKCU:\\SOFTWARE\\Policies\\Microsoft\\Windows\\Windows Feeds",
|
||||
"OriginalValue": "<RemoveEntry>",
|
||||
"OriginalValue": "1",
|
||||
"Name": "EnableFeeds",
|
||||
"Value": "0",
|
||||
"Type": "DWord"
|
||||
@ -2061,7 +2082,7 @@
|
||||
},
|
||||
{
|
||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Policies\\Explorer",
|
||||
"OriginalValue": "<RemoveEntry>",
|
||||
"OriginalValue": "1",
|
||||
"Name": "HideSCAMeetNow",
|
||||
"Value": "1",
|
||||
"Type": "DWord"
|
||||
@ -2409,6 +2430,12 @@
|
||||
"Order": "a001_",
|
||||
"InvokeScript": [
|
||||
"
|
||||
# Check if the user has administrative privileges
|
||||
if (-Not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
Write-Host \"Please run this script as an administrator.\"
|
||||
return
|
||||
}
|
||||
|
||||
# Check if System Restore is enabled for the main drive
|
||||
try {
|
||||
# Try getting restore points to check if System Restore is enabled
|
||||
@ -2553,14 +2580,14 @@
|
||||
"Name": "TurnOffWindowsCopilot",
|
||||
"Type": "DWord",
|
||||
"Value": "1",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "0"
|
||||
},
|
||||
{
|
||||
"Path": "HKCU:\\Software\\Policies\\Microsoft\\Windows\\WindowsCopilot",
|
||||
"Name": "TurnOffWindowsCopilot",
|
||||
"Type": "DWord",
|
||||
"Value": "1",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "0"
|
||||
},
|
||||
{
|
||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\Advanced",
|
||||
@ -2584,36 +2611,6 @@
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveCopilot"
|
||||
},
|
||||
"WPFTweaksRecallOff": {
|
||||
"Content": "Disable Recall",
|
||||
"Description": "Turn Recall off",
|
||||
"category": "Essential Tweaks",
|
||||
"panel": "1",
|
||||
"Order": "a011_",
|
||||
"registry": [
|
||||
{
|
||||
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsAI",
|
||||
"Name": "DisableAIDataAnalysis",
|
||||
"Type": "DWord",
|
||||
"Value": "1",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
}
|
||||
],
|
||||
"InvokeScript": [
|
||||
"
|
||||
Write-Host \"Disable Recall\"
|
||||
DISM /Online /Disable-Feature /FeatureName:Recall
|
||||
"
|
||||
],
|
||||
"UndoScript": [
|
||||
"
|
||||
Write-Host \"Enable Recall\"
|
||||
DISM /Online /Enable-Feature /FeatureName:Recall
|
||||
"
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/DisableRecall"
|
||||
},
|
||||
"WPFTweaksDisableLMS1": {
|
||||
"Content": "Disable Intel MM (vPro LMS)",
|
||||
"Description": "Intel LMS service is always listening on all ports and could be a huge security risk. There is no need to run LMS on home machines and even in the Enterprise there are better solutions.",
|
||||
@ -2682,26 +2679,17 @@
|
||||
"
|
||||
$OneDrivePath = $($env:OneDrive)
|
||||
Write-Host \"Removing OneDrive\"
|
||||
|
||||
# Check both traditional and Microsoft Store installations
|
||||
$regPath = \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\OneDriveSetup.exe\"
|
||||
$msStorePath = \"HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\Appx\\AppxAllUserStore\\Applications\\*OneDrive*\"
|
||||
|
||||
if (Test-Path $regPath) {
|
||||
$OneDriveUninstallString = Get-ItemPropertyValue \"$regPath\" -Name \"UninstallString\"
|
||||
$OneDriveExe, $OneDriveArgs = $OneDriveUninstallString.Split(\" \")
|
||||
Start-Process -FilePath $OneDriveExe -ArgumentList \"$OneDriveArgs /silent\" -NoNewWindow -Wait
|
||||
} elseif (Test-Path $msStorePath) {
|
||||
Write-Host \"OneDrive appears to be installed via Microsoft Store\" -ForegroundColor Yellow
|
||||
# Attempt to uninstall via winget
|
||||
Start-Process -FilePath winget -ArgumentList \"uninstall -e --purge --accept-source-agreements Microsoft.OneDrive\" -NoNewWindow -Wait
|
||||
} else {
|
||||
Write-Host \"OneDrive doesn't seem to be installed\" -ForegroundColor Red
|
||||
Write-Host \"Running cleanup if OneDrive path exists\" -ForegroundColor Red
|
||||
Write-Host \"Onedrive dosn't seem to be installed anymore\" -ForegroundColor Red
|
||||
return
|
||||
}
|
||||
|
||||
# Check if OneDrive got Uninstalled (both paths)
|
||||
if (Test-Path $OneDrivePath) {
|
||||
# Check if OneDrive got Uninstalled
|
||||
if (-not (Test-Path $regPath)) {
|
||||
Write-Host \"Copy downloaded Files from the OneDrive Folder to Root UserProfile\"
|
||||
Start-Process -FilePath powershell -ArgumentList \"robocopy '$($OneDrivePath)' '$($env:USERPROFILE.TrimEnd())\\' /mov /e /xj\" -NoNewWindow -Wait
|
||||
|
||||
@ -2725,9 +2713,6 @@
|
||||
reg delete \"HKEY_USERS\\Default\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDriveSetup\" /f
|
||||
reg unload \"hku\\Default\"
|
||||
|
||||
Write-Host \"Removing autostart key\"
|
||||
reg delete \"HKEY_CURRENT_USER\\Software\\Microsoft\\Windows\\CurrentVersion\\Run\" /v \"OneDrive\" /f
|
||||
|
||||
Write-Host \"Removing startmenu entry\"
|
||||
Remove-Item -Force -ErrorAction SilentlyContinue \"$env:userprofile\\AppData\\Roaming\\Microsoft\\Windows\\Start Menu\\Programs\\OneDrive.lnk\"
|
||||
|
||||
@ -2767,7 +2752,7 @@
|
||||
Write-Host \"If there are Files missing afterwards, please Login to Onedrive.com and Download them manually\" -ForegroundColor Yellow
|
||||
Start-Sleep 5
|
||||
} else {
|
||||
Write-Host \"Nothing to Cleanup with OneDrive\" -ForegroundColor Red
|
||||
Write-Host \"Something went Wrong during the Unistallation of OneDrive\" -ForegroundColor Red
|
||||
}
|
||||
"
|
||||
],
|
||||
@ -2779,48 +2764,6 @@
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveOnedrive"
|
||||
},
|
||||
"WPFTweaksRazerBlock": {
|
||||
"Content": "Block Razer Software Installs",
|
||||
"Description": "Blocks ALL Razer Software installations. The hardware works fine without any software.",
|
||||
"category": "z__Advanced Tweaks - CAUTION",
|
||||
"panel": "1",
|
||||
"Order": "a031_",
|
||||
"registry": [
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\DriverSearching",
|
||||
"Name": "SearchOrderConfig",
|
||||
"Value": "0",
|
||||
"OriginalValue": "1",
|
||||
"Type": "DWord"
|
||||
},
|
||||
{
|
||||
"Path": "HKLM:\\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Device Installer",
|
||||
"Name": "DisableCoInstallers",
|
||||
"Value": "1",
|
||||
"OriginalValue": "0",
|
||||
"Type": "DWord"
|
||||
}
|
||||
],
|
||||
"InvokeScript": [
|
||||
"
|
||||
$RazerPath = \"C:\\Windows\\Installer\\Razer\"
|
||||
Remove-Item $RazerPath -Recurse -Force
|
||||
New-Item -Path \"C:\\Windows\\Installer\\\" -Name \"Razer\" -ItemType \"directory\"
|
||||
$Acl = Get-Acl $RazerPath
|
||||
$Ar = New-Object System.Security.AccessControl.FileSystemAccessRule(\"NT AUTHORITY\\SYSTEM\",\"Write\",\"ContainerInherit,ObjectInherit\",\"None\",\"Deny\")
|
||||
$Acl.SetAccessRule($Ar)
|
||||
Set-Acl $RazerPath $Acl
|
||||
"
|
||||
],
|
||||
"UndoScript": [
|
||||
"
|
||||
$RazerPath = \"C:\\Windows\\Installer\\Razer\"
|
||||
Remove-Item $RazerPath -Recurse -Force
|
||||
New-Item -Path \"C:\\Windows\\Installer\\\" -Name \"Razer\" -ItemType \"directory\"
|
||||
"
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/RazerBlock"
|
||||
},
|
||||
"WPFTweaksDisableNotifications": {
|
||||
"Content": "Disable Notification Tray/Calendar",
|
||||
"Description": "Disables all Notifications INCLUDING Calendar",
|
||||
@ -2833,7 +2776,7 @@
|
||||
"Name": "DisableNotificationCenter",
|
||||
"Type": "DWord",
|
||||
"Value": "1",
|
||||
"OriginalValue": "<RemoveEntry>"
|
||||
"OriginalValue": "0"
|
||||
},
|
||||
{
|
||||
"Path": "HKCU:\\Software\\Microsoft\\Windows\\CurrentVersion\\PushNotifications",
|
||||
@ -3192,35 +3135,18 @@
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\GameDVR",
|
||||
"Name": "AllowGameDVR",
|
||||
"Value": "0",
|
||||
"OriginalValue": "<RemoveEntry>",
|
||||
"OriginalValue": "1",
|
||||
"Type": "DWord"
|
||||
}
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/DVR"
|
||||
},
|
||||
"WPFTweaksIPv46": {
|
||||
"Content": "Prefer IPv4 over IPv6",
|
||||
"Description": "To set the IPv4 preference can have latency and security benefits on private networks where IPv6 is not configured.",
|
||||
"WPFTweaksTeredo": {
|
||||
"Content": "Disable Teredo",
|
||||
"Description": "Teredo network tunneling is a ipv6 feature that can cause additional latency.",
|
||||
"category": "Essential Tweaks",
|
||||
"panel": "1",
|
||||
"Order": "a005_",
|
||||
"registry": [
|
||||
{
|
||||
"Path": "HKLM:\\SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters",
|
||||
"Name": "DisabledComponents",
|
||||
"Value": "32",
|
||||
"OriginalValue": "0",
|
||||
"Type": "DWord"
|
||||
}
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/IPv46"
|
||||
},
|
||||
"WPFTweaksTeredo": {
|
||||
"Content": "Disable Teredo",
|
||||
"Description": "Teredo network tunneling is a ipv6 feature that can cause additional latency, but may cause problems with some games",
|
||||
"category": "z__Advanced Tweaks - CAUTION",
|
||||
"panel": "1",
|
||||
"Order": "a023_",
|
||||
"registry": [
|
||||
{
|
||||
"Path": "HKLM:\\SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters",
|
||||
@ -3236,7 +3162,7 @@
|
||||
"UndoScript": [
|
||||
"netsh interface teredo set state default"
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/Teredo"
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/Teredo"
|
||||
},
|
||||
"WPFTweaksDisableipsix": {
|
||||
"Content": "Disable IPv6",
|
||||
@ -3453,9 +3379,25 @@
|
||||
"panel": "1",
|
||||
"Order": "a040_",
|
||||
"Type": "Combobox",
|
||||
"ComboItems": "Default DHCP Google Cloudflare Cloudflare_Malware Cloudflare_Malware_Adult Open_DNS Quad9 AdGuard_Ads_Trackers AdGuard_Ads_Trackers_Malware_Adult dns0.eu_Open dns0.eu_ZERO dns0.eu_KIDS",
|
||||
"ComboItems": "Default DHCP Google Cloudflare Cloudflare_Malware Cloudflare_Malware_Adult Open_DNS Quad9 AdGuard_Ads_Trackers AdGuard_Ads_Trackers_Malware_Adult",
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/changedns"
|
||||
},
|
||||
"WPFTweaksbutton": {
|
||||
"Content": "Run Tweaks",
|
||||
"category": "z__Advanced Tweaks - CAUTION",
|
||||
"panel": "1",
|
||||
"Order": "a041_",
|
||||
"Type": "Button",
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/button"
|
||||
},
|
||||
"WPFUndoall": {
|
||||
"Content": "Undo Selected Tweaks",
|
||||
"category": "z__Advanced Tweaks - CAUTION",
|
||||
"panel": "1",
|
||||
"Order": "a042_",
|
||||
"Type": "Button",
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/Undoall"
|
||||
},
|
||||
"WPFAddUltPerf": {
|
||||
"Content": "Add and Activate Ultimate Performance Profile",
|
||||
"category": "Performance Plans",
|
||||
@ -3473,5 +3415,14 @@
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Performance-Plans/RemoveUltPerf"
|
||||
},
|
||||
"WPFWinUtilShortcut": {
|
||||
"Content": "Create WinUtil Shortcut",
|
||||
"category": "Shortcuts",
|
||||
"panel": "2",
|
||||
"Order": "a082_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Shortcuts/Shortcut"
|
||||
}
|
||||
}
|
||||
|
@ -1,27 +1,18 @@
|
||||
## Launch Issues
|
||||
### Launch Issues:
|
||||
|
||||
### Blocked by anti-virus
|
||||
Windows Security (formerly Defender) and other anti-virus software are known to block the script. The script gets flagged due to the fact that it requires administrator privileges & makes drastic system changes.
|
||||
- Windows Security (formerly Defender) and other anti-virus software are known to block the script. The script gets flagged due to the fact that it requires administrator privileges & makes drastic system changes.
|
||||
- If possible: Allow script in Anti-Virus software settings.
|
||||
|
||||
To resolve this, allow/whitelist the script in your anti-virus software settings, or temporarily disable real-time protection. Since the project is open source, you may audit the code if security is a concern.
|
||||
|
||||
### Download not working
|
||||
If `christitus.com/win` is not working, or you want to download the code from GitHub directly, you can use the direct download link:
|
||||
- If you are having TLS 1.2 issues, or are having trouble resolving `christitus.com/win` then run with the following command:
|
||||
|
||||
```ps1
|
||||
irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1 | iex
|
||||
[Net.ServicePointManager]::SecurityProtocol=[Net.SecurityProtocolType]::Tls12;iex(New-Object Net.WebClient).DownloadString('https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1')
|
||||
```
|
||||
|
||||
If you are seeing errors referencing TLS or security, you may be running an older version of Windows where TLS 1.2 is not the default security protocol used for network connections. The following commands will force .NET to use TLS 1.2, and download the script directly using .NET instead of PowerShell:
|
||||
- If you are unable to resolve `christitus.com/win` and are getting errors launching the tool, it might be due to India blocking GitHub's content domain and preventing downloads.
|
||||
- Source: <https://timesofindia.indiatimes.com/gadgets-news/github-content-domain-blocked-for-these-indian-users-reports/articleshow/96687992.cms>
|
||||
|
||||
```ps1
|
||||
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12
|
||||
iex (New-Object Net.WebClient).DownloadString('https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1')
|
||||
```
|
||||
|
||||
If it still isn't working and you live in India, it might be due to India blocking GitHub's content domain and preventing downloads. See more on [Times of India](https://timesofindia.indiatimes.com/gadgets-news/github-content-domain-blocked-for-these-indian-users-reports/articleshow/96687992.cms).
|
||||
|
||||
If you are still having issues, try using a **VPN**, or changing your **DNS provider** to one of following two providers:
|
||||
If you are still having issues try using a **VPN**, or changing your **DNS provider** to one of following two providers:
|
||||
|
||||
| Provider | Primary DNS | Secondary DNS |
|
||||
|:------------:|:------------:|:-------------:|
|
||||
@ -29,186 +20,160 @@ If you are still having issues, try using a **VPN**, or changing your **DNS prov
|
||||
| Google | `8.8.8.8` | `8.8.4.4` |
|
||||
|
||||
|
||||
### Script blocked by Execution Policy
|
||||
1. Ensure you are running PowerShell as admin: Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
|
||||
2. In the PowerShell window, type this to allow unsigned code to execute and run the installation script:
|
||||
|
||||
- Script doesn't run/PowerShell crashes:
|
||||
1. Press Windows Key+X and select 'PowerShell (Admin)' (Windows 10) or 'Windows Terminal (Admin)' (Windows 11)
|
||||
2. Run:
|
||||
```ps1
|
||||
Set-ExecutionPolicy Unrestricted -Scope Process -Force
|
||||
```
|
||||
3. Run:
|
||||
```ps1
|
||||
irm christitus.com/win | iex
|
||||
```
|
||||
|
||||
## Runtime Issues
|
||||
### Other Issues:
|
||||
|
||||
### WinGet configuration
|
||||
If you have not installed anything using PowerShell before, you may be prompted to configure WinGet. This requires user interaction on first run. You will need to manually type `y` into the PowerShell console and press enter to continue. Once you do it the first time, you will not be prompted again.
|
||||
|
||||
### MicroWin: Error `0x80041031`
|
||||
This error code typically indicates an issue related to Windows Management Instrumentation (WMI). Here are a few steps you can try to resolve the issue:
|
||||
|
||||
1. **Reboot Your Computer:**
|
||||
|
||||
Sometimes, a simple reboot can resolve temporary issues. Restart your computer and try mounting the ISO again.
|
||||
|
||||
3. **Check for System Corruption:**
|
||||
|
||||
Run the System File Checker (SFC) utility to scan and repair system files that may be corrupted.
|
||||
```powershell
|
||||
sfc /scannow
|
||||
- Windows taking longer to shut down:
|
||||
- [#69](https://github.com/ChrisTitusTech/winutil/issues/69) Turn on fast startup: Press Windows key + R, then type:
|
||||
```
|
||||
|
||||
4. **Update Your System:**
|
||||
|
||||
Make sure your operating system is up-to-date. Check for Windows updates and install any pending updates.
|
||||
|
||||
5. **Check WMI Service:**
|
||||
|
||||
Ensure that the Windows Management Instrumentation (WMI) service is running. You can do this through the Services application:
|
||||
- Press `Win`+`R` to open the Run dialog.
|
||||
- Type `services.msc` and press Enter.
|
||||
- Locate *Windows Management Instrumentation* in the list.
|
||||
- Make sure to set its status to "Running" and the startup type to "Automatic".
|
||||
|
||||
6. **Check for Security Software Interference:**
|
||||
|
||||
Security software can sometimes interfere with WMI operations. Temporarily disable your anti-virus or security software and check if the issue persists. WMI is a common attack/infection vector, so many anti-virus programs will limit its usage.
|
||||
|
||||
7. **Event Viewer:**
|
||||
|
||||
Check the Event Viewer for more detailed error information. Look for entries related to the `80041031` error and check if there are any additional details that can help identify the cause.
|
||||
|
||||
- Press `Win`+`X` and select *Event Viewer*.
|
||||
- Navigate to *Windows Logs* > *Application* or *System*.
|
||||
- Look for entries with the source related to WMI or the application use to mount the ISO.
|
||||
|
||||
8. **ISO File Integrity:**
|
||||
|
||||
Ensure that the ISO file you are trying to mount is uncorrupted. Try mounting a different ISO file to see if the issue persists.
|
||||
|
||||
If the problem persists after trying these steps, additional troubleshooting is required. Consider seeking assistance from Microsoft support or community forums for more specific guidance based on your system configuration and the software you use to mount the ISO.
|
||||
|
||||
## Windows Issues
|
||||
|
||||
### Windows takes longer to shut down
|
||||
This could be for a number of reasons:
|
||||
- Turn on fast startup: Press `Windows key`+`R`, then type:
|
||||
```bat
|
||||
control /name Microsoft.PowerOptions /page pageGlobalSettings
|
||||
```
|
||||
- If that doesn't work, disable Hibernation:
|
||||
- Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
|
||||
- In the PowerShell window, type:
|
||||
```bat
|
||||
- If that doesn't work, Disable Hibernation: Press Windows Key+X and select 'PowerShell (Admin)' (Windows 10) or 'Windows Terminal (Admin)' (Windows 11) and enter:
|
||||
```ps1
|
||||
powercfg /H off
|
||||
```
|
||||
Related issue: [#69](https://github.com/ChrisTitusTech/winutil/issues/69)
|
||||
|
||||
### Windows Search does not work
|
||||
Enable Background Apps. Related issues: [#69](https://github.com/ChrisTitusTech/winutil/issues/69) [95](https://github.com/ChrisTitusTech/winutil/issues/95) [#232](https://github.com/ChrisTitusTech/winutil/issues/232)
|
||||
|
||||
### Xbox Game Bar Activation Broken
|
||||
Set the Xbox Accessory Management Service to Automatic:
|
||||
|
||||
- [#69](https://github.com/ChrisTitusTech/winutil/issues/69) [95](https://github.com/ChrisTitusTech/winutil/issues/95) [#232](https://github.com/ChrisTitusTech/winutil/issues/232) Windows Search does not work: Enable Background Apps
|
||||
- [#198](https://github.com/ChrisTitusTech/winutil/issues/198) Xbox Game Bar Activation Broken: Set the Xbox Accessory Management Service to Automatic
|
||||
```ps1
|
||||
Get-Service -Name "XboxGipSvc" | Set-Service -StartupType Automatic
|
||||
```
|
||||
|
||||
Related issue: [#198](https://github.com/ChrisTitusTech/winutil/issues/198)
|
||||
- Winget requires interaction on first run: Manually type 'y' and 'enter' into the PowerShell console to continue
|
||||
- (Windows 11) Quick Settings no longer works: Launch the Script and click 'Enable Action Center'
|
||||
|
||||
### Windows 11: Quick Settings no longer works
|
||||
Launch the Script and click *Enable Action Center*.
|
||||
- Explorer no longer launches: Go to Control Panel, File Explorer Options, Change the 'Open File Explorer to' option to 'This PC'.
|
||||
|
||||
### Explorer (file browser) no longer launches
|
||||
- Press `Windows key`+`R` then type:
|
||||
```bat
|
||||
control /name Microsoft.FolderOptions
|
||||
```
|
||||
- Change the *Open File Explorer to* option to *This PC*.
|
||||
|
||||
### Battery drains too fast
|
||||
If you're using a laptop or tablet and find your battery drains too fast, please try the below troubleshooting steps, and report the results back to the Winutil community.
|
||||
### Battery drains too fast.
|
||||
* When your battery on the laptop drains too fast, please perform these steps and report the results back to the Winutil community.
|
||||
|
||||
1. **Check Battery Health:**
|
||||
- Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
|
||||
- Open a Command Prompt as an administrator.
|
||||
- Run the following command to generate a battery report:
|
||||
```powershell
|
||||
powercfg /batteryreport /output "C:\battery_report.html"
|
||||
```
|
||||
- Open the generated HTML report to review information about battery health and usage. A battery with poor health may hold less charge, discharge faster, or cause other issues.
|
||||
- Open the generated HTML report to review information about battery health and usage.
|
||||
|
||||
2. **Review Power Settings:**
|
||||
- Open the Settings app, and go to *System* > *Power & sleep*.
|
||||
- Go to "Settings" > "System" > "Power & sleep."
|
||||
- Adjust power plan settings based on your preferences and usage patterns.
|
||||
- Click on *Additional power settings* to access advanced power settings that may help.
|
||||
- Click on "Additional power settings" to access advanced power settings.
|
||||
|
||||
3. **Identify Power-Hungry Apps:**
|
||||
- Right-click on the taskbar and select *Task Manager*.
|
||||
- Navigate to the *Processes* tab to identify applications with high CPU or memory usage.
|
||||
- Consider reconfiguring, closing, disabling, or uninstalling applications that use a lot of resources.
|
||||
- Right-click on the taskbar and select "Task Manager."
|
||||
- Navigate to the "Processes" tab to identify applications with high CPU or memory usage.
|
||||
- Consider closing unnecessary background applications.
|
||||
|
||||
4. **Update Drivers:**
|
||||
- Visit your device manufacturer's website or use Windows Update to check for driver updates.
|
||||
- Visit your laptop manufacturer's website or use Windows Update to check for driver updates.
|
||||
- Ensure graphics, chipset, and other essential drivers are up to date.
|
||||
|
||||
5. **Check for Windows Updates:**
|
||||
- Open the Settings app, and go to *Update & Security* > *Windows Update*.
|
||||
- Go to "Settings" > "Update & Security" > "Windows Update."
|
||||
- Check for and install any available updates for your operating system.
|
||||
|
||||
6. **Reduce Screen Brightness:**
|
||||
- Open the Settings app, and go to *System* > *Display*.
|
||||
- Adjust screen brightness based on your preferences and lighting conditions.
|
||||
- Go to "Settings" > "System" > "Display" to adjust brightness.
|
||||
|
||||
7. **Enable Battery Saver:**
|
||||
- Open the Settings app, and go to *System* > *Battery*.
|
||||
- Turn on *Battery saver* to limit background activity and conserve power.
|
||||
7. **Battery Saver Mode:**
|
||||
- Go to "Settings" > "System" > "Battery."
|
||||
- Turn on "Battery saver" to limit background activity and conserve power.
|
||||
|
||||
8. **Check Power Usage in Settings:**
|
||||
- Open the Settings app, and go to *System* > *Battery* > *Battery usage by app*.
|
||||
- Review the list of apps and their power usage. Disable or uninstall any you don't need.
|
||||
- Go to "Settings" > "System" > "Battery" > "Battery usage by app."
|
||||
- Review the list of apps and their power usage.
|
||||
|
||||
9. **Check Background Apps:**
|
||||
- Open the Settings app, and go to *Privacy* > *Background apps*.
|
||||
- Disable or uninstall unnecessary apps running in the background.
|
||||
- Go to "Settings" > "Privacy" > "Background apps."
|
||||
- Disable unnecessary apps running in the background.
|
||||
|
||||
10. **Use `powercfg` for Analysis:**
|
||||
- Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
|
||||
10. **Use Powercfg for Analysis:**
|
||||
- Open a Command Prompt as an administrator.
|
||||
- Run the following command to analyze energy usage and generate a report:
|
||||
```powershell
|
||||
powercfg /energy /output "C:\energy_report.html"
|
||||
```
|
||||
- Open the generated HTML report to identify energy consumption patterns.
|
||||
|
||||
11. **Review Event Logs:**
|
||||
11. **Review Event Viewer:**
|
||||
- Open Event Viewer by searching for it in the Start menu.
|
||||
- Navigate to *Windows Logs* > *System*.
|
||||
- Look for events with the source *Power-Troubleshooter* to identify power-related events. These may highlight battery, input power, and other issues.
|
||||
- Navigate to "Windows Logs" > "System."
|
||||
- Look for events with the source "Power-Troubleshooter" to identify power-related events.
|
||||
|
||||
12. **Check Wake-up Sources:**
|
||||
- Press `Windows Key`+`X` and select *PowerShell (Admin)* in Windows 10, or `Windows Terminal (Admin)` in Windows 11.
|
||||
- Open a Command Prompt as an administrator.
|
||||
- Use the command `powercfg /requests` to identify processes preventing sleep.
|
||||
- Check Task Scheduler for tasks waking up the computer.
|
||||
- Use the command `powercfg /waketimers` to view active wake timers.
|
||||
- Check Task Scheduler to see if any of the discovered processes are scheduled to start on boot or at regular intervals.
|
||||
|
||||
13. **Advanced Identification of Power-Hungry Apps:**
|
||||
13. **Resource Monitor:**
|
||||
- Open Resource Monitor from the Start menu.
|
||||
- Navigate to the *CPU*, *Memory*, *Network*, and other tabs to identify processes with high resource usage.
|
||||
- Consider reconfiguring, closing, disabling, or uninstalling applications that use a lot of resources.
|
||||
- Navigate to the "CPU" tab and identify processes with high CPU usage.
|
||||
|
||||
14. **Disable Activity History:**
|
||||
- Open the Settings app, and go to *Privacy* > *Activity history*.
|
||||
- Turn off *Let Windows collect my activities from this PC*.
|
||||
14. **Windows Settings - Activity History:**
|
||||
- In "Settings," go to "Privacy" > "Activity history."
|
||||
- Turn off "Let Windows collect my activities from this PC."
|
||||
|
||||
15. **Prevent Network Adapters From Waking PC:**
|
||||
15. **Network Adapters:**
|
||||
- Open Device Manager by searching for it in the Start menu.
|
||||
- Locate your network adapter, right-click, and go to *Properties*.
|
||||
- Under the *Power Management* tab, uncheck the option that allows the device to wake the computer.
|
||||
- Locate your network adapter, right-click, and go to "Properties."
|
||||
- Under the "Power Management" tab, uncheck the option that allows the device to wake the computer.
|
||||
|
||||
16. **Review Installed Applications:**
|
||||
- Manually review installed applications by searching for *Add or remove programs* in the Start menu.
|
||||
- Manually review installed applications by searching for "Add or remove programs" in the Start menu.
|
||||
- Check settings/preferences of individual applications for power-related options.
|
||||
- Uninstall unnecessary or problematic software.
|
||||
|
||||
These troubleshooting steps are generic, but should help in most situations. You should have these key takeaways:
|
||||
- Battery health is the most significant limiter on your device's runtime. A battery in poor health usually cannot be made to last like it used to, simply by closing some applications. Consider replacing your battery.
|
||||
- Background applications that use CPU and memory, make lots of or large network requests, read/write to disk frequently, or that keep your PC awake when it could be conserving energy are the next major concern. Avoid installing programs you don't need, only use programs you trust, and configure applications to use as little power and run as infrequently as possible.
|
||||
- Windows performs a lot of tasks that may affect battery life by default. Changing settings, stopping scheduled tasks, and disabling features can help the system stay in lower power states to conserve battery.
|
||||
- Bad chargers, inconsistent power input, and high temperatures will cause batteries to degrade and discharge faster. Use trusted high-quality chargers, ensure input power is steady, clean any fans or airflow ports, and keep the battery/PC cool.
|
||||
* By following these detailed instructions, you should be able to thoroughly diagnose and address battery drain issues on your Windows laptop. Adjust settings as needed to optimize power management and improve battery life.
|
||||
|
||||
### Troubleshoot errors during Microwin usage
|
||||
|
||||
#### Error `0x80041031`
|
||||
|
||||
* This error code typically indicates an issue related to Windows Management Instrumentation (WMI). Here are a few steps you can try to resolve the issue:
|
||||
|
||||
1. **Reboot Your Computer:**
|
||||
Sometimes, a simple reboot can resolve temporary issues. Restart your computer and try mounting the ISO again.
|
||||
|
||||
2. **Check for System Corruption:**
|
||||
Run the System File Checker (SFC) utility to scan and repair system files that may be corrupted.
|
||||
```powershell
|
||||
sfc /scannow
|
||||
```
|
||||
|
||||
3. **Update Your System:**
|
||||
Make sure your operating system is up-to-date. Check for Windows updates and install any pending updates.
|
||||
|
||||
4. **Check WMI Service:**
|
||||
Ensure that the Windows Management Instrumentation (WMI) service is running. You can do this through the Services application:
|
||||
- Press `Win + R` to open the Run dialog.
|
||||
- Type `services.msc` and press Enter.
|
||||
- Locate "Windows Management Instrumentation" in the list.
|
||||
- Make sure to set its status to "Running" and the startup type to "Automatic."
|
||||
|
||||
5. **Check for Security Software Interference:**
|
||||
Security software can sometimes interfere with WMI operations. Temporarily disable your antivirus or security software and check if the issue persists.
|
||||
|
||||
6. **Event Viewer:**
|
||||
Check the Event Viewer for more detailed error information. Look for entries related to the `80041031` error and check if there are any additional details that can help identify the cause.
|
||||
|
||||
- Press `Win + X` and select "Event Viewer."
|
||||
- Navigate to "Windows Logs" -> "Application" or "System."
|
||||
- Look for entries with the source related to WMI or the application use to mount the ISO.
|
||||
|
||||
7. **ISO File Integrity:**
|
||||
Ensure that the ISO file you are trying to mount is uncorrupted. Try mounting a different ISO file to see if the issue persists.
|
||||
|
||||
* If the problem persists after trying these steps, additional troubleshooting is required. Consider seeking assistance from Microsoft support or community forums for more specific guidance based on your system configuration and the software you use to mount the ISO.
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 213 KiB After Width: | Height: | Size: 152 KiB |
Binary file not shown.
Before Width: | Height: | Size: 122 KiB After Width: | Height: | Size: 339 KiB |
3
docs/contribute.md
Normal file
3
docs/contribute.md
Normal file
@ -0,0 +1,3 @@
|
||||
--8<-- ".github/CONTRIBUTING.md"
|
||||
|
||||
<!-- The content is sourced from "CONTRIBUTING.md," located in the root directory of the project. -->
|
@ -1,65 +0,0 @@
|
||||
# Printer Settings
|
||||
|
||||
Last Updated: 2024-08-31
|
||||
|
||||
|
||||
!!! info
|
||||
The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
|
||||
|
||||
|
||||
<!-- BEGIN CUSTOM CONTENT -->
|
||||
|
||||
<!-- END CUSTOM CONTENT -->
|
||||
|
||||
<details>
|
||||
<summary>Preview Code</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"Content": "Printer Settings",
|
||||
"category": "Legacy Windows Panels",
|
||||
"panel": "2",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300"
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Function: Invoke-WPFControlPanel
|
||||
|
||||
```powershell
|
||||
function Invoke-WPFControlPanel {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Opens the requested legacy panel
|
||||
|
||||
.PARAMETER Panel
|
||||
The panel to open
|
||||
|
||||
#>
|
||||
param($Panel)
|
||||
|
||||
switch ($Panel) {
|
||||
"WPFPanelcontrol" {cmd /c control}
|
||||
"WPFPanelnetwork" {cmd /c ncpa.cpl}
|
||||
"WPFPanelpower" {cmd /c powercfg.cpl}
|
||||
"WPFPanelregion" {cmd /c intl.cpl}
|
||||
"WPFPanelsound" {cmd /c mmsys.cpl}
|
||||
"WPFPanelprinter" {Start-Process "shell:::{A8A91A66-3A7D-4424-8D24-04E180695C7A}"}
|
||||
"WPFPanelsystem" {cmd /c sysdm.cpl}
|
||||
"WPFPaneluser" {cmd /c "control userpasswords2"}
|
||||
}
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
<!-- BEGIN SECOND CUSTOM CONTENT -->
|
||||
|
||||
<!-- END SECOND CUSTOM CONTENT -->
|
||||
|
||||
|
||||
[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/../config/feature.json)
|
||||
|
@ -1,38 +0,0 @@
|
||||
# Install CTT PowerShell Profile
|
||||
|
||||
Last Updated: 2024-10-01
|
||||
|
||||
|
||||
!!! info
|
||||
The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
|
||||
|
||||
|
||||
<!-- BEGIN CUSTOM CONTENT -->
|
||||
|
||||
<!-- END CUSTOM CONTENT -->
|
||||
|
||||
<details>
|
||||
<summary>Preview Code</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"Content": "Install CTT PowerShell Profile",
|
||||
"category": "Powershell Profile",
|
||||
"panel": "2",
|
||||
"Order": "a083_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Powershell-Profile/PSProfileInstall"
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
<!-- BEGIN SECOND CUSTOM CONTENT -->
|
||||
|
||||
<!-- END SECOND CUSTOM CONTENT -->
|
||||
|
||||
|
||||
[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/config/feature.json)
|
||||
|
@ -1,38 +0,0 @@
|
||||
# Uninstall CTT PowerShell Profile
|
||||
|
||||
Last Updated: 2024-10-01
|
||||
|
||||
|
||||
!!! info
|
||||
The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
|
||||
|
||||
|
||||
<!-- BEGIN CUSTOM CONTENT -->
|
||||
|
||||
<!-- END CUSTOM CONTENT -->
|
||||
|
||||
<details>
|
||||
<summary>Preview Code</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"Content": "Uninstall CTT PowerShell Profile",
|
||||
"category": "Powershell Profile",
|
||||
"panel": "2",
|
||||
"Order": "a084_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/features/Powershell-Profile/PSProfileUninstall"
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
|
||||
<!-- BEGIN SECOND CUSTOM CONTENT -->
|
||||
|
||||
<!-- END SECOND CUSTOM CONTENT -->
|
||||
|
||||
|
||||
[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/config/feature.json)
|
||||
|
@ -1,91 +0,0 @@
|
||||
# Disable Microsoft Recall
|
||||
|
||||
Last Updated: 2024-10-24
|
||||
|
||||
|
||||
!!! info
|
||||
The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
|
||||
## Description
|
||||
|
||||
Disables MS Recall built into Windows since 24H2.
|
||||
|
||||
<!-- BEGIN CUSTOM CONTENT -->
|
||||
|
||||
<!-- END CUSTOM CONTENT -->
|
||||
|
||||
<details>
|
||||
<summary>Preview Code</summary>
|
||||
|
||||
```json
|
||||
"WPFTweaksRecallOff": {
|
||||
"Content": "Disable Recall",
|
||||
"Description": "Turn Recall off",
|
||||
"category": "Essential Tweaks",
|
||||
"panel": "1",
|
||||
"Order": "a011_",
|
||||
"registry": [
|
||||
{
|
||||
|
||||
"Path": "HKLM:\\SOFTWARE\\Policies\\Microsoft\\Windows\\WindowsAI",
|
||||
"Name": "DisableAIDataAnalysis",
|
||||
"Type": "DWord",
|
||||
"Value": "1",
|
||||
"OriginalValue": "0"
|
||||
}
|
||||
],
|
||||
"InvokeScript": [
|
||||
"
|
||||
Write-Host \"Disable Recall\"
|
||||
DISM /Online /Disable-Feature /FeatureName:Recall
|
||||
"
|
||||
],
|
||||
"UndoScript": [
|
||||
"
|
||||
Write-Host \"Enable Recall\"
|
||||
DISM /Online /Enable-Feature /FeatureName:Recall
|
||||
"
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/DisableRecall"
|
||||
},
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Invoke Script
|
||||
|
||||
```powershell
|
||||
|
||||
Write-Host "Disable Recall"
|
||||
DISM /Online /Disable-Feature /FeatureName:Recall
|
||||
|
||||
|
||||
```
|
||||
## Undo Script
|
||||
|
||||
```powershell
|
||||
|
||||
Write-Host "Enable Recall"
|
||||
DISM /Online /Enable-Feature /FeatureName:Recall
|
||||
|
||||
|
||||
```
|
||||
## Registry Changes
|
||||
Applications and System Components store and retrieve configuration data to modify windows settings, so we can use the registry to change many settings in one place.
|
||||
|
||||
|
||||
You can find information about the registry on [Wikipedia](https://www.wikiwand.com/en/Windows_Registry) and [Microsoft's Website](https://learn.microsoft.com/en-us/windows/win32/sysinfo/registry).
|
||||
|
||||
### Registry Key: DisableAIDataAnalysis
|
||||
|
||||
**Type:** DWord
|
||||
|
||||
**Original Value:** 0
|
||||
|
||||
**New Value:** 1
|
||||
|
||||
<!-- BEGIN SECOND CUSTOM CONTENT -->
|
||||
|
||||
<!-- END SECOND CUSTOM CONTENT -->
|
||||
|
||||
|
||||
[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/config/tweaks.json)
|
@ -1,63 +0,0 @@
|
||||
# Prefer IPv4 over IPv6
|
||||
|
||||
Last Updated: 2024-08-27
|
||||
|
||||
|
||||
!!! info
|
||||
The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
|
||||
## Description
|
||||
|
||||
To set the IPv4 preference can have latency and security benefits on private networks where IPv6 is not configured.
|
||||
|
||||
<!-- BEGIN CUSTOM CONTENT -->
|
||||
|
||||
<!-- END CUSTOM CONTENT -->
|
||||
|
||||
<details>
|
||||
<summary>Preview Code</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"Content": "Prefer IPv4 over IPv6",
|
||||
"Description": "To set the IPv4 preference can have latency and security benefits on private networks where IPv6 is not configured.",
|
||||
"category": "Essential Tweaks",
|
||||
"panel": "1",
|
||||
"Order": "a005_",
|
||||
"registry": [
|
||||
{
|
||||
"Path": "HKLM:\\SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters",
|
||||
"Name": "DisabledComponents",
|
||||
"Value": "32",
|
||||
"OriginalValue": "0",
|
||||
"Type": "DWord"
|
||||
}
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/IPv46"
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Registry Changes
|
||||
Applications and System Components store and retrieve configuration data to modify windows settings, so we can use the registry to change many settings in one place.
|
||||
|
||||
|
||||
You can find information about the registry on [Wikipedia](https://www.wikiwand.com/en/Windows_Registry) and [Microsoft's Website](https://learn.microsoft.com/en-us/windows/win32/sysinfo/registry).
|
||||
|
||||
### Registry Key: DisabledComponents
|
||||
|
||||
**Type:** DWord
|
||||
|
||||
**Original Value:** 0
|
||||
|
||||
**New Value:** 32
|
||||
|
||||
|
||||
|
||||
<!-- BEGIN SECOND CUSTOM CONTENT -->
|
||||
|
||||
<!-- END SECOND CUSTOM CONTENT -->
|
||||
|
||||
|
||||
[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/config/tweaks.json)
|
||||
|
@ -69,7 +69,7 @@ function Invoke-WPFTweakPS7{
|
||||
Write-Host "Powershell 7 is already installed."
|
||||
} else {
|
||||
Write-Host "Installing Powershell 7..."
|
||||
Install-WinUtilProgramWinget -Action Install -Programs @("Microsoft.PowerShell")
|
||||
Invoke-WinUtilWingetProgram -Action Install -Programs @("Microsoft.PowerShell")
|
||||
}
|
||||
$targetTerminalName = "PowerShell"
|
||||
}
|
||||
@ -105,10 +105,10 @@ function Invoke-WPFTweakPS7{
|
||||
}
|
||||
|
||||
```
|
||||
## Function: Install-WinUtilProgramWinget
|
||||
## Function: Invoke-WinUtilWingetProgram
|
||||
|
||||
```powershell
|
||||
Function Install-WinUtilProgramWinget {
|
||||
Function Invoke-WinUtilWingetProgram {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Runs the designated action on the provided programs using Winget
|
||||
|
@ -1,13 +1,13 @@
|
||||
# Disable Teredo
|
||||
|
||||
Last Updated: 2024-08-27
|
||||
Last Updated: 2024-08-07
|
||||
|
||||
|
||||
!!! info
|
||||
The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
|
||||
## Description
|
||||
|
||||
Teredo network tunneling is a ipv6 feature that can cause additional latency, but may cause problems with some games
|
||||
Teredo network tunneling is a ipv6 feature that can cause additional latency.
|
||||
|
||||
<!-- BEGIN CUSTOM CONTENT -->
|
||||
|
||||
@ -19,10 +19,10 @@ Teredo network tunneling is a ipv6 feature that can cause additional latency, bu
|
||||
```json
|
||||
{
|
||||
"Content": "Disable Teredo",
|
||||
"Description": "Teredo network tunneling is a ipv6 feature that can cause additional latency, but may cause problems with some games",
|
||||
"category": "z__Advanced Tweaks - CAUTION",
|
||||
"Description": "Teredo network tunneling is a ipv6 feature that can cause additional latency.",
|
||||
"category": "Essential Tweaks",
|
||||
"panel": "1",
|
||||
"Order": "a023_",
|
||||
"Order": "a005_",
|
||||
"registry": [
|
||||
{
|
||||
"Path": "HKLM:\\SYSTEM\\CurrentControlSet\\Services\\Tcpip6\\Parameters",
|
||||
@ -38,7 +38,7 @@ Teredo network tunneling is a ipv6 feature that can cause additional latency, bu
|
||||
"UndoScript": [
|
||||
"netsh interface teredo set state default"
|
||||
],
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/z--Advanced-Tweaks---CAUTION/Teredo"
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Essential-Tweaks/Teredo"
|
||||
}
|
||||
```
|
||||
|
113
docs/dev/tweaks/Shortcuts/Shortcut.md
Normal file
113
docs/dev/tweaks/Shortcuts/Shortcut.md
Normal file
@ -0,0 +1,113 @@
|
||||
# Create WinUtil Shortcut
|
||||
|
||||
Last Updated: 2024-08-07
|
||||
|
||||
|
||||
!!! info
|
||||
The Development Documentation is auto generated for every compilation of WinUtil, meaning a part of it will always stay up-to-date. **Developers do have the ability to add custom content, which won't be updated automatically.**
|
||||
|
||||
|
||||
<!-- BEGIN CUSTOM CONTENT -->
|
||||
|
||||
<!-- END CUSTOM CONTENT -->
|
||||
|
||||
<details>
|
||||
<summary>Preview Code</summary>
|
||||
|
||||
```json
|
||||
{
|
||||
"Content": "Create WinUtil Shortcut",
|
||||
"category": "Shortcuts",
|
||||
"panel": "2",
|
||||
"Order": "a082_",
|
||||
"Type": "Button",
|
||||
"ButtonWidth": "300",
|
||||
"link": "https://christitustech.github.io/winutil/dev/tweaks/Shortcuts/Shortcut"
|
||||
}
|
||||
```
|
||||
|
||||
</details>
|
||||
|
||||
## Function: Invoke-WPFShortcut
|
||||
|
||||
```powershell
|
||||
function Invoke-WPFShortcut {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Creates a shortcut and prompts for a save location
|
||||
|
||||
.PARAMETER ShortcutToAdd
|
||||
The name of the shortcut to add
|
||||
|
||||
.PARAMETER RunAsAdmin
|
||||
A boolean value to make 'Run as administrator' property on (true) or off (false), defaults to off
|
||||
|
||||
#>
|
||||
param(
|
||||
$ShortcutToAdd,
|
||||
[bool]$RunAsAdmin = $false
|
||||
)
|
||||
|
||||
# Preper the Shortcut Fields and add an a Custom Icon if it's available, else don't add a Custom Icon.
|
||||
|
||||
Switch ($ShortcutToAdd) {
|
||||
"WinUtil" {
|
||||
# Use Powershell 7 if installed and fallback to PS5 if not
|
||||
if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
|
||||
$shell = "pwsh.exe"
|
||||
} else {
|
||||
$shell = "powershell.exe"
|
||||
}
|
||||
|
||||
$shellArgs = "-ExecutionPolicy Bypass -Command `"Start-Process $shell -verb runas -ArgumentList `'-Command `"irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1 | iex`"`'"
|
||||
|
||||
$DestinationName = "WinUtil.lnk"
|
||||
}
|
||||
}
|
||||
|
||||
# Show a File Dialog Browser, to let the User choose the Name and Location of where to save the Shortcut
|
||||
$FileBrowser = New-Object System.Windows.Forms.SaveFileDialog
|
||||
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
||||
$FileBrowser.Filter = "Shortcut Files (*.lnk)|*.lnk"
|
||||
$FileBrowser.FileName = $DestinationName
|
||||
|
||||
# Do an Early Return if the Save Operation was canceled by User's Input.
|
||||
$FileBrowserResult = $FileBrowser.ShowDialog()
|
||||
$DialogResultEnum = New-Object System.Windows.Forms.DialogResult
|
||||
if (-not ($FileBrowserResult -eq $DialogResultEnum::OK)) {
|
||||
return
|
||||
}
|
||||
|
||||
# Prepare the Shortcut paramter
|
||||
$WshShell = New-Object -comObject WScript.Shell
|
||||
$Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName)
|
||||
$Shortcut.TargetPath = $shell
|
||||
$Shortcut.Arguments = $shellArgs
|
||||
if (Test-Path -Path $winutildir["logo.ico"]) {
|
||||
$shortcut.IconLocation = $winutildir["logo.ico"]
|
||||
}
|
||||
|
||||
# Save the Shortcut to disk
|
||||
$Shortcut.Save()
|
||||
|
||||
if ($RunAsAdmin -eq $true) {
|
||||
$bytes = [System.IO.File]::ReadAllBytes($FileBrowser.FileName)
|
||||
# Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex
|
||||
$bytes[0x15] = $bytes[0x15] -bor 0x20
|
||||
[System.IO.File]::WriteAllBytes($FileBrowser.FileName, $bytes)
|
||||
}
|
||||
|
||||
Write-Host "Shortcut for $ShortcutToAdd has been saved to $($FileBrowser.FileName) with 'Run as administrator' set to $RunAsAdmin"
|
||||
}
|
||||
|
||||
```
|
||||
|
||||
|
||||
<!-- BEGIN SECOND CUSTOM CONTENT -->
|
||||
|
||||
<!-- END SECOND CUSTOM CONTENT -->
|
||||
|
||||
|
||||
[View the JSON file](https://github.com/ChrisTitusTech/winutil/tree/main/config/tweaks.json)
|
||||
|
176
docs/devdocs.md
176
docs/devdocs.md
@ -3,106 +3,106 @@
|
||||
|
||||
## Tweaks
|
||||
|
||||
### Essential-Tweaks
|
||||
|
||||
- [Change Windows Terminal default: PowerShell 5 -> PowerShell 7](../docs/dev/tweaks/Essential-Tweaks/Powershell7.md)
|
||||
- [Create Restore Point](../docs/dev/tweaks/Essential-Tweaks/RestorePoint.md)
|
||||
- [Debloat Edge](../docs/dev/tweaks/Essential-Tweaks/EdgeDebloat.md)
|
||||
- [Delete Temporary Files](../docs/dev/tweaks/Essential-Tweaks/DeleteTempFiles.md)
|
||||
- [Disable Activity History](../docs/dev/tweaks/Essential-Tweaks/AH.md)
|
||||
- [Disable ConsumerFeatures](../docs/dev/tweaks/Essential-Tweaks/ConsumerFeatures.md)
|
||||
- [Disable GameDVR](../docs/dev/tweaks/Essential-Tweaks/DVR.md)
|
||||
- [Disable Hibernation](../docs/dev/tweaks/Essential-Tweaks/Hiber.md)
|
||||
- [Disable Homegroup](../docs/dev/tweaks/Essential-Tweaks/Home.md)
|
||||
- [Disable Location Tracking](../docs/dev/tweaks/Essential-Tweaks/Loc.md)
|
||||
- [Disable Powershell 7 Telemetry](../docs/dev/tweaks/Essential-Tweaks/Powershell7Tele.md)
|
||||
- [Disable Storage Sense](../docs/dev/tweaks/Essential-Tweaks/Storage.md)
|
||||
- [Disable Telemetry](../docs/dev/tweaks/Essential-Tweaks/Tele.md)
|
||||
- [Disable Wifi-Sense](../docs/dev/tweaks/Essential-Tweaks/Wifi.md)
|
||||
- [Enable End Task With Right Click](../docs/dev/tweaks/Essential-Tweaks/EndTaskOnTaskbar.md)
|
||||
- [Prefer IPv4 over IPv6](../docs/dev/tweaks/Essential-Tweaks/IPv46.md)
|
||||
- [Run Disk Cleanup](../docs/dev/tweaks/Essential-Tweaks/DiskCleanup.md)
|
||||
- [Set Hibernation as default (good for laptops)](../docs/dev/tweaks/Essential-Tweaks/LaptopHibernation.md)
|
||||
- [Set Services to Manual](../docs/dev/tweaks/Essential-Tweaks/Services.md)
|
||||
### Shortcuts
|
||||
|
||||
- [Create WinUtil Shortcut](../docs/dev/tweaks/Shortcuts/Shortcut.md)
|
||||
### z--Advanced-Tweaks---CAUTION
|
||||
|
||||
- [Adobe Debloat](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/DebloatAdobe.md)
|
||||
- [Adobe Network Block](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/BlockAdobeNet.md)
|
||||
- [Disable Background Apps](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableBGapps.md)
|
||||
- [Disable Fullscreen Optimizations](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableFSO.md)
|
||||
- [Disable Intel MM (vPro LMS)](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableLMS1.md)
|
||||
- [Disable IPv6](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/Disableipsix.md)
|
||||
- [Disable Microsoft Copilot](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveCopilot.md)
|
||||
- [Disable Notification Tray/Calendar](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableNotifications.md)
|
||||
- [Disable Teredo](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/Teredo.md)
|
||||
- [DNS](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/changedns.md)
|
||||
- [Remove ALL MS Store Apps - NOT RECOMMENDED](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/DeBloat.md)
|
||||
- [Remove Home and Gallery from explorer](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveHomeGallery.md)
|
||||
- [Remove Microsoft Edge](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveEdge.md)
|
||||
- [Remove OneDrive](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveOnedrive.md)
|
||||
- [Run OO Shutup 10](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/OOSUbutton.md)
|
||||
- [Set Classic Right-Click Menu ](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/RightClickMenu.md)
|
||||
- [Set Display for Performance](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/Display.md)
|
||||
- [Set Time to UTC (Dual Boot)](../docs/dev/tweaks/z--Advanced-Tweaks---CAUTION/UTC.md)
|
||||
- [Adobe Debloat](dev/tweaks/z--Advanced-Tweaks---CAUTION/DebloatAdobe.md)
|
||||
- [Adobe Network Block](dev/tweaks/z--Advanced-Tweaks---CAUTION/BlockAdobeNet.md)
|
||||
- [Disable Background Apps](dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableBGapps.md)
|
||||
- [Disable Fullscreen Optimizations](dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableFSO.md)
|
||||
- [Disable Intel MM (vPro LMS)](dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableLMS1.md)
|
||||
- [Disable IPv6](dev/tweaks/z--Advanced-Tweaks---CAUTION/Disableipsix.md)
|
||||
- [Disable Microsoft Copilot](dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveCopilot.md)
|
||||
- [Disable Notification Tray/Calendar](dev/tweaks/z--Advanced-Tweaks---CAUTION/DisableNotifications.md)
|
||||
- [DNS](dev/tweaks/z--Advanced-Tweaks---CAUTION/changedns.md)
|
||||
- [Remove ALL MS Store Apps - NOT RECOMMENDED](dev/tweaks/z--Advanced-Tweaks---CAUTION/DeBloat.md)
|
||||
- [Remove Home and Gallery from explorer](dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveHomeGallery.md)
|
||||
- [Remove Microsoft Edge](dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveEdge.md)
|
||||
- [Remove OneDrive](dev/tweaks/z--Advanced-Tweaks---CAUTION/RemoveOnedrive.md)
|
||||
- [Run OO Shutup 10](dev/tweaks/z--Advanced-Tweaks---CAUTION/OOSUbutton.md)
|
||||
- [Run Tweaks](dev/tweaks/z--Advanced-Tweaks---CAUTION/button.md)
|
||||
- [Set Classic Right-Click Menu ](dev/tweaks/z--Advanced-Tweaks---CAUTION/RightClickMenu.md)
|
||||
- [Set Display for Performance](dev/tweaks/z--Advanced-Tweaks---CAUTION/Display.md)
|
||||
- [Set Time to UTC (Dual Boot)](dev/tweaks/z--Advanced-Tweaks---CAUTION/UTC.md)
|
||||
- [Undo Selected Tweaks](dev/tweaks/z--Advanced-Tweaks---CAUTION/Undoall.md)
|
||||
### Essential-Tweaks
|
||||
|
||||
- [Change Windows Terminal default: PowerShell 5 -> PowerShell 7](dev/tweaks/Essential-Tweaks/Powershell7.md)
|
||||
- [Create Restore Point](dev/tweaks/Essential-Tweaks/RestorePoint.md)
|
||||
- [Debloat Edge](dev/tweaks/Essential-Tweaks/EdgeDebloat.md)
|
||||
- [Delete Temporary Files](dev/tweaks/Essential-Tweaks/DeleteTempFiles.md)
|
||||
- [Disable Activity History](dev/tweaks/Essential-Tweaks/AH.md)
|
||||
- [Disable ConsumerFeatures](dev/tweaks/Essential-Tweaks/ConsumerFeatures.md)
|
||||
- [Disable GameDVR](dev/tweaks/Essential-Tweaks/DVR.md)
|
||||
- [Disable Hibernation](dev/tweaks/Essential-Tweaks/Hiber.md)
|
||||
- [Disable Homegroup](dev/tweaks/Essential-Tweaks/Home.md)
|
||||
- [Disable Location Tracking](dev/tweaks/Essential-Tweaks/Loc.md)
|
||||
- [Disable Powershell 7 Telemetry](dev/tweaks/Essential-Tweaks/Powershell7Tele.md)
|
||||
- [Disable Storage Sense](dev/tweaks/Essential-Tweaks/Storage.md)
|
||||
- [Disable Telemetry](dev/tweaks/Essential-Tweaks/Tele.md)
|
||||
- [Disable Teredo](dev/tweaks/Essential-Tweaks/Teredo.md)
|
||||
- [Disable Wifi-Sense](dev/tweaks/Essential-Tweaks/Wifi.md)
|
||||
- [Enable End Task With Right Click](dev/tweaks/Essential-Tweaks/EndTaskOnTaskbar.md)
|
||||
- [Run Disk Cleanup](dev/tweaks/Essential-Tweaks/DiskCleanup.md)
|
||||
- [Set Hibernation as default (good for laptops)](dev/tweaks/Essential-Tweaks/LaptopHibernation.md)
|
||||
- [Set Services to Manual](dev/tweaks/Essential-Tweaks/Services.md)
|
||||
### Shortcuts
|
||||
|
||||
- [Create WinUtil Shortcut](dev/tweaks/Shortcuts/Shortcut.md)
|
||||
### Customize-Preferences
|
||||
|
||||
- [Bing Search in Start Menu](../docs/dev/tweaks/Customize-Preferences/BingSearch.md)
|
||||
- [Center Taskbar Items](../docs/dev/tweaks/Customize-Preferences/TaskbarAlignment.md)
|
||||
- [Dark Theme for Windows](../docs/dev/tweaks/Customize-Preferences/DarkMode.md)
|
||||
- [Detailed BSoD](../docs/dev/tweaks/Customize-Preferences/DetailedBSoD.md)
|
||||
- [Mouse Acceleration](../docs/dev/tweaks/Customize-Preferences/MouseAcceleration.md)
|
||||
- [NumLock on Startup](../docs/dev/tweaks/Customize-Preferences/NumLock.md)
|
||||
- [Search Button in Taskbar](../docs/dev/tweaks/Customize-Preferences/TaskbarSearch.md)
|
||||
- [Show File Extensions](../docs/dev/tweaks/Customize-Preferences/ShowExt.md)
|
||||
- [Show Hidden Files](../docs/dev/tweaks/Customize-Preferences/HiddenFiles.md)
|
||||
- [Snap Assist Flyout](../docs/dev/tweaks/Customize-Preferences/SnapFlyout.md)
|
||||
- [Snap Assist Suggestion](../docs/dev/tweaks/Customize-Preferences/SnapSuggestion.md)
|
||||
- [Snap Window](../docs/dev/tweaks/Customize-Preferences/SnapWindow.md)
|
||||
- [Sticky Keys](../docs/dev/tweaks/Customize-Preferences/StickyKeys.md)
|
||||
- [Task View Button in Taskbar](../docs/dev/tweaks/Customize-Preferences/TaskView.md)
|
||||
- [Verbose Messages During Logon](../docs/dev/tweaks/Customize-Preferences/VerboseLogon.md)
|
||||
- [Widgets Button in Taskbar](../docs/dev/tweaks/Customize-Preferences/TaskbarWidgets.md)
|
||||
- [Bing Search in Start Menu](dev/tweaks/Customize-Preferences/BingSearch.md)
|
||||
- [Center Taskbar Items](dev/tweaks/Customize-Preferences/TaskbarAlignment.md)
|
||||
- [Dark Theme for Windows](dev/tweaks/Customize-Preferences/DarkMode.md)
|
||||
- [Detailed BSoD](dev/tweaks/Customize-Preferences/DetailedBSoD.md)
|
||||
- [Mouse Acceleration](dev/tweaks/Customize-Preferences/MouseAcceleration.md)
|
||||
- [NumLock on Startup](dev/tweaks/Customize-Preferences/NumLock.md)
|
||||
- [Search Button in Taskbar](dev/tweaks/Customize-Preferences/TaskbarSearch.md)
|
||||
- [Show File Extensions](dev/tweaks/Customize-Preferences/ShowExt.md)
|
||||
- [Show Hidden Files](dev/tweaks/Customize-Preferences/HiddenFiles.md)
|
||||
- [Snap Assist Flyout](dev/tweaks/Customize-Preferences/SnapFlyout.md)
|
||||
- [Snap Assist Suggestion](dev/tweaks/Customize-Preferences/SnapSuggestion.md)
|
||||
- [Snap Window](dev/tweaks/Customize-Preferences/SnapWindow.md)
|
||||
- [Sticky Keys](dev/tweaks/Customize-Preferences/StickyKeys.md)
|
||||
- [Task View Button in Taskbar](dev/tweaks/Customize-Preferences/TaskView.md)
|
||||
- [Verbose Messages During Logon](dev/tweaks/Customize-Preferences/VerboseLogon.md)
|
||||
- [Widgets Button in Taskbar](dev/tweaks/Customize-Preferences/TaskbarWidgets.md)
|
||||
### Performance-Plans
|
||||
|
||||
- [Add and Activate Ultimate Performance Profile](../docs/dev/tweaks/Performance-Plans/AddUltPerf.md)
|
||||
- [Remove Ultimate Performance Profile](../docs/dev/tweaks/Performance-Plans/RemoveUltPerf.md)
|
||||
- [Add and Activate Ultimate Performance Profile](dev/tweaks/Performance-Plans/AddUltPerf.md)
|
||||
- [Remove Ultimate Performance Profile](dev/tweaks/Performance-Plans/RemoveUltPerf.md)
|
||||
|
||||
## Features
|
||||
|
||||
### Fixes
|
||||
|
||||
- [Remove Adobe Creative Cloud](../docs/dev/features/Fixes/RunAdobeCCCleanerTool.md)
|
||||
- [Reset Network](../docs/dev/features/Fixes/Network.md)
|
||||
- [Reset Windows Update](../docs/dev/features/Fixes/Update.md)
|
||||
- [Set Up Autologin](../docs/dev/features/Fixes/Autologin.md)
|
||||
- [System Corruption Scan](../docs/dev/features/Fixes/DISM.md)
|
||||
- [WinGet Reinstall](../docs/dev/features/Fixes/Winget.md)
|
||||
### Legacy-Windows-Panels
|
||||
|
||||
- [Control Panel](../docs/dev/features/Legacy-Windows-Panels/control.md)
|
||||
- [Network Connections](../docs/dev/features/Legacy-Windows-Panels/network.md)
|
||||
- [Power Panel](../docs/dev/features/Legacy-Windows-Panels/power.md)
|
||||
- [Printer Settings](../docs/dev/features/Legacy-Windows-Panels/printer.md)
|
||||
- [Region](../docs/dev/features/Legacy-Windows-Panels/region.md)
|
||||
- [Sound Settings](../docs/dev/features/Legacy-Windows-Panels/sound.md)
|
||||
- [System Properties](../docs/dev/features/Legacy-Windows-Panels/system.md)
|
||||
- [User Accounts](../docs/dev/features/Legacy-Windows-Panels/user.md)
|
||||
- [Control Panel](dev/features/Legacy-Windows-Panels/control.md)
|
||||
- [Network Connections](dev/features/Legacy-Windows-Panels/network.md)
|
||||
- [Power Panel](dev/features/Legacy-Windows-Panels/power.md)
|
||||
- [Region](dev/features/Legacy-Windows-Panels/region.md)
|
||||
- [Sound Settings](dev/features/Legacy-Windows-Panels/sound.md)
|
||||
- [System Properties](dev/features/Legacy-Windows-Panels/system.md)
|
||||
- [User Accounts](dev/features/Legacy-Windows-Panels/user.md)
|
||||
### Fixes
|
||||
|
||||
- [Remove Adobe Creative Cloud](dev/features/Fixes/RunAdobeCCCleanerTool.md)
|
||||
- [Reset Network](dev/features/Fixes/Network.md)
|
||||
- [Reset Windows Update](dev/features/Fixes/Update.md)
|
||||
- [Set Up Autologin](dev/features/Fixes/Autologin.md)
|
||||
- [System Corruption Scan](dev/features/Fixes/DISM.md)
|
||||
- [WinGet Reinstall](dev/features/Fixes/Winget.md)
|
||||
### Features
|
||||
|
||||
- [All .Net Framework (2,3,4)](../docs/dev/features/Features/dotnet.md)
|
||||
- [Disable Legacy F8 Boot Recovery](../docs/dev/features/Features/DisableLegacyRecovery.md)
|
||||
- [Disable Search Box Web Suggestions in Registry(explorer restart)](../docs/dev/features/Features/DisableSearchSuggestions.md)
|
||||
- [Enable Daily Registry Backup Task 12.30am](../docs/dev/features/Features/RegBackup.md)
|
||||
- [Enable Legacy F8 Boot Recovery](../docs/dev/features/Features/EnableLegacyRecovery.md)
|
||||
- [Enable Search Box Web Suggestions in Registry(explorer restart)](../docs/dev/features/Features/EnableSearchSuggestions.md)
|
||||
- [HyperV Virtualization](../docs/dev/features/Features/hyperv.md)
|
||||
- [Install Features](../docs/dev/features/Features/Install.md)
|
||||
- [Legacy Media (WMP, DirectPlay)](../docs/dev/features/Features/legacymedia.md)
|
||||
- [NFS - Network File System](../docs/dev/features/Features/nfs.md)
|
||||
- [Windows Sandbox](../docs/dev/features/Features/Sandbox.md)
|
||||
- [Windows Subsystem for Linux](../docs/dev/features/Features/wsl.md)
|
||||
- [All .Net Framework (2,3,4)](dev/features/Features/dotnet.md)
|
||||
- [Disable Legacy F8 Boot Recovery](dev/features/Features/DisableLegacyRecovery.md)
|
||||
- [Disable Search Box Web Suggestions in Registry(explorer restart)](dev/features/Features/DisableSearchSuggestions.md)
|
||||
- [Enable Daily Registry Backup Task 12.30am](dev/features/Features/RegBackup.md)
|
||||
- [Enable Legacy F8 Boot Recovery](dev/features/Features/EnableLegacyRecovery.md)
|
||||
- [Enable Search Box Web Suggestions in Registry(explorer restart)](dev/features/Features/EnableSearchSuggestions.md)
|
||||
- [HyperV Virtualization](dev/features/Features/hyperv.md)
|
||||
- [Install Features](dev/features/Features/Install.md)
|
||||
- [Legacy Media (WMP, DirectPlay)](dev/features/Features/legacymedia.md)
|
||||
- [NFS - Network File System](dev/features/Features/nfs.md)
|
||||
- [Windows Sandbox](dev/features/Features/Sandbox.md)
|
||||
- [Windows Subsystem for Linux](dev/features/Features/wsl.md)
|
||||
|
||||
|
||||
|
@ -29,14 +29,8 @@
|
||||
* Click the `Clear Selection` button.
|
||||
* This will unselect all checked programs.
|
||||
|
||||
=== "prefer Chocolatey"
|
||||
* Check the `prefer Chocolatey` checkbox
|
||||
* By default Winutil will use winget to install/upgrade/remove packages and fallback to Chocolatey. This option reverses the preference.
|
||||
* This preference will be used for all Buttons on the Install page and persist across Winutil restarts
|
||||
|
||||

|
||||

|
||||
|
||||

|
||||

|
||||
!!! tip
|
||||
|
||||
If you have trouble finding an application, press `ctrl + f` and search the name of it. Applications will filter depending on your input.
|
||||
@ -44,8 +38,8 @@
|
||||
## Tweaks
|
||||
---
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
### Run Tweaks
|
||||
* **Open Tweaks Tab**: Navigate to the 'Tweaks' tab in the application.
|
||||
@ -77,17 +71,13 @@ The utility provides a convenient DNS selection feature, allowing users to choos
|
||||
|
||||
* **Default**: Uses the default DNS settings configured by your ISP or network.
|
||||
* **DHCP**: Automatically acquires DNS settings from the DHCP server.
|
||||
* [**Google**](https://developers.google.com/speed/public-dns?hl=en): A reliable and fast DNS service provided by Google.
|
||||
* [**Google**](https://developers.google.com/speed/public-dns?hl=de): A reliable and fast DNS service provided by Google.
|
||||
* [**Cloudflare**](https://developers.cloudflare.com/1.1.1.1/): Known for speed and privacy, Cloudflare DNS is a popular choice for enhancing internet performance.
|
||||
* [**Cloudflare_Malware**](https://developers.cloudflare.com/1.1.1.1/setup/#:~:text=Use%20the%20following%20DNS%20resolvers%20to%20block%20malicious%20content%3A): Provides additional protection by blocking malware sites.
|
||||
* [**Cloudflare_Malware_Adult**](https://developers.cloudflare.com/1.1.1.1/setup/#:~:text=Use%20the%20following%20DNS%20resolvers%20to%20block%20malware%20and%20adult%20content%3A): Blocks both malware and adult content, offering more comprehensive filtering.
|
||||
* [**Level3**](https://www.lumen.com/): Another fast and reliable DNS service option.
|
||||
* [**Open_DNS**](https://www.opendns.com/setupguide/#familyshield): Offers customizable filtering and enhanced security features.
|
||||
* [**Quad9**](https://quad9.net/): Focuses on security by blocking known malicious domains.
|
||||
* [**AdGuard_Ads_Trackers**](https://adguard-dns.io/en/welcome.html) AdGuard DNS will block ads, trackers, or any other DNS requests. Visit website and login for a dashboard, statistics and customize your experience in the server settings.
|
||||
* [**AdGuard_Ads_Trackers_Malware_Adult**](https://adguard-dns.io/en/welcome.html) AdGuard DNS will block ads, trackers, adult content, and enable Safe Search and Safe Mode, where possible.
|
||||
* [**dns0.eu_Open**](https://www.dns0.eu/) The European public DNS that makes your Internet safer. Offers general-purpose filtering to block malware, phishing, and tracking domains for enhanced privacy and security.
|
||||
* [**dns0.eu_ZERO**](https://www.dns0.eu/zero) Provides advanced security with robust filters for highly sensitive environments, blocking high-risk domains using threat intelligence and sophisticated heuristics like Newly Registered Domains (NRD) and Domain Generation Algorithms (DGA).
|
||||
* [**dns0.eu_KIDS**](https://www.dns0.eu/kids) A child-safe DNS that blocks adult content, explicit search results, mature videos, dating sites, piracy, and ads, creating a secure internet experience for children on any device or network.
|
||||
|
||||
### Customize Preferences
|
||||
|
||||
@ -146,10 +136,6 @@ Open old-school Windows panels directly from WinUtil. Following Panels are avail
|
||||
* System Properties
|
||||
* User Accounts
|
||||
|
||||
### Remote Access
|
||||
|
||||
Enables OpenSSH server on your windows machine.
|
||||
|
||||
## Updates
|
||||
---
|
||||
|
||||
@ -184,8 +170,8 @@ The utility provides three distinct settings for managing Windows updates: Defau
|
||||
|
||||
* **MicroWin** lets you customize your Windows 10 and 11 installation images by debloating them however you want.
|
||||
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
#### Basic usage
|
||||
|
||||
@ -243,12 +229,12 @@ With MicroWin, you can also configure your user before proceeding if you don't w
|
||||
* Some features are available through automation. This allows you to save your config file, pass it to WinUtil, walk away and come back to a finished system. Here is how you can set it up currently with Winutil >24.01.15
|
||||
|
||||
* On the Install Tab, click "Get Installed", this will get all installed apps **supported by Winutil** on the system.
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
* Click on the Settings cog in the upper right corner and choose Export. Choose file file and location; this will export the setting file.
|
||||

|
||||

|
||||

|
||||

|
||||
|
||||
* Copy this file to a USB or somewhere you can use it after Windows installation.
|
||||
|
||||
|
@ -1,10 +0,0 @@
|
||||
class ErroredPackage {
|
||||
[string]$PackageName
|
||||
[string]$ErrorMessage
|
||||
ErroredPackage() { $this.Init(@{} )}
|
||||
# Constructor for packages that have errored out
|
||||
ErroredPackage([string]$pkgName, [string]$reason) {
|
||||
$this.PackageName = $pkgName
|
||||
$this.ErrorMessage = $reason
|
||||
}
|
||||
}
|
@ -1,23 +0,0 @@
|
||||
function Microwin-CopyToUSB([string]$fileToCopy) {
|
||||
foreach ($volume in Get-Volume) {
|
||||
if ($volume -and $volume.FileSystemLabel -ieq "ventoy") {
|
||||
$destinationPath = "$($volume.DriveLetter):\"
|
||||
#Copy-Item -Path $fileToCopy -Destination $destinationPath -Force
|
||||
# Get the total size of the file
|
||||
$totalSize = (Get-Item "$fileToCopy").length
|
||||
|
||||
Copy-Item -Path "$fileToCopy" -Destination "$destinationPath" -Verbose -Force -Recurse -Container -PassThru |
|
||||
ForEach-Object {
|
||||
# Calculate the percentage completed
|
||||
$completed = ($_.BytesTransferred / $totalSize) * 100
|
||||
|
||||
# Display the progress bar
|
||||
Write-Progress -Activity "Copying File" -Status "Progress" -PercentComplete $completed -CurrentOperation ("{0:N2} MB / {1:N2} MB" -f ($_.BytesTransferred / 1MB), ($totalSize / 1MB))
|
||||
}
|
||||
|
||||
Write-Host "File copied to Ventoy drive $($volume.DriveLetter)"
|
||||
return
|
||||
}
|
||||
}
|
||||
Write-Host "Ventoy USB Key is not inserted"
|
||||
}
|
@ -1,49 +0,0 @@
|
||||
function Microwin-GetLangFromCulture {
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory, Position = 0)] [string]$langName
|
||||
)
|
||||
|
||||
switch -Wildcard ($langName)
|
||||
{
|
||||
"ar*" { return "Arabic" }
|
||||
"pt-BR" { return "Brazilian Portuguese" }
|
||||
"bg*" { return "Bulgarian" }
|
||||
{($_ -eq "zh-CH") -or ($_ -like "zh-Hans*") -or ($_ -eq "zh-SG") -or ($_ -eq "zh-CHS")} { return "Chinese (Simplified)" }
|
||||
{($_ -eq "zh") -or ($_ -eq "zh-Hant") -or ($_ -eq "zh-HK") -or ($_ -eq "zh-MO") -or ($_ -eq "zh-TW") -or ($_ -eq "zh-CHT")} { return "Chinese (Traditional)" }
|
||||
"hr*" { return "Croatian" }
|
||||
"cs*" { return "Czech" }
|
||||
"da*" { return "Danish" }
|
||||
"nl*" { return "Dutch" }
|
||||
"en-US" { return "English" }
|
||||
{($_ -like "en*") -and ($_ -ne "en-US")} { return "English International" }
|
||||
"et*" { return "Estonian" }
|
||||
"fi*" { return "Finnish" }
|
||||
{($_ -like "fr*") -and ($_ -ne "fr-CA")} { return "French" }
|
||||
"fr-CA" { return "French Canadian" }
|
||||
"de*" { return "German" }
|
||||
"el*" { return "Greek" }
|
||||
"he*" { return "Hebrew" }
|
||||
"hu*" { return "Hungarian" }
|
||||
"it*" { return "Italian" }
|
||||
"ja*" { return "Japanese" }
|
||||
"ko*" { return "Korean" }
|
||||
"lv*" { return "Latvian" }
|
||||
"lt*" { return "Lituanian" }
|
||||
"nb*" { return "Norwegian" }
|
||||
"pl*" { return "Polish" }
|
||||
{($_ -like "pt*") -and ($_ -ne "pt-BR")} { return "Portuguese" }
|
||||
"ro*" { return "Romanian" }
|
||||
"ru*" { return "Russian" }
|
||||
"sr-Latn*" { return "Serbian Latin" }
|
||||
"sk*" { return "Slovak" }
|
||||
"sl*" { return "Slovenian" }
|
||||
{($_ -like "es*") -and ($_ -ne "es-MX")} { return "Spanish" }
|
||||
"es-MX" { return "Spanish (Mexico)" }
|
||||
"sv*" { return "Swedish" }
|
||||
"th*" { return "Thai" }
|
||||
"tr*" { return "Turkish" }
|
||||
"uk*" { return "Ukrainian" }
|
||||
default { return "English" }
|
||||
}
|
||||
}
|
@ -1,21 +0,0 @@
|
||||
function Microwin-GetLocalizedUsers
|
||||
{
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Gets a localized user group representation for ICACLS commands (Port from DISMTools PE Helper)
|
||||
.PARAMETER admins
|
||||
Determines whether to get a localized user group representation for the Administrators user group
|
||||
.OUTPUTS
|
||||
A string containing the localized user group
|
||||
.EXAMPLE
|
||||
Microwin-GetLocalizedUsers -admins $true
|
||||
#>
|
||||
param (
|
||||
[Parameter(Mandatory = $true, Position = 0)] [bool]$admins
|
||||
)
|
||||
if ($admins) {
|
||||
return (Get-LocalGroup | Where-Object { $_.SID.Value -like "S-1-5-32-544" }).Name
|
||||
} else {
|
||||
return (Get-LocalGroup | Where-Object { $_.SID.Value -like "S-1-5-32-545" }).Name
|
||||
}
|
||||
}
|
@ -1,73 +0,0 @@
|
||||
function Microwin-NewCheckInstall {
|
||||
|
||||
# using here string to embedd firstrun
|
||||
$checkInstall = @'
|
||||
@echo off
|
||||
if exist "%HOMEDRIVE%\windows\cpu.txt" (
|
||||
echo %HOMEDRIVE%\windows\cpu.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\windows\cpu.txt does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\windows\SerialNumber.txt" (
|
||||
echo %HOMEDRIVE%\windows\SerialNumber.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\windows\SerialNumber.txt does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\unattend.xml" (
|
||||
echo %HOMEDRIVE%\unattend.xml exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\unattend.xml does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\Setup\Scripts\SetupComplete.cmd" (
|
||||
echo %HOMEDRIVE%\Windows\Setup\Scripts\SetupComplete.cmd exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\Setup\Scripts\SetupComplete.cmd does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\Panther\unattend.xml" (
|
||||
echo %HOMEDRIVE%\Windows\Panther\unattend.xml exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\Panther\unattend.xml does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\System32\Sysprep\unattend.xml" (
|
||||
echo %HOMEDRIVE%\Windows\System32\Sysprep\unattend.xml exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\System32\Sysprep\unattend.xml does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\FirstStartup.ps1" (
|
||||
echo %HOMEDRIVE%\Windows\FirstStartup.ps1 exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\FirstStartup.ps1 does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\winutil.ps1" (
|
||||
echo %HOMEDRIVE%\Windows\winutil.ps1 exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\winutil.ps1 does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\LogSpecialize.txt" (
|
||||
echo %HOMEDRIVE%\Windows\LogSpecialize.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\LogSpecialize.txt does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\LogAuditUser.txt" (
|
||||
echo %HOMEDRIVE%\Windows\LogAuditUser.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\LogAuditUser.txt does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\Windows\LogOobeSystem.txt" (
|
||||
echo %HOMEDRIVE%\Windows\LogOobeSystem.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\Windows\LogOobeSystem.txt does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\windows\csup.txt" (
|
||||
echo %HOMEDRIVE%\windows\csup.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\windows\csup.txt does not exist
|
||||
)
|
||||
if exist "%HOMEDRIVE%\windows\LogFirstRun.txt" (
|
||||
echo %HOMEDRIVE%\windows\LogFirstRun.txt exists
|
||||
) else (
|
||||
echo %HOMEDRIVE%\windows\LogFirstRun.txt does not exist
|
||||
)
|
||||
'@
|
||||
$checkInstall | Out-File -FilePath "$env:temp\checkinstall.cmd" -Force -Encoding Ascii
|
||||
}
|
@ -1,68 +0,0 @@
|
||||
function Microwin-NewFirstRun {
|
||||
|
||||
# using here string to embedd firstrun
|
||||
$firstRun = @'
|
||||
# Set the global error action preference to continue
|
||||
$ErrorActionPreference = "Continue"
|
||||
function Remove-RegistryValue {
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$RegistryPath,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$ValueName
|
||||
)
|
||||
|
||||
# Check if the registry path exists
|
||||
if (Test-Path -Path $RegistryPath) {
|
||||
$registryValue = Get-ItemProperty -Path $RegistryPath -Name $ValueName -ErrorAction SilentlyContinue
|
||||
|
||||
# Check if the registry value exists
|
||||
if ($registryValue) {
|
||||
# Remove the registry value
|
||||
Remove-ItemProperty -Path $RegistryPath -Name $ValueName -Force
|
||||
Write-Host "Registry value '$ValueName' removed from '$RegistryPath'."
|
||||
} else {
|
||||
Write-Host "Registry value '$ValueName' not found in '$RegistryPath'."
|
||||
}
|
||||
} else {
|
||||
Write-Host "Registry path '$RegistryPath' not found."
|
||||
}
|
||||
}
|
||||
|
||||
"FirstStartup has worked" | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber
|
||||
|
||||
$taskbarPath = "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
|
||||
# Delete all files on the Taskbar
|
||||
Get-ChildItem -Path $taskbarPath -File | Remove-Item -Force
|
||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesRemovedChanges"
|
||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesChanges"
|
||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "Favorites"
|
||||
|
||||
# Delete Edge Icon from the desktop
|
||||
$edgeShortcutFiles = Get-ChildItem -Path $desktopPath -Filter "*Edge*.lnk"
|
||||
# Check if Edge shortcuts exist on the desktop
|
||||
if ($edgeShortcutFiles) {
|
||||
foreach ($shortcutFile in $edgeShortcutFiles) {
|
||||
# Remove each Edge shortcut
|
||||
Remove-Item -Path $shortcutFile.FullName -Force
|
||||
Write-Host "Edge shortcut '$($shortcutFile.Name)' removed from the desktop."
|
||||
}
|
||||
}
|
||||
Remove-Item -Path "$env:USERPROFILE\Desktop\*.lnk"
|
||||
Remove-Item -Path "$env:HOMEDRIVE\Users\Default\Desktop\*.lnk"
|
||||
|
||||
try
|
||||
{
|
||||
if ((Get-WindowsOptionalFeature -Online | Where-Object { $_.FeatureName -like "Recall" }).Count -gt 0)
|
||||
{
|
||||
Disable-WindowsOptionalFeature -Online -FeatureName "Recall" -Remove
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
|
||||
}
|
||||
'@
|
||||
$firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force
|
||||
}
|
@ -1,40 +0,0 @@
|
||||
function Microwin-RemoveFeatures() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes certain features from ISO image
|
||||
|
||||
.PARAMETER Name
|
||||
No Params
|
||||
|
||||
.EXAMPLE
|
||||
Microwin-RemoveFeatures
|
||||
#>
|
||||
try {
|
||||
$featlist = (Get-WindowsOptionalFeature -Path $scratchDir)
|
||||
|
||||
$featlist = $featlist | Where-Object {
|
||||
$_.FeatureName -NotLike "*Defender*" -AND
|
||||
$_.FeatureName -NotLike "*Printing*" -AND
|
||||
$_.FeatureName -NotLike "*TelnetClient*" -AND
|
||||
$_.FeatureName -NotLike "*PowerShell*" -AND
|
||||
$_.FeatureName -NotLike "*NetFx*" -AND
|
||||
$_.FeatureName -NotLike "*Media*" -AND
|
||||
$_.FeatureName -NotLike "*NFS*" -AND
|
||||
$_.FeatureName -NotLike "*SearchEngine*" -AND
|
||||
$_.FeatureName -NotLike "*RemoteDesktop*" -AND
|
||||
$_.State -ne "Disabled"
|
||||
}
|
||||
|
||||
foreach($feature in $featlist) {
|
||||
$status = "Removing feature $($feature.FeatureName)"
|
||||
Write-Progress -Activity "Removing features" -Status $status -PercentComplete ($counter++/$featlist.Count*100)
|
||||
Write-Debug "Removing feature $($feature.FeatureName)"
|
||||
Disable-WindowsOptionalFeature -Path "$scratchDir" -FeatureName $($feature.FeatureName) -Remove -ErrorAction SilentlyContinue -NoRestart
|
||||
}
|
||||
Write-Progress -Activity "Removing features" -Status "Ready" -Completed
|
||||
Write-Host "You can re-enable the disabled features at any time, using either Windows Update or the SxS folder in <installation media>\Sources."
|
||||
} catch {
|
||||
Write-Host "Unable to get information about the features. MicroWin processing will continue, but features will not be processed"
|
||||
Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
function Microwin-RemoveFileOrDirectory([string]$pathToDelete, [string]$mask = "", [switch]$Directory = $false) {
|
||||
if(([string]::IsNullOrEmpty($pathToDelete))) { return }
|
||||
if (-not (Test-Path -Path "$($pathToDelete)")) { return }
|
||||
|
||||
$yesNo = Get-LocalizedYesNo
|
||||
Write-Host "[INFO] In Your local takeown expects '$($yesNo[0])' as a Yes answer."
|
||||
|
||||
$itemsToDelete = [System.Collections.ArrayList]::new()
|
||||
|
||||
if ($mask -eq "") {
|
||||
Write-Debug "Adding $($pathToDelete) to array."
|
||||
[void]$itemsToDelete.Add($pathToDelete)
|
||||
} else {
|
||||
Write-Debug "Adding $($pathToDelete) to array and mask is $($mask)"
|
||||
if ($Directory) { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse -Directory } else { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse }
|
||||
}
|
||||
|
||||
foreach($itemToDelete in $itemsToDelete) {
|
||||
$status = "Deleting $($itemToDelete)"
|
||||
Write-Progress -Activity "Removing Items" -Status $status -PercentComplete ($counter++/$itemsToDelete.Count*100)
|
||||
|
||||
if (Test-Path -Path "$($itemToDelete)" -PathType Container) {
|
||||
$status = "Deleting directory: $($itemToDelete)"
|
||||
|
||||
takeown /r /d $yesNo[0] /a /f "$($itemToDelete)"
|
||||
icacls "$($itemToDelete)" /q /c /t /reset
|
||||
icacls $itemToDelete /setowner "*S-1-5-32-544"
|
||||
icacls $itemToDelete /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
|
||||
Remove-Item -Force -Recurse "$($itemToDelete)"
|
||||
}
|
||||
elseif (Test-Path -Path "$($itemToDelete)" -PathType Leaf) {
|
||||
$status = "Deleting file: $($itemToDelete)"
|
||||
|
||||
takeown /a /f "$($itemToDelete)"
|
||||
icacls "$($itemToDelete)" /q /c /t /reset
|
||||
icacls "$($itemToDelete)" /setowner "*S-1-5-32-544"
|
||||
icacls "$($itemToDelete)" /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
|
||||
Remove-Item -Force "$($itemToDelete)"
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Items" -Status "Ready" -Completed
|
||||
}
|
@ -1,96 +0,0 @@
|
||||
function Microwin-RemovePackages {
|
||||
try {
|
||||
$pkglist = (Get-WindowsPackage -Path "$scratchDir").PackageName
|
||||
|
||||
$pkglist = $pkglist | Where-Object {
|
||||
$_ -NotLike "*ApplicationModel*" -AND
|
||||
$_ -NotLike "*indows-Client-LanguagePack*" -AND
|
||||
$_ -NotLike "*LanguageFeatures-Basic*" -AND
|
||||
$_ -NotLike "*Package_for_ServicingStack*" -AND
|
||||
$_ -NotLike "*.NET*" -AND
|
||||
$_ -NotLike "*Store*" -AND
|
||||
$_ -NotLike "*VCLibs*" -AND
|
||||
$_ -NotLike "*AAD.BrokerPlugin",
|
||||
$_ -NotLike "*LockApp*" -AND
|
||||
$_ -NotLike "*Notepad*" -AND
|
||||
$_ -NotLike "*immersivecontrolpanel*" -AND
|
||||
$_ -NotLike "*ContentDeliveryManager*" -AND
|
||||
$_ -NotLike "*PinningConfirMationDialog*" -AND
|
||||
$_ -NotLike "*SecHealthUI*" -AND
|
||||
$_ -NotLike "*SecureAssessmentBrowser*" -AND
|
||||
$_ -NotLike "*PrintDialog*" -AND
|
||||
$_ -NotLike "*AssignedAccessLockApp*" -AND
|
||||
$_ -NotLike "*OOBENetworkConnectionFlow*" -AND
|
||||
$_ -NotLike "*Apprep.ChxApp*" -AND
|
||||
$_ -NotLike "*CBS*" -AND
|
||||
$_ -NotLike "*OOBENetworkCaptivePortal*" -AND
|
||||
$_ -NotLike "*PeopleExperienceHost*" -AND
|
||||
$_ -NotLike "*ParentalControls*" -AND
|
||||
$_ -NotLike "*Win32WebViewHost*" -AND
|
||||
$_ -NotLike "*InputApp*" -AND
|
||||
$_ -NotLike "*DirectPlay*" -AND
|
||||
$_ -NotLike "*AccountsControl*" -AND
|
||||
$_ -NotLike "*AsyncTextService*" -AND
|
||||
$_ -NotLike "*CapturePicker*" -AND
|
||||
$_ -NotLike "*CredDialogHost*" -AND
|
||||
$_ -NotLike "*BioEnrollMent*" -AND
|
||||
$_ -NotLike "*ShellExperienceHost*" -AND
|
||||
$_ -NotLike "*DesktopAppInstaller*" -AND
|
||||
$_ -NotLike "*WebMediaExtensions*" -AND
|
||||
$_ -NotLike "*WMIC*" -AND
|
||||
$_ -NotLike "*UI.XaML*" -AND
|
||||
$_ -NotLike "*Ethernet*" -AND
|
||||
$_ -NotLike "*Wifi*" -AND
|
||||
$_ -NotLike "*FodMetadata*" -AND
|
||||
$_ -NotLike "*Foundation*" -AND
|
||||
$_ -NotLike "*LanguageFeatures*" -AND
|
||||
$_ -NotLike "*VBSCRIPT*" -AND
|
||||
$_ -NotLike "*License*"
|
||||
}
|
||||
|
||||
$failedCount = 0
|
||||
|
||||
$erroredPackages = [System.Collections.Generic.List[ErroredPackage]]::new()
|
||||
|
||||
foreach ($pkg in $pkglist) {
|
||||
try {
|
||||
$status = "Removing $pkg"
|
||||
Write-Progress -Activity "Removing Packages" -Status $status -PercentComplete ($counter++/$pkglist.Count*100)
|
||||
Remove-WindowsPackage -Path "$scratchDir" -PackageName $pkg -NoRestart -ErrorAction SilentlyContinue
|
||||
} catch {
|
||||
# This can happen if the package that is being removed is a permanent one
|
||||
$erroredPackages.Add([ErroredPackage]::new($pkg, $_.Exception.Message))
|
||||
$failedCount += 1
|
||||
continue
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Packages" -Status "Ready" -Completed
|
||||
if ($failedCount -gt 0)
|
||||
{
|
||||
Write-Host "$failedCount package(s) could not be removed. Your image will still work fine, however. Below is information on what packages failed to be removed and why."
|
||||
if ($erroredPackages.Count -gt 0)
|
||||
{
|
||||
$erroredPackages = $erroredPackages | Sort-Object -Property ErrorMessage
|
||||
|
||||
$previousErroredPackage = $erroredPackages[0]
|
||||
$counter = 0
|
||||
Write-Host ""
|
||||
Write-Host "- $($previousErroredPackage.ErrorMessage)"
|
||||
foreach ($erroredPackage in $erroredPackages) {
|
||||
if ($erroredPackage.ErrorMessage -ne $previousErroredPackage.ErrorMessage) {
|
||||
Write-Host ""
|
||||
$counter = 0
|
||||
Write-Host "- $($erroredPackage.ErrorMessage)"
|
||||
}
|
||||
$counter += 1
|
||||
Write-Host " $counter) $($erroredPackage.PackageName)"
|
||||
$previousErroredPackage = $erroredPackage
|
||||
}
|
||||
Write-Host ""
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Unable to get information about the packages. MicroWin processing will continue, but packages will not be processed"
|
||||
Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
@ -1,51 +0,0 @@
|
||||
function Microwin-RemoveProvisionedPackages() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes AppX packages from a Windows image during MicroWin processing
|
||||
|
||||
.PARAMETER Name
|
||||
No Params
|
||||
|
||||
.EXAMPLE
|
||||
Microwin-RemoveProvisionedPackages
|
||||
#>
|
||||
try
|
||||
{
|
||||
$appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object {
|
||||
$_.PackageName -NotLike "*AppInstaller*" -AND
|
||||
$_.PackageName -NotLike "*Store*" -and
|
||||
$_.PackageName -NotLike "*Notepad*" -and
|
||||
$_.PackageName -NotLike "*Printing*" -and
|
||||
$_.PackageName -NotLike "*YourPhone*" -and
|
||||
$_.PackageName -NotLike "*Xbox*" -and
|
||||
$_.PackageName -NotLike "*WindowsTerminal*" -and
|
||||
$_.PackageName -NotLike "*Calculator*" -and
|
||||
$_.PackageName -NotLike "*Photos*" -and
|
||||
$_.PackageName -NotLike "*VCLibs*" -and
|
||||
$_.PackageName -NotLike "*Paint*" -and
|
||||
$_.PackageName -NotLike "*Gaming*" -and
|
||||
$_.PackageName -NotLike "*Extension*" -and
|
||||
$_.PackageName -NotLike "*SecHealthUI*" -and
|
||||
$_.PackageName -NotLike "*ScreenSketch*"
|
||||
}
|
||||
|
||||
$counter = 0
|
||||
foreach ($appx in $appxProvisionedPackages) {
|
||||
$status = "Removing Provisioned $($appx.PackageName)"
|
||||
Write-Progress -Activity "Removing Provisioned Apps" -Status $status -PercentComplete ($counter++/$appxProvisionedPackages.Count*100)
|
||||
try {
|
||||
Remove-AppxProvisionedPackage -Path "$scratchDir" -PackageName $appx.PackageName -ErrorAction SilentlyContinue
|
||||
} catch {
|
||||
Write-Host "Application $($appx.PackageName) could not be removed"
|
||||
continue
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed
|
||||
}
|
||||
catch
|
||||
{
|
||||
# This can happen if getting AppX packages fails
|
||||
Write-Host "Unable to get information about the AppX packages. MicroWin processing will continue, but AppX packages will not be processed"
|
||||
Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
@ -1,26 +0,0 @@
|
||||
function Microwin-TestCompatibleImage() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the version of a Windows image and determines whether or not it is compatible with a specific feature depending on a desired version
|
||||
|
||||
.PARAMETER Name
|
||||
imgVersion - The version of the Windows image
|
||||
desiredVersion - The version to compare the image version with
|
||||
#>
|
||||
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory, position=0)]
|
||||
[string]$imgVersion,
|
||||
|
||||
[Parameter(Mandatory, position=1)]
|
||||
[Version]$desiredVersion
|
||||
)
|
||||
|
||||
try {
|
||||
$version = [Version]$imgVersion
|
||||
return $version -ge $desiredVersion
|
||||
} catch {
|
||||
return $False
|
||||
}
|
||||
}
|
92
functions/private/ConvertTo-Icon.ps1
Normal file
92
functions/private/ConvertTo-Icon.ps1
Normal file
@ -0,0 +1,92 @@
|
||||
function ConvertTo-Icon {
|
||||
<#
|
||||
|
||||
.DESCRIPTION
|
||||
This function will convert BMP, GIF, EXIF, JPG, PNG and TIFF to ICO file
|
||||
|
||||
.PARAMETER bitmapPath
|
||||
The file path to bitmap image to make '.ico' file out of.
|
||||
Supported file types according to Microsoft Documentation is the following:
|
||||
BMP, GIF, EXIF, JPG, PNG and TIFF.
|
||||
|
||||
.PARAMETER iconPath
|
||||
The file path to write the new '.ico' resource.
|
||||
|
||||
.PARAMETER overrideIconFile
|
||||
An optional boolean Parameter that makes the function overrides
|
||||
the Icon File Path if the file exists. Defaults to $true.
|
||||
|
||||
.EXAMPLE
|
||||
try {
|
||||
ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath "$env:TEMP\cttlogo.ico"
|
||||
} catch [System.IO.FileNotFoundException] {
|
||||
# Handle the thrown exception here...
|
||||
}
|
||||
|
||||
This Example makes a '.ico' file at "$env:TEMP\cttlogo.ico" File Path using the bitmap file
|
||||
found in "$env:TEMP\cttlogo.png", the function overrides the '.ico' File if it's found.
|
||||
this function will throw a FileNotFound Exception at the event of not finding the provided bitmap File Path.
|
||||
|
||||
.EXAMPLE
|
||||
try {
|
||||
ConvertTo-Icon "$env:TEMP\cttlogo.png" "$env:TEMP\cttlogo.ico"
|
||||
} catch [System.IO.FileNotFoundException] {
|
||||
# Handle the thrown exception here...
|
||||
}
|
||||
|
||||
This Example is the same as Example 1, but uses Positional Parameters instead.
|
||||
|
||||
.EXAMPLE
|
||||
if (Test-Path "$env:TEMP\cttlogo.png") {
|
||||
ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath "$env:TEMP\cttlogo.ico"
|
||||
}
|
||||
|
||||
This Example is same as Example 1, but checks if the bitmap File exists before calling 'ConvertTo-Icon' Function.
|
||||
This's the recommended way of using this function, as it doesn't require any try-catch blocks.
|
||||
|
||||
.EXAMPLE
|
||||
try {
|
||||
ConvertTo-Icon -bitmapPath "$env:TEMP\cttlogo.png" -iconPath "$env:TEMP\cttlogo.ico" -overrideIconFile $false
|
||||
} catch [System.IO.FileNotFoundException] {
|
||||
# Handle the thrown exception here...
|
||||
}
|
||||
|
||||
This Example make use of '-overrideIconFile' Optional Parameter, the default for this parameter is $true.
|
||||
By doing '-overrideIconFile $false', the 'ConvertTo-Icon' function will raise an exception that needs to be catched throw a 'catch' Code Block,
|
||||
otherwise it'll crash the running PowerShell instance/process.
|
||||
|
||||
#>
|
||||
param(
|
||||
[Parameter(Mandatory, position=0)]
|
||||
[string]$bitmapPath,
|
||||
[Parameter(Mandatory, position=1)]
|
||||
[string]$iconPath,
|
||||
[Parameter(position=2)]
|
||||
[bool]$overrideIconFile = $true
|
||||
)
|
||||
|
||||
Add-Type -AssemblyName System.Drawing
|
||||
|
||||
if (Test-Path $bitmapPath) {
|
||||
if ((Test-Path $iconPath) -AND ($overrideIconFile -eq $false)) {
|
||||
Write-Host "[ConvertTo-Icon] Icon File is found at '$iconPath', and the 'overrideIconFile' Parameter is set to '$overrideIconFile'. Skipping the bitmap to icon convertion..." -ForegroundColor Yellow
|
||||
return
|
||||
}
|
||||
|
||||
# Load bitmap file into memory, and make an Icon version out of it
|
||||
$b = [System.Drawing.Bitmap]::FromFile($bitmapPath)
|
||||
$icon = [System.Drawing.Icon]::FromHandle($b.GetHicon())
|
||||
|
||||
# Create the folder for the new icon file if it doesn't exists
|
||||
$iconFolder = (New-Object System.IO.FileInfo($iconPath)).Directory.FullName
|
||||
[System.IO.Directory]::CreateDirectory($iconFolder) | Out-Null
|
||||
|
||||
# Write the Icon File and do some cleaning-up
|
||||
$file = New-Object System.IO.FileStream($iconPath, 'OpenOrCreate')
|
||||
$icon.Save($file)
|
||||
$file.Close()
|
||||
$icon.Dispose()
|
||||
} else {
|
||||
throw [System.IO.FileNotFoundException] "[ConvertTo-Icon] The provided bitmap File Path is not found at '$bitmapPath'."
|
||||
}
|
||||
}
|
@ -19,10 +19,10 @@ function Copy-Files {
|
||||
try {
|
||||
|
||||
$files = Get-ChildItem -Path $path -Recurse:$recurse
|
||||
Write-Host "Copy $($files.Count) file(s) from $path to $destination"
|
||||
Write-Host "Copy $($files.Count)(s) from $path to $destination"
|
||||
|
||||
foreach ($file in $files) {
|
||||
$status = "Copying file {0} of {1}: {2}" -f $counter, $files.Count, $file.Name
|
||||
$status = "Copy files {0} on {1}: {2}" -f $counter, $files.Count, $file.Name
|
||||
Write-Progress -Activity "Copy Windows files" -Status $status -PercentComplete ($counter++/$files.count*100)
|
||||
$restpath = $file.FullName -Replace $path, ''
|
||||
|
||||
@ -37,11 +37,7 @@ function Copy-Files {
|
||||
}
|
||||
Write-Progress -Activity "Copy Windows files" -Status "Ready" -Completed
|
||||
} catch {
|
||||
Write-Host "Unable to Copy all the files due to an unhandled exception" -ForegroundColor Yellow
|
||||
Write-Host "Error information: $($_.Exception.Message)`n" -ForegroundColor Yellow
|
||||
Write-Host "Additional information:" -ForegroundColor Yellow
|
||||
Write-Host $PSItem.Exception.StackTrace
|
||||
# Write possible suggestions
|
||||
Write-Host "`nIf you are using an antivirus, try configuring exclusions"
|
||||
Write-Warning "Unable to Copy all the files due to unhandled exception"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
}
|
||||
|
@ -1,10 +1,10 @@
|
||||
function Microwin-GetOscdimg {
|
||||
function Get-Oscdimg {
|
||||
<#
|
||||
.DESCRIPTION
|
||||
This function will download oscdimg file from github Release folders and put it into env:temp folder
|
||||
|
||||
.EXAMPLE
|
||||
Microwin-GetOscdimg
|
||||
Get-Oscdimg
|
||||
#>
|
||||
|
||||
param(
|
@ -16,72 +16,136 @@ Function Get-WinUtilToggleStatus {
|
||||
if($ToggleSwitch -eq "WPFToggleDarkMode") {
|
||||
$app = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').AppsUseLightTheme
|
||||
$system = (Get-ItemProperty -path 'HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize').SystemUsesLightTheme
|
||||
return $app -eq 0 -and $system -eq 0
|
||||
if($app -eq 0 -and $system -eq 0) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleBingSearch") {
|
||||
$bingsearch = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Search').BingSearchEnabled
|
||||
return $bingsearch -ne 0
|
||||
if($bingsearch -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleNumLock") {
|
||||
$numlockvalue = (Get-ItemProperty -path 'HKCU:\Control Panel\Keyboard').InitialKeyboardIndicators
|
||||
return $numlockvalue -eq 2
|
||||
if($numlockvalue -eq 2) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleVerboseLogon") {
|
||||
$VerboseStatusvalue = (Get-ItemProperty -path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System').VerboseStatus
|
||||
return $VerboseStatusvalue -eq 1
|
||||
if($VerboseStatusvalue -eq 1) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleShowExt") {
|
||||
$hideextvalue = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').HideFileExt
|
||||
return $hideextvalue -eq 0
|
||||
if($hideextvalue -eq 0) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleSnapWindow") {
|
||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Control Panel\Desktop').WindowArrangementActive
|
||||
return $hidesnap -ne 0
|
||||
if($hidesnap -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleSnapFlyout") {
|
||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').EnableSnapAssistFlyout
|
||||
return $hidesnap -ne 0
|
||||
if($hidesnap -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleSnapSuggestion") {
|
||||
$hidesnap = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').SnapAssist
|
||||
return $hidesnap -ne 0
|
||||
if($hidesnap -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleMouseAcceleration") {
|
||||
$MouseSpeed = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseSpeed
|
||||
$MouseThreshold1 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold1
|
||||
$MouseThreshold2 = (Get-ItemProperty -path 'HKCU:\Control Panel\Mouse').MouseThreshold2
|
||||
|
||||
return $MouseSpeed -eq 1 -and $MouseThreshold1 -eq 6 -and $MouseThreshold2 -eq 10
|
||||
if($MouseSpeed -eq 1 -and $MouseThreshold1 -eq 6 -and $MouseThreshold2 -eq 10) {
|
||||
return $true
|
||||
} else {
|
||||
return $false
|
||||
}
|
||||
}
|
||||
if($ToggleSwitch -eq "WPFToggleTaskbarSearch") {
|
||||
$SearchButton = (Get-ItemProperty -path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Search").SearchboxTaskbarMode
|
||||
return $SearchButton -ne 0
|
||||
if($SearchButton -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if ($ToggleSwitch -eq "WPFToggleStickyKeys") {
|
||||
$StickyKeys = (Get-ItemProperty -path 'HKCU:\Control Panel\Accessibility\StickyKeys').Flags
|
||||
return $StickyKeys -ne 58
|
||||
if($StickyKeys -eq 58) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if ($ToggleSwitch -eq "WPFToggleTaskView") {
|
||||
$TaskView = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').ShowTaskViewButton
|
||||
return $TaskView -ne 0
|
||||
if($TaskView -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
|
||||
if ($ToggleSwitch -eq "WPFToggleHiddenFiles") {
|
||||
$HiddenFiles = (Get-ItemProperty -path 'HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced').Hidden
|
||||
return $HiddenFiles -ne 0
|
||||
if($HiddenFiles -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
|
||||
if ($ToggleSwitch -eq "WPFToggleTaskbarWidgets") {
|
||||
$TaskbarWidgets = (Get-ItemProperty -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskBarDa
|
||||
return $TaskbarWidgets -ne 0
|
||||
if($TaskbarWidgets -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if ($ToggleSwitch -eq "WPFToggleTaskbarAlignment") {
|
||||
$TaskbarAlignment = (Get-ItemProperty -Path "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Advanced").TaskbarAl
|
||||
return $TaskbarAlignment -ne 0
|
||||
if($TaskbarAlignment -eq 0) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
if ($ToggleSwitch -eq "WPFToggleDetailedBSoD") {
|
||||
$DetailedBSoD1 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisplayParameters
|
||||
$DetailedBSoD2 = (Get-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CrashControl').DisableEmoticon
|
||||
return !(($DetailedBSoD1 -eq 0) -or ($DetailedBSoD2 -eq 0) -or !$DetailedBSoD1 -or !$DetailedBSoD2)
|
||||
if (($DetailedBSoD1 -eq 0) -or ($DetailedBSoD2 -eq 0) -or !$DetailedBSoD1 -or !$DetailedBSoD2) {
|
||||
return $false
|
||||
} else {
|
||||
return $true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -13,11 +13,10 @@ function Install-WinUtilChoco {
|
||||
if((Test-WinUtilPackageManager -choco) -eq "installed") {
|
||||
return
|
||||
}
|
||||
# Install logic taken from https://chocolatey.org/install#individual
|
||||
|
||||
Write-Host "Seems Chocolatey is not installed, installing now."
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force;
|
||||
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072;
|
||||
Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
|
||||
Set-ExecutionPolicy Bypass -Scope Process -Force; Invoke-Expression ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1')) -ErrorAction Stop
|
||||
powershell choco feature enable -n allowGlobalConfirmation
|
||||
|
||||
} catch {
|
||||
Write-Host "===========================================" -Foregroundcolor Red
|
||||
|
@ -1,258 +1,102 @@
|
||||
function Install-WinUtilProgramChoco {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Manages the installation or uninstallation of a list of Chocolatey packages.
|
||||
Manages the provided programs using Chocolatey
|
||||
|
||||
.PARAMETER Programs
|
||||
A string array containing the programs to be installed or uninstalled.
|
||||
.PARAMETER ProgramsToInstall
|
||||
A list of programs to manage
|
||||
|
||||
.PARAMETER Action
|
||||
Specifies the action to perform: "Install" or "Uninstall". The default value is "Install".
|
||||
.PARAMETER manage
|
||||
The action to perform on the programs, can be either 'Installing' or 'Uninstalling'
|
||||
|
||||
.DESCRIPTION
|
||||
This function processes a list of programs to be managed using Chocolatey. Depending on the specified action, it either installs or uninstalls each program in the list, updating the taskbar progress accordingly. After all operations are completed, temporary output files are cleaned up.
|
||||
|
||||
.EXAMPLE
|
||||
Install-WinUtilProgramChoco -Programs @("7zip","chrome") -Action "Uninstall"
|
||||
.NOTES
|
||||
The triple quotes are required any time you need a " in a normal script block.
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory, Position=0)]
|
||||
[string[]]$Programs,
|
||||
[PsCustomObject]$ProgramsToInstall,
|
||||
|
||||
[Parameter(Position=1)]
|
||||
[String]$Action = "Install"
|
||||
[String]$manage = "Installing"
|
||||
)
|
||||
|
||||
function Initialize-OutputFile {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Initializes an output file by removing any existing file and creating a new, empty file at the specified path.
|
||||
$x = 0
|
||||
$count = $ProgramsToInstall.Count
|
||||
|
||||
.PARAMETER filePath
|
||||
The full path to the file to be initialized.
|
||||
|
||||
.DESCRIPTION
|
||||
This function ensures that the specified file is reset by removing any existing file at the provided path and then creating a new, empty file. It is useful when preparing a log or output file for subsequent operations.
|
||||
|
||||
.EXAMPLE
|
||||
Initialize-OutputFile -filePath "C:\temp\output.txt"
|
||||
#>
|
||||
|
||||
param ($filePath)
|
||||
Remove-Item -Path $filePath -Force -ErrorAction SilentlyContinue
|
||||
New-Item -ItemType File -Path $filePath | Out-Null
|
||||
}
|
||||
|
||||
function Invoke-ChocoCommand {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Executes a Chocolatey command with the specified arguments and returns the exit code.
|
||||
|
||||
.PARAMETER arguments
|
||||
The arguments to be passed to the Chocolatey command.
|
||||
|
||||
.DESCRIPTION
|
||||
This function runs a specified Chocolatey command by passing the provided arguments to the `choco` executable. It waits for the process to complete and then returns the exit code, allowing the caller to determine success or failure based on the exit code.
|
||||
|
||||
.RETURNS
|
||||
[int]
|
||||
The exit code of the Chocolatey command.
|
||||
|
||||
.EXAMPLE
|
||||
$exitCode = Invoke-ChocoCommand -arguments "install 7zip -y"
|
||||
#>
|
||||
|
||||
param ($arguments)
|
||||
return (Start-Process -FilePath "choco" -ArgumentList $arguments -Wait -PassThru).ExitCode
|
||||
}
|
||||
|
||||
function Test-UpgradeNeeded {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks if an upgrade is needed for a Chocolatey package based on the content of a log file.
|
||||
|
||||
.PARAMETER filePath
|
||||
The path to the log file that contains the output of a Chocolatey install command.
|
||||
|
||||
.DESCRIPTION
|
||||
This function reads the specified log file and checks for keywords that indicate whether an upgrade is needed. It returns a boolean value indicating whether the terms "reinstall" or "already installed" are present, which suggests that the package might need an upgrade.
|
||||
|
||||
.RETURNS
|
||||
[bool]
|
||||
True if the log file indicates that an upgrade is needed; otherwise, false.
|
||||
|
||||
.EXAMPLE
|
||||
$isUpgradeNeeded = Test-UpgradeNeeded -filePath "C:\temp\install-output.txt"
|
||||
#>
|
||||
|
||||
param ($filePath)
|
||||
return Get-Content -Path $filePath | Select-String -Pattern "reinstall|already installed" -Quiet
|
||||
}
|
||||
|
||||
function Update-TaskbarProgress {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Updates the taskbar progress based on the current installation progress.
|
||||
|
||||
.PARAMETER currentIndex
|
||||
The current index of the program being installed or uninstalled.
|
||||
|
||||
.PARAMETER totalPrograms
|
||||
The total number of programs to be installed or uninstalled.
|
||||
|
||||
.DESCRIPTION
|
||||
This function calculates the progress of the installation or uninstallation process and updates the taskbar accordingly. The taskbar is set to "Normal" if all programs have been processed, otherwise, it is set to "Error" as a placeholder.
|
||||
|
||||
.EXAMPLE
|
||||
Update-TaskbarProgress -currentIndex 3 -totalPrograms 10
|
||||
#>
|
||||
|
||||
param (
|
||||
[int]$currentIndex,
|
||||
[int]$totalPrograms
|
||||
)
|
||||
$progressState = if ($currentIndex -eq $totalPrograms) { "Normal" } else { "Error" }
|
||||
$sync.form.Dispatcher.Invoke([action] { Set-WinUtilTaskbaritem -state $progressState -value ($currentIndex / $totalPrograms) })
|
||||
}
|
||||
|
||||
function Install-ChocoPackage {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs a Chocolatey package and optionally upgrades it if needed.
|
||||
|
||||
.PARAMETER Program
|
||||
A string containing the name of the Chocolatey package to be installed.
|
||||
|
||||
.PARAMETER currentIndex
|
||||
The current index of the program in the list of programs to be managed.
|
||||
|
||||
.PARAMETER totalPrograms
|
||||
The total number of programs to be installed.
|
||||
|
||||
.DESCRIPTION
|
||||
This function installs a Chocolatey package by running the `choco install` command. If the installation output indicates that an upgrade might be needed, the function will attempt to upgrade the package. The taskbar progress is updated after each package is processed.
|
||||
|
||||
.EXAMPLE
|
||||
Install-ChocoPackage -Program $Program -currentIndex 0 -totalPrograms 5
|
||||
#>
|
||||
|
||||
param (
|
||||
[string]$Program,
|
||||
[int]$currentIndex,
|
||||
[int]$totalPrograms
|
||||
)
|
||||
|
||||
$installOutputFile = "$env:TEMP\Install-WinUtilProgramChoco.install-command.output.txt"
|
||||
Initialize-OutputFile $installOutputFile
|
||||
|
||||
Write-Host "Starting installation of $Program with Chocolatey."
|
||||
|
||||
try {
|
||||
$installStatusCode = Invoke-ChocoCommand "install $Program -y --log-file $installOutputFile"
|
||||
if ($installStatusCode -eq 0) {
|
||||
|
||||
if (Test-UpgradeNeeded $installOutputFile) {
|
||||
$upgradeStatusCode = Invoke-ChocoCommand "upgrade $Program -y"
|
||||
Write-Host "$Program was" $(if ($upgradeStatusCode -eq 0) { "upgraded successfully." } else { "not upgraded." })
|
||||
}
|
||||
else {
|
||||
Write-Host "$Program installed successfully."
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "Failed to install $Program."
|
||||
}
|
||||
}
|
||||
catch {
|
||||
Write-Host "Failed to install $Program due to an error: $_"
|
||||
}
|
||||
finally {
|
||||
Update-TaskbarProgress $currentIndex $totalPrograms
|
||||
}
|
||||
}
|
||||
|
||||
function Uninstall-ChocoPackage {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Uninstalls a Chocolatey package and any related metapackages.
|
||||
|
||||
.PARAMETER Program
|
||||
A string containing the name of the Chocolatey package to be uninstalled.
|
||||
|
||||
.PARAMETER currentIndex
|
||||
The current index of the program in the list of programs to be managed.
|
||||
|
||||
.PARAMETER totalPrograms
|
||||
The total number of programs to be uninstalled.
|
||||
|
||||
.DESCRIPTION
|
||||
This function uninstalls a Chocolatey package and any related metapackages (e.g., .install or .portable variants). It updates the taskbar progress after processing each package.
|
||||
|
||||
.EXAMPLE
|
||||
Uninstall-ChocoPackage -Program $Program -currentIndex 0 -totalPrograms 5
|
||||
#>
|
||||
|
||||
param (
|
||||
[string]$Program,
|
||||
[int]$currentIndex,
|
||||
[int]$totalPrograms
|
||||
)
|
||||
|
||||
$uninstallOutputFile = "$env:TEMP\Install-WinUtilProgramChoco.uninstall-command.output.txt"
|
||||
Initialize-OutputFile $uninstallOutputFile
|
||||
|
||||
Write-Host "Searching for metapackages of $Program (.install or .portable)"
|
||||
$chocoPackages = ((choco list | Select-String -Pattern "$Program(\.install|\.portable)?").Matches.Value) -join " "
|
||||
if ($chocoPackages) {
|
||||
Write-Host "Starting uninstallation of $chocoPackages with Chocolatey."
|
||||
try {
|
||||
$uninstallStatusCode = Invoke-ChocoCommand "uninstall $chocoPackages -y"
|
||||
Write-Host "$Program" $(if ($uninstallStatusCode -eq 0) { "uninstalled successfully." } else { "failed to uninstall." })
|
||||
}
|
||||
catch {
|
||||
Write-Host "Failed to uninstall $Program due to an error: $_"
|
||||
}
|
||||
finally {
|
||||
Update-TaskbarProgress $currentIndex $totalPrograms
|
||||
}
|
||||
}
|
||||
else {
|
||||
Write-Host "$Program is not installed."
|
||||
}
|
||||
}
|
||||
|
||||
$totalPrograms = $Programs.Count
|
||||
if ($totalPrograms -le 0) {
|
||||
throw "Parameter 'Programs' must have at least one item."
|
||||
# This check isn't really necessary, as there's a couple of checks before this Private Function gets called, but just to make sure ;)
|
||||
if($count -le 0) {
|
||||
throw "Private Function 'Install-WinUtilProgramChoco' expected Parameter 'ProgramsToInstall' to be of size 1 or greater, instead got $count,`nPlease double check your code and re-compile WinUtil."
|
||||
}
|
||||
|
||||
Write-Progress -Activity "$manage Applications" -Status "Starting" -PercentComplete 0
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Configuring Chocolatey packages ---"
|
||||
Write-Host "-- Configuring Chocolatey pacakages ---"
|
||||
Write-Host "==========================================="
|
||||
|
||||
for ($currentIndex = 0; $currentIndex -lt $totalPrograms; $currentIndex++) {
|
||||
$Program = $Programs[$currentIndex]
|
||||
Set-WinUtilProgressBar -label "$Action $($Program)" -percent ($currentIndex / $totalPrograms * 100)
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($currentIndex / $totalPrograms)})
|
||||
|
||||
switch ($Action) {
|
||||
"Install" {
|
||||
Install-ChocoPackage -Program $Program -currentIndex $currentIndex -totalPrograms $totalPrograms
|
||||
}
|
||||
"Uninstall" {
|
||||
Uninstall-ChocoPackage -Program $Program -currentIndex $currentIndex -totalPrograms $totalPrograms
|
||||
}
|
||||
default {
|
||||
throw "Invalid action parameter value: '$Action'."
|
||||
Foreach ($Program in $ProgramsToInstall) {
|
||||
Write-Progress -Activity "$manage Applications" -Status "$manage $($Program.choco) $($x + 1) of $count" -PercentComplete $($x/$count*100)
|
||||
if($manage -eq "Installing") {
|
||||
write-host "Starting install of $($Program.choco) with Chocolatey."
|
||||
try {
|
||||
$tryUpgrade = $false
|
||||
$installOutputFilePath = "$env:TEMP\Install-WinUtilProgramChoco.install-command.output.txt"
|
||||
New-Item -ItemType File -Path $installOutputFilePath
|
||||
$chocoInstallStatus = $(Start-Process -FilePath "choco" -ArgumentList "install $($Program.choco) -y" -Wait -PassThru -RedirectStandardOutput $installOutputFilePath).ExitCode
|
||||
if(($chocoInstallStatus -eq 0) -AND (Test-Path -Path $installOutputFilePath)) {
|
||||
$keywordsFound = Get-Content -Path $installOutputFilePath | Where-Object {$_ -match "reinstall" -OR $_ -match "already installed"}
|
||||
if ($keywordsFound) {
|
||||
$tryUpgrade = $true
|
||||
}
|
||||
}
|
||||
# TODO: Implement the Upgrade part using 'choco upgrade' command, this will make choco consistent with WinGet, as WinGet tries to Upgrade when you use the install command.
|
||||
if ($tryUpgrade) {
|
||||
throw "Automatic Upgrade for Choco isn't implemented yet, a feature to make it consistent with WinGet, the install command using choco simply failed because $($Program.choco) is already installed."
|
||||
}
|
||||
Set-WinUtilProgressBar -label "$($Action)ation done" -percent 100
|
||||
# Cleanup Output Files
|
||||
$outputFiles = @("$env:TEMP\Install-WinUtilProgramChoco.install-command.output.txt", "$env:TEMP\Install-WinUtilProgramChoco.uninstall-command.output.txt")
|
||||
foreach ($filePath in $outputFiles) {
|
||||
Remove-Item -Path $filePath -Force -ErrorAction SilentlyContinue
|
||||
if(($chocoInstallStatus -eq 0) -AND ($tryUpgrade -eq $false)) {
|
||||
Write-Host "$($Program.choco) installed successfully using Chocolatey."
|
||||
$X++
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value ($x/$count) })
|
||||
continue
|
||||
} else {
|
||||
Write-Host "Failed to install $($Program.choco) using Chocolatey, Chocolatey output:`n`n$(Get-Content -Path $installOutputFilePath)."
|
||||
$X++
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -value ($x/$count) })
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Failed to install $($Program.choco) due to an error: $_"
|
||||
$X++
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -value ($x/$count) })
|
||||
}
|
||||
}
|
||||
|
||||
if($manage -eq "Uninstalling") {
|
||||
write-host "Starting uninstall of $($Program.choco) with Chocolatey."
|
||||
try {
|
||||
$uninstallOutputFilePath = "$env:TEMP\Install-WinUtilProgramChoco.uninstall-command.output.txt"
|
||||
New-Item -ItemType File -Path $uninstallOutputFilePath
|
||||
$chocoUninstallStatus = $(Start-Process -FilePath "choco" -ArgumentList "uninstall $($Program.choco) -y" -Wait -PassThru).ExitCode
|
||||
if($chocoUninstallStatus -eq 0) {
|
||||
Write-Host "$($Program.choco) uninstalled successfully using Chocolatey."
|
||||
$x++
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value ($x/$count) })
|
||||
continue
|
||||
} else {
|
||||
Write-Host "Failed to uninstall $($Program.choco) using Chocolatey, Chocolatey output:`n`n$(Get-Content -Path $uninstallOutputFilePath)."
|
||||
$x++
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -value ($x/$count) })
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Failed to uninstall $($Program.choco) due to an error: $_"
|
||||
$x++
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Error" -value ($x/$count) })
|
||||
}
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "$manage Applications" -Status "Finished" -Completed
|
||||
|
||||
# Cleanup leftovers files
|
||||
if(Test-Path -Path $installOutputFilePath) { Remove-Item -Path $installOutputFilePath }
|
||||
if(Test-Path -Path $uninstallOutputFilePath) { Remove-Item -Path $uninstallOutputFilePath }
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -1,199 +0,0 @@
|
||||
function Invoke-WinUtilAssets {
|
||||
param (
|
||||
$type,
|
||||
$Size,
|
||||
[switch]$render
|
||||
)
|
||||
|
||||
# Create the Viewbox and set its size
|
||||
$LogoViewbox = New-Object Windows.Controls.Viewbox
|
||||
$LogoViewbox.Width = $Size
|
||||
$LogoViewbox.Height = $Size
|
||||
|
||||
# Create a Canvas to hold the paths
|
||||
$canvas = New-Object Windows.Controls.Canvas
|
||||
$canvas.Width = 100
|
||||
$canvas.Height = 100
|
||||
|
||||
# Define a scale factor for the content inside the Canvas
|
||||
$scaleFactor = $Size / 100
|
||||
|
||||
# Apply a scale transform to the Canvas content
|
||||
$scaleTransform = New-Object Windows.Media.ScaleTransform($scaleFactor, $scaleFactor)
|
||||
$canvas.LayoutTransform = $scaleTransform
|
||||
|
||||
switch ($type) {
|
||||
'logo' {
|
||||
$LogoPathData1 = @"
|
||||
M 18.00,14.00
|
||||
C 18.00,14.00 45.00,27.74 45.00,27.74
|
||||
45.00,27.74 57.40,34.63 57.40,34.63
|
||||
57.40,34.63 59.00,43.00 59.00,43.00
|
||||
59.00,43.00 59.00,83.00 59.00,83.00
|
||||
55.35,81.66 46.99,77.79 44.72,74.79
|
||||
41.17,70.10 42.01,59.80 42.00,54.00
|
||||
42.00,51.62 42.20,48.29 40.98,46.21
|
||||
38.34,41.74 25.78,38.60 21.28,33.79
|
||||
16.81,29.02 18.00,20.20 18.00,14.00 Z
|
||||
"@
|
||||
$LogoPath1 = New-Object Windows.Shapes.Path
|
||||
$LogoPath1.Data = [Windows.Media.Geometry]::Parse($LogoPathData1)
|
||||
$LogoPath1.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#0567ff")
|
||||
|
||||
$LogoPathData2 = @"
|
||||
M 107.00,14.00
|
||||
C 109.01,19.06 108.93,30.37 104.66,34.21
|
||||
100.47,37.98 86.38,43.10 84.60,47.21
|
||||
83.94,48.74 84.01,51.32 84.00,53.00
|
||||
83.97,57.04 84.46,68.90 83.26,72.00
|
||||
81.06,77.70 72.54,81.42 67.00,83.00
|
||||
67.00,83.00 67.00,43.00 67.00,43.00
|
||||
67.00,43.00 67.99,35.63 67.99,35.63
|
||||
67.99,35.63 80.00,28.26 80.00,28.26
|
||||
80.00,28.26 107.00,14.00 107.00,14.00 Z
|
||||
"@
|
||||
$LogoPath2 = New-Object Windows.Shapes.Path
|
||||
$LogoPath2.Data = [Windows.Media.Geometry]::Parse($LogoPathData2)
|
||||
$LogoPath2.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#0567ff")
|
||||
|
||||
$LogoPathData3 = @"
|
||||
M 19.00,46.00
|
||||
C 21.36,47.14 28.67,50.71 30.01,52.63
|
||||
31.17,54.30 30.99,57.04 31.00,59.00
|
||||
31.04,65.41 30.35,72.16 33.56,78.00
|
||||
38.19,86.45 46.10,89.04 54.00,93.31
|
||||
56.55,94.69 60.10,97.20 63.00,97.22
|
||||
65.50,97.24 68.77,95.36 71.00,94.25
|
||||
76.42,91.55 84.51,87.78 88.82,83.68
|
||||
94.56,78.20 95.96,70.59 96.00,63.00
|
||||
96.01,60.24 95.59,54.63 97.02,52.39
|
||||
98.80,49.60 103.95,47.87 107.00,47.00
|
||||
107.00,47.00 107.00,67.00 107.00,67.00
|
||||
106.90,87.69 96.10,93.85 80.00,103.00
|
||||
76.51,104.98 66.66,110.67 63.00,110.52
|
||||
60.33,110.41 55.55,107.53 53.00,106.25
|
||||
46.21,102.83 36.63,98.57 31.04,93.68
|
||||
16.88,81.28 19.00,62.88 19.00,46.00 Z
|
||||
"@
|
||||
$LogoPath3 = New-Object Windows.Shapes.Path
|
||||
$LogoPath3.Data = [Windows.Media.Geometry]::Parse($LogoPathData3)
|
||||
$LogoPath3.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#a3a4a6")
|
||||
|
||||
$canvas.Children.Add($LogoPath1) | Out-Null
|
||||
$canvas.Children.Add($LogoPath2) | Out-Null
|
||||
$canvas.Children.Add($LogoPath3) | Out-Null
|
||||
}
|
||||
'checkmark' {
|
||||
$canvas.Width = 512
|
||||
$canvas.Height = 512
|
||||
|
||||
$scaleFactor = $Size / 2.54
|
||||
$scaleTransform = New-Object Windows.Media.ScaleTransform($scaleFactor, $scaleFactor)
|
||||
$canvas.LayoutTransform = $scaleTransform
|
||||
|
||||
# Define the circle path
|
||||
$circlePathData = "M 1.27,0 A 1.27,1.27 0 1,0 1.27,2.54 A 1.27,1.27 0 1,0 1.27,0"
|
||||
$circlePath = New-Object Windows.Shapes.Path
|
||||
$circlePath.Data = [Windows.Media.Geometry]::Parse($circlePathData)
|
||||
$circlePath.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#39ba00")
|
||||
|
||||
# Define the checkmark path
|
||||
$checkmarkPathData = "M 0.873 1.89 L 0.41 1.391 A 0.17 0.17 0 0 1 0.418 1.151 A 0.17 0.17 0 0 1 0.658 1.16 L 1.016 1.543 L 1.583 1.013 A 0.17 0.17 0 0 1 1.599 1 L 1.865 0.751 A 0.17 0.17 0 0 1 2.105 0.759 A 0.17 0.17 0 0 1 2.097 0.999 L 1.282 1.759 L 0.999 2.022 L 0.874 1.888 Z"
|
||||
$checkmarkPath = New-Object Windows.Shapes.Path
|
||||
$checkmarkPath.Data = [Windows.Media.Geometry]::Parse($checkmarkPathData)
|
||||
$checkmarkPath.Fill = [Windows.Media.Brushes]::White
|
||||
|
||||
# Add the paths to the Canvas
|
||||
$canvas.Children.Add($circlePath) | Out-Null
|
||||
$canvas.Children.Add($checkmarkPath) | Out-Null
|
||||
}
|
||||
'warning' {
|
||||
$canvas.Width = 512
|
||||
$canvas.Height = 512
|
||||
|
||||
# Define a scale factor for the content inside the Canvas
|
||||
$scaleFactor = $Size / 512 # Adjust scaling based on the canvas size
|
||||
$scaleTransform = New-Object Windows.Media.ScaleTransform($scaleFactor, $scaleFactor)
|
||||
$canvas.LayoutTransform = $scaleTransform
|
||||
|
||||
# Define the circle path
|
||||
$circlePathData = "M 256,0 A 256,256 0 1,0 256,512 A 256,256 0 1,0 256,0"
|
||||
$circlePath = New-Object Windows.Shapes.Path
|
||||
$circlePath.Data = [Windows.Media.Geometry]::Parse($circlePathData)
|
||||
$circlePath.Fill = [System.Windows.Media.BrushConverter]::new().ConvertFromString("#f41b43")
|
||||
|
||||
# Define the exclamation mark path
|
||||
$exclamationPathData = "M 256 307.2 A 35.89 35.89 0 0 1 220.14 272.74 L 215.41 153.3 A 35.89 35.89 0 0 1 251.27 116 H 260.73 A 35.89 35.89 0 0 1 296.59 153.3 L 291.86 272.74 A 35.89 35.89 0 0 1 256 307.2 Z"
|
||||
$exclamationPath = New-Object Windows.Shapes.Path
|
||||
$exclamationPath.Data = [Windows.Media.Geometry]::Parse($exclamationPathData)
|
||||
$exclamationPath.Fill = [Windows.Media.Brushes]::White
|
||||
|
||||
# Get the bounds of the exclamation mark path
|
||||
$exclamationBounds = $exclamationPath.Data.Bounds
|
||||
|
||||
# Calculate the center position for the exclamation mark path
|
||||
$exclamationCenterX = ($canvas.Width - $exclamationBounds.Width) / 2 - $exclamationBounds.X
|
||||
$exclamationPath.SetValue([Windows.Controls.Canvas]::LeftProperty, $exclamationCenterX)
|
||||
|
||||
# Define the rounded rectangle at the bottom (dot of exclamation mark)
|
||||
$roundedRectangle = New-Object Windows.Shapes.Rectangle
|
||||
$roundedRectangle.Width = 80
|
||||
$roundedRectangle.Height = 80
|
||||
$roundedRectangle.RadiusX = 30
|
||||
$roundedRectangle.RadiusY = 30
|
||||
$roundedRectangle.Fill = [Windows.Media.Brushes]::White
|
||||
|
||||
# Calculate the center position for the rounded rectangle
|
||||
$centerX = ($canvas.Width - $roundedRectangle.Width) / 2
|
||||
$roundedRectangle.SetValue([Windows.Controls.Canvas]::LeftProperty, $centerX)
|
||||
$roundedRectangle.SetValue([Windows.Controls.Canvas]::TopProperty, 324.34)
|
||||
|
||||
# Add the paths to the Canvas
|
||||
$canvas.Children.Add($circlePath) | Out-Null
|
||||
$canvas.Children.Add($exclamationPath) | Out-Null
|
||||
$canvas.Children.Add($roundedRectangle) | Out-Null
|
||||
}
|
||||
default {
|
||||
Write-Host "Invalid type: $type"
|
||||
}
|
||||
}
|
||||
|
||||
# Add the Canvas to the Viewbox
|
||||
$LogoViewbox.Child = $canvas
|
||||
|
||||
if ($render) {
|
||||
# Measure and arrange the canvas to ensure proper rendering
|
||||
$canvas.Measure([Windows.Size]::new($canvas.Width, $canvas.Height))
|
||||
$canvas.Arrange([Windows.Rect]::new(0, 0, $canvas.Width, $canvas.Height))
|
||||
$canvas.UpdateLayout()
|
||||
|
||||
# Initialize RenderTargetBitmap correctly with dimensions
|
||||
$renderTargetBitmap = New-Object Windows.Media.Imaging.RenderTargetBitmap($canvas.Width, $canvas.Height, 96, 96, [Windows.Media.PixelFormats]::Pbgra32)
|
||||
|
||||
# Render the canvas to the bitmap
|
||||
$renderTargetBitmap.Render($canvas)
|
||||
|
||||
# Create a BitmapFrame from the RenderTargetBitmap
|
||||
$bitmapFrame = [Windows.Media.Imaging.BitmapFrame]::Create($renderTargetBitmap)
|
||||
|
||||
# Create a PngBitmapEncoder and add the frame
|
||||
$bitmapEncoder = [Windows.Media.Imaging.PngBitmapEncoder]::new()
|
||||
$bitmapEncoder.Frames.Add($bitmapFrame)
|
||||
|
||||
# Save to a memory stream
|
||||
$imageStream = New-Object System.IO.MemoryStream
|
||||
$bitmapEncoder.Save($imageStream)
|
||||
$imageStream.Position = 0
|
||||
|
||||
# Load the stream into a BitmapImage
|
||||
$bitmapImage = [Windows.Media.Imaging.BitmapImage]::new()
|
||||
$bitmapImage.BeginInit()
|
||||
$bitmapImage.StreamSource = $imageStream
|
||||
$bitmapImage.CacheOption = [Windows.Media.Imaging.BitmapCacheOption]::OnLoad
|
||||
$bitmapImage.EndInit()
|
||||
|
||||
return $bitmapImage
|
||||
} else {
|
||||
return $LogoViewbox
|
||||
}
|
||||
}
|
@ -13,16 +13,6 @@ Function Invoke-WinUtilCurrentSystem {
|
||||
param(
|
||||
$CheckBox
|
||||
)
|
||||
if ($CheckBox -eq "choco") {
|
||||
$apps = (choco list | Select-String -Pattern "^\S+").Matches.Value
|
||||
$filter = Get-WinUtilVariables -Type Checkbox | Where-Object {$psitem -like "WPFInstall*"}
|
||||
$sync.GetEnumerator() | Where-Object {$psitem.Key -in $filter} | ForEach-Object {
|
||||
$dependencies = @($sync.configs.applications.$($psitem.Key).choco -split ";")
|
||||
if ($dependencies -in $apps) {
|
||||
Write-Output $psitem.name
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ($checkbox -eq "winget") {
|
||||
|
||||
|
@ -21,11 +21,6 @@ Function Invoke-WinUtilDarkMode {
|
||||
$Path = "HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize"
|
||||
Set-ItemProperty -Path $Path -Name AppsUseLightTheme -Value $DarkMoveValue
|
||||
Set-ItemProperty -Path $Path -Name SystemUsesLightTheme -Value $DarkMoveValue
|
||||
Invoke-WinUtilExplorerRefresh
|
||||
# Update Winutil Theme if the Theme Button shows the Icon for Auto
|
||||
if ($sync.ThemeButton.Content -eq [char]0xF08C) {
|
||||
Invoke-WinutilThemeChange -theme "Auto"
|
||||
}
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
|
@ -1,33 +0,0 @@
|
||||
function Invoke-WinUtilExplorerRefresh {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Refreshes the Windows Explorer
|
||||
#>
|
||||
|
||||
Invoke-WPFRunspace -DebugPreference $DebugPreference -ScriptBlock {
|
||||
# Send the WM_SETTINGCHANGE message to all windows
|
||||
Add-Type -TypeDefinition @"
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
public class Win32 {
|
||||
[DllImport("user32.dll", CharSet = CharSet.Auto, SetLastError = false)]
|
||||
public static extern IntPtr SendMessageTimeout(
|
||||
IntPtr hWnd,
|
||||
uint Msg,
|
||||
IntPtr wParam,
|
||||
string lParam,
|
||||
uint fuFlags,
|
||||
uint uTimeout,
|
||||
out IntPtr lpdwResult);
|
||||
}
|
||||
"@
|
||||
|
||||
$HWND_BROADCAST = [IntPtr]0xffff
|
||||
$WM_SETTINGCHANGE = 0x1A
|
||||
$SMTO_ABORTIFHUNG = 0x2
|
||||
$timeout = 100
|
||||
|
||||
# Send the broadcast message to all windows
|
||||
[Win32]::SendMessageTimeout($HWND_BROADCAST, $WM_SETTINGCHANGE, [IntPtr]::Zero, "ImmersiveColorSet", $SMTO_ABORTIFHUNG, $timeout, [ref]([IntPtr]::Zero))
|
||||
}
|
||||
}
|
@ -7,9 +7,7 @@ function Invoke-WinUtilGPU {
|
||||
"*NVIDIA GeForce*Laptop*",
|
||||
"*NVIDIA GeForce*GT*",
|
||||
"*AMD Radeon(TM)*",
|
||||
"*Intel(R) HD Graphics*",
|
||||
"*UHD*"
|
||||
|
||||
)
|
||||
|
||||
foreach ($gpu in $gpuInfo) {
|
||||
|
@ -1,103 +0,0 @@
|
||||
function Invoke-WinUtilInstallPSProfile {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Backs up your original profile then installs and applies the CTT PowerShell profile.
|
||||
#>
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PROFILE -DebugPreference $DebugPreference -ScriptBlock {
|
||||
# Remap the automatic built-in $PROFILE variable to the parameter named $PSProfile.
|
||||
param ($PSProfile)
|
||||
|
||||
function Invoke-PSSetup {
|
||||
# Define the URL used to download Chris Titus Tech's PowerShell profile.
|
||||
$url = "https://raw.githubusercontent.com/ChrisTitusTech/powershell-profile/main/Microsoft.PowerShell_profile.ps1"
|
||||
|
||||
# Get the file hash for the user's current PowerShell profile.
|
||||
$OldHash = Get-FileHash $PSProfile -ErrorAction SilentlyContinue
|
||||
|
||||
# Download Chris Titus Tech's PowerShell profile to the 'TEMP' folder.
|
||||
Invoke-RestMethod $url -OutFile "$env:TEMP/Microsoft.PowerShell_profile.ps1"
|
||||
|
||||
# Get the file hash for Chris Titus Tech's PowerShell profile.
|
||||
$NewHash = Get-FileHash "$env:TEMP/Microsoft.PowerShell_profile.ps1"
|
||||
|
||||
# Store the file hash of Chris Titus Tech's PowerShell profile.
|
||||
if (!(Test-Path "$PSProfile.hash")) {
|
||||
$NewHash.Hash | Out-File "$PSProfile.hash"
|
||||
}
|
||||
|
||||
# Check if the new profile's hash doesn't match the old profile's hash.
|
||||
if ($NewHash.Hash -ne $OldHash.Hash) {
|
||||
# Check if oldprofile.ps1 exists and use it as a profile backup source.
|
||||
if (Test-Path "$env:USERPROFILE\oldprofile.ps1") {
|
||||
Write-Host "===> Backup File Exists... <===" -ForegroundColor Yellow
|
||||
Write-Host "===> Moving Backup File... <===" -ForegroundColor Yellow
|
||||
Copy-Item "$env:USERPROFILE\oldprofile.ps1" "$PSProfile.bak"
|
||||
Write-Host "===> Profile Backup: Done. <===" -ForegroundColor Yellow
|
||||
} else {
|
||||
# If oldprofile.ps1 does not exist use $PSProfile as a profile backup source.
|
||||
# Check if the profile backup file has not already been created on the disk.
|
||||
if ((Test-Path $PSProfile) -and (-not (Test-Path "$PSProfile.bak"))) {
|
||||
# Let the user know their PowerShell profile is being backed up.
|
||||
Write-Host "===> Backing Up Profile... <===" -ForegroundColor Yellow
|
||||
|
||||
# Copy the user's current PowerShell profile to the backup file path.
|
||||
Copy-Item -Path $PSProfile -Destination "$PSProfile.bak"
|
||||
|
||||
# Let the user know the profile backup has been completed successfully.
|
||||
Write-Host "===> Profile Backup: Done. <===" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# Let the user know Chris Titus Tech's PowerShell profile is being installed.
|
||||
Write-Host "===> Installing Profile... <===" -ForegroundColor Yellow
|
||||
|
||||
# Start a new hidden PowerShell instance because setup.ps1 does not work in runspaces.
|
||||
Start-Process -FilePath "pwsh" -ArgumentList "-ExecutionPolicy Bypass -NoProfile -Command `"Invoke-Expression (Invoke-WebRequest `'https://github.com/ChrisTitusTech/powershell-profile/raw/main/setup.ps1`')`"" -WindowStyle Hidden -Wait
|
||||
|
||||
# Let the user know Chris Titus Tech's PowerShell profile has been installed successfully.
|
||||
Write-Host "Profile has been installed. Please restart your shell to reflect the changes!" -ForegroundColor Magenta
|
||||
|
||||
# Let the user know Chris Titus Tech's PowerShell profile has been setup successfully.
|
||||
Write-Host "===> Finished Profile Setup <===" -ForegroundColor Yellow
|
||||
} else {
|
||||
# Let the user know Chris Titus Tech's PowerShell profile is already fully up-to-date.
|
||||
Write-Host "Profile is up to date" -ForegroundColor Magenta
|
||||
}
|
||||
}
|
||||
|
||||
# Check if PowerShell Core is currently installed as a program and is available as a command.
|
||||
if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
|
||||
# Check if the version of PowerShell Core currently in use is version 7 or higher.
|
||||
if ($PSVersionTable.PSVersion.Major -ge 7) {
|
||||
# Invoke the PowerShell Profile setup script to install Chris Titus Tech's PowerShell Profile.
|
||||
Invoke-PSSetup
|
||||
} else {
|
||||
# Let the user know that PowerShell 7 is installed but is not currently in use.
|
||||
Write-Host "This profile requires Powershell 7, which is currently installed but not used!" -ForegroundColor Red
|
||||
|
||||
# Load the necessary .NET library required to use Windows Forms to show dialog boxes.
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
|
||||
# Display the message box asking if the user wants to install PowerShell 7 or not.
|
||||
$question = [System.Windows.Forms.MessageBox]::Show(
|
||||
"Profile requires Powershell 7, which is currently installed but not used! Do you want to install the profile for Powershell 7?",
|
||||
"Question",
|
||||
[System.Windows.Forms.MessageBoxButtons]::YesNo,
|
||||
[System.Windows.Forms.MessageBoxIcon]::Question
|
||||
)
|
||||
|
||||
# Proceed with the installation and setup of the profile as the user pressed the 'Yes' button.
|
||||
if ($question -eq [System.Windows.Forms.DialogResult]::Yes) {
|
||||
Invoke-PSSetup
|
||||
} else {
|
||||
# Let the user know the setup of the profile will not proceed as they pressed the 'No' button.
|
||||
Write-Host "Not proceeding with the profile setup!" -ForegroundColor Magenta
|
||||
}
|
||||
}
|
||||
} else {
|
||||
# Let the user know that the profile requires PowerShell Core but it is not currently installed.
|
||||
Write-Host "This profile requires Powershell Core, which is currently not installed!" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,251 @@
|
||||
function Microwin-NewUnattend {
|
||||
function Test-CompatibleImage() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Checks the version of a Windows image and determines whether or not it is compatible with a specific feature depending on a desired version
|
||||
|
||||
.PARAMETER Name
|
||||
imgVersion - The version of the Windows image
|
||||
desiredVersion - The version to compare the image version with
|
||||
#>
|
||||
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory, position=0)]
|
||||
[string]$imgVersion,
|
||||
|
||||
[Parameter(Mandatory, position=1)]
|
||||
[Version]$desiredVersion
|
||||
)
|
||||
|
||||
try {
|
||||
$version = [Version]$imgVersion
|
||||
return $version -ge $desiredVersion
|
||||
} catch {
|
||||
return $False
|
||||
}
|
||||
}
|
||||
|
||||
function Remove-Features() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes certain features from ISO image
|
||||
|
||||
.PARAMETER Name
|
||||
No Params
|
||||
|
||||
.EXAMPLE
|
||||
Remove-Features
|
||||
#>
|
||||
try {
|
||||
$featlist = (Get-WindowsOptionalFeature -Path $scratchDir).FeatureName
|
||||
|
||||
$featlist = $featlist | Where-Object {
|
||||
$_ -NotLike "*Defender*" -AND
|
||||
$_ -NotLike "*Printing*" -AND
|
||||
$_ -NotLike "*TelnetClient*" -AND
|
||||
$_ -NotLike "*PowerShell*" -AND
|
||||
$_ -NotLike "*NetFx*" -AND
|
||||
$_ -NotLike "*Media*" -AND
|
||||
$_ -NotLike "*NFS*"
|
||||
}
|
||||
|
||||
foreach($feature in $featlist) {
|
||||
$status = "Removing feature $feature"
|
||||
Write-Progress -Activity "Removing features" -Status $status -PercentComplete ($counter++/$featlist.Count*100)
|
||||
Write-Debug "Removing feature $feature"
|
||||
Disable-WindowsOptionalFeature -Path "$scratchDir" -FeatureName $feature -Remove -ErrorAction SilentlyContinue -NoRestart
|
||||
}
|
||||
Write-Progress -Activity "Removing features" -Status "Ready" -Completed
|
||||
Write-Host "You can re-enable the disabled features at any time, using either Windows Update or the SxS folder in <installation media>\Sources."
|
||||
} catch {
|
||||
Write-Host "Unable to get information about the features. MicroWin processing will continue, but features will not be processed"
|
||||
}
|
||||
}
|
||||
|
||||
function Remove-Packages {
|
||||
try {
|
||||
$pkglist = (Get-WindowsPackage -Path "$scratchDir").PackageName
|
||||
|
||||
$pkglist = $pkglist | Where-Object {
|
||||
$_ -NotLike "*ApplicationModel*" -AND
|
||||
$_ -NotLike "*indows-Client-LanguagePack*" -AND
|
||||
$_ -NotLike "*LanguageFeatures-Basic*" -AND
|
||||
$_ -NotLike "*Package_for_ServicingStack*" -AND
|
||||
$_ -NotLike "*.NET*" -AND
|
||||
$_ -NotLike "*Store*" -AND
|
||||
$_ -NotLike "*VCLibs*" -AND
|
||||
$_ -NotLike "*AAD.BrokerPlugin",
|
||||
$_ -NotLike "*LockApp*" -AND
|
||||
$_ -NotLike "*Notepad*" -AND
|
||||
$_ -NotLike "*immersivecontrolpanel*" -AND
|
||||
$_ -NotLike "*ContentDeliveryManager*" -AND
|
||||
$_ -NotLike "*PinningConfirMationDialog*" -AND
|
||||
$_ -NotLike "*SecHealthUI*" -AND
|
||||
$_ -NotLike "*SecureAssessmentBrowser*" -AND
|
||||
$_ -NotLike "*PrintDialog*" -AND
|
||||
$_ -NotLike "*AssignedAccessLockApp*" -AND
|
||||
$_ -NotLike "*OOBENetworkConnectionFlow*" -AND
|
||||
$_ -NotLike "*Apprep.ChxApp*" -AND
|
||||
$_ -NotLike "*CBS*" -AND
|
||||
$_ -NotLike "*OOBENetworkCaptivePortal*" -AND
|
||||
$_ -NotLike "*PeopleExperienceHost*" -AND
|
||||
$_ -NotLike "*ParentalControls*" -AND
|
||||
$_ -NotLike "*Win32WebViewHost*" -AND
|
||||
$_ -NotLike "*InputApp*" -AND
|
||||
$_ -NotLike "*AccountsControl*" -AND
|
||||
$_ -NotLike "*AsyncTextService*" -AND
|
||||
$_ -NotLike "*CapturePicker*" -AND
|
||||
$_ -NotLike "*CredDialogHost*" -AND
|
||||
$_ -NotLike "*BioEnrollMent*" -AND
|
||||
$_ -NotLike "*ShellExperienceHost*" -AND
|
||||
$_ -NotLike "*DesktopAppInstaller*" -AND
|
||||
$_ -NotLike "*WebMediaExtensions*" -AND
|
||||
$_ -NotLike "*WMIC*" -AND
|
||||
$_ -NotLike "*UI.XaML*" -AND
|
||||
$_ -NotLike "*Ethernet*" -AND
|
||||
$_ -NotLike "*Wifi*"
|
||||
}
|
||||
|
||||
foreach ($pkg in $pkglist) {
|
||||
try {
|
||||
$status = "Removing $pkg"
|
||||
Write-Progress -Activity "Removing Apps" -Status $status -PercentComplete ($counter++/$pkglist.Count*100)
|
||||
Remove-WindowsPackage -Path "$scratchDir" -PackageName $pkg -NoRestart -ErrorAction SilentlyContinue
|
||||
} catch {
|
||||
# This can happen if the package that is being removed is a permanent one, like FodMetadata
|
||||
Write-Host "Could not remove OS package $($pkg)"
|
||||
continue
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Apps" -Status "Ready" -Completed
|
||||
} catch {
|
||||
Write-Host "Unable to get information about the packages. MicroWin processing will continue, but packages will not be processed"
|
||||
}
|
||||
}
|
||||
|
||||
function Remove-ProvisionedPackages() {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Removes AppX packages from a Windows image during MicroWin processing
|
||||
|
||||
.PARAMETER Name
|
||||
No Params
|
||||
|
||||
.EXAMPLE
|
||||
Remove-ProvisionedPackages
|
||||
#>
|
||||
try
|
||||
{
|
||||
$appxProvisionedPackages = Get-AppxProvisionedPackage -Path "$($scratchDir)" | Where-Object {
|
||||
$_.PackageName -NotLike "*AppInstaller*" -AND
|
||||
$_.PackageName -NotLike "*Store*" -and
|
||||
$_.PackageName -NotLike "*dism*" -and
|
||||
$_.PackageName -NotLike "*Foundation*" -and
|
||||
$_.PackageName -NotLike "*FodMetadata*" -and
|
||||
$_.PackageName -NotLike "*LanguageFeatures*" -and
|
||||
$_.PackageName -NotLike "*Notepad*" -and
|
||||
$_.PackageName -NotLike "*Printing*" -and
|
||||
$_.PackageName -NotLike "*Foundation*" -and
|
||||
$_.PackageName -NotLike "*YourPhone*" -and
|
||||
$_.PackageName -NotLike "*Xbox*" -and
|
||||
$_.PackageName -NotLike "*WindowsTerminal*" -and
|
||||
$_.PackageName -NotLike "*Calculator*" -and
|
||||
$_.PackageName -NotLike "*Photos*" -and
|
||||
$_.PackageName -NotLike "*VCLibs*" -and
|
||||
$_.PackageName -NotLike "*Paint*" -and
|
||||
$_.PackageName -NotLike "*Gaming*" -and
|
||||
$_.PackageName -NotLike "*Extension*" -and
|
||||
$_.PackageName -NotLike "*SecHealthUI*"
|
||||
}
|
||||
|
||||
$counter = 0
|
||||
foreach ($appx in $appxProvisionedPackages) {
|
||||
$status = "Removing Provisioned $($appx.PackageName)"
|
||||
Write-Progress -Activity "Removing Provisioned Apps" -Status $status -PercentComplete ($counter++/$appxProvisionedPackages.Count*100)
|
||||
try {
|
||||
Remove-AppxProvisionedPackage -Path "$scratchDir" -PackageName $appx.PackageName -ErrorAction SilentlyContinue
|
||||
} catch {
|
||||
Write-Host "Application $($appx.PackageName) could not be removed"
|
||||
continue
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Provisioned Apps" -Status "Ready" -Completed
|
||||
}
|
||||
catch
|
||||
{
|
||||
# This can happen if getting AppX packages fails
|
||||
Write-Host "Unable to get information about the AppX packages. MicroWin processing will continue, but AppX packages will not be processed"
|
||||
}
|
||||
}
|
||||
|
||||
function Copy-ToUSB([string]$fileToCopy) {
|
||||
foreach ($volume in Get-Volume) {
|
||||
if ($volume -and $volume.FileSystemLabel -ieq "ventoy") {
|
||||
$destinationPath = "$($volume.DriveLetter):\"
|
||||
#Copy-Item -Path $fileToCopy -Destination $destinationPath -Force
|
||||
# Get the total size of the file
|
||||
$totalSize = (Get-Item "$fileToCopy").length
|
||||
|
||||
Copy-Item -Path "$fileToCopy" -Destination "$destinationPath" -Verbose -Force -Recurse -Container -PassThru |
|
||||
ForEach-Object {
|
||||
# Calculate the percentage completed
|
||||
$completed = ($_.BytesTransferred / $totalSize) * 100
|
||||
|
||||
# Display the progress bar
|
||||
Write-Progress -Activity "Copying File" -Status "Progress" -PercentComplete $completed -CurrentOperation ("{0:N2} MB / {1:N2} MB" -f ($_.BytesTransferred / 1MB), ($totalSize / 1MB))
|
||||
}
|
||||
|
||||
Write-Host "File copied to Ventoy drive $($volume.DriveLetter)"
|
||||
return
|
||||
}
|
||||
}
|
||||
Write-Host "Ventoy USB Key is not inserted"
|
||||
}
|
||||
|
||||
function Remove-FileOrDirectory([string]$pathToDelete, [string]$mask = "", [switch]$Directory = $false) {
|
||||
if(([string]::IsNullOrEmpty($pathToDelete))) { return }
|
||||
if (-not (Test-Path -Path "$($pathToDelete)")) { return }
|
||||
|
||||
$yesNo = Get-LocalizedYesNo
|
||||
Write-Host "[INFO] In Your local takeown expects '$($yesNo[0])' as a Yes answer."
|
||||
|
||||
$itemsToDelete = [System.Collections.ArrayList]::new()
|
||||
|
||||
if ($mask -eq "") {
|
||||
Write-Debug "Adding $($pathToDelete) to array."
|
||||
[void]$itemsToDelete.Add($pathToDelete)
|
||||
} else {
|
||||
Write-Debug "Adding $($pathToDelete) to array and mask is $($mask)"
|
||||
if ($Directory) { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse -Directory } else { $itemsToDelete = Get-ChildItem $pathToDelete -Include $mask -Recurse }
|
||||
}
|
||||
|
||||
foreach($itemToDelete in $itemsToDelete) {
|
||||
$status = "Deleting $($itemToDelete)"
|
||||
Write-Progress -Activity "Removing Items" -Status $status -PercentComplete ($counter++/$itemsToDelete.Count*100)
|
||||
|
||||
if (Test-Path -Path "$($itemToDelete)" -PathType Container) {
|
||||
$status = "Deleting directory: $($itemToDelete)"
|
||||
|
||||
takeown /r /d $yesNo[0] /a /f "$($itemToDelete)"
|
||||
icacls "$($itemToDelete)" /q /c /t /reset
|
||||
icacls $itemToDelete /setowner "*S-1-5-32-544"
|
||||
icacls $itemToDelete /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
|
||||
Remove-Item -Force -Recurse "$($itemToDelete)"
|
||||
}
|
||||
elseif (Test-Path -Path "$($itemToDelete)" -PathType Leaf) {
|
||||
$status = "Deleting file: $($itemToDelete)"
|
||||
|
||||
takeown /a /f "$($itemToDelete)"
|
||||
icacls "$($itemToDelete)" /q /c /t /reset
|
||||
icacls "$($itemToDelete)" /setowner "*S-1-5-32-544"
|
||||
icacls "$($itemToDelete)" /grant "*S-1-5-32-544:(OI)(CI)F" /t /c /q
|
||||
Remove-Item -Force "$($itemToDelete)"
|
||||
}
|
||||
}
|
||||
Write-Progress -Activity "Removing Items" -Status "Ready" -Completed
|
||||
}
|
||||
|
||||
function New-Unattend {
|
||||
|
||||
param (
|
||||
[Parameter(Mandatory, Position = 0)] [string] $userName,
|
||||
@ -160,7 +407,7 @@ function Microwin-NewUnattend {
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>19</Order>
|
||||
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\Microwin-RemovePackages.ps1' -Raw | Invoke-Expression;"</Path>
|
||||
<Path>powershell.exe -NoProfile -Command "Get-Content -LiteralPath 'C:\Windows\Temp\remove-packages.ps1' -Raw | Invoke-Expression;"</Path>
|
||||
</RunSynchronousCommand>
|
||||
<RunSynchronousCommand wcm:action="add">
|
||||
<Order>20</Order>
|
||||
@ -294,7 +541,7 @@ function Microwin-NewUnattend {
|
||||
</component>
|
||||
</settings>
|
||||
'@
|
||||
if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,22000,1))) -eq $false) {
|
||||
if ((Test-CompatibleImage $imgVersion $([System.Version]::new(10,0,22000,1))) -eq $false) {
|
||||
# Replace the placeholder text with an empty string to make it valid for Windows 10 Setup
|
||||
$unattend = $unattend.Replace("<#REPLACEME#>", "").Trim()
|
||||
} else {
|
||||
@ -308,3 +555,172 @@ function Microwin-NewUnattend {
|
||||
# Save unattended answer file with UTF-8 encoding
|
||||
$unattend | Out-File -FilePath "$env:temp\unattend.xml" -Force -Encoding utf8
|
||||
}
|
||||
|
||||
function New-CheckInstall {
|
||||
|
||||
# using here string to embedd firstrun
|
||||
$checkInstall = @'
|
||||
@echo off
|
||||
if exist "C:\windows\cpu.txt" (
|
||||
echo C:\windows\cpu.txt exists
|
||||
) else (
|
||||
echo C:\windows\cpu.txt does not exist
|
||||
)
|
||||
if exist "C:\windows\SerialNumber.txt" (
|
||||
echo C:\windows\SerialNumber.txt exists
|
||||
) else (
|
||||
echo C:\windows\SerialNumber.txt does not exist
|
||||
)
|
||||
if exist "C:\unattend.xml" (
|
||||
echo C:\unattend.xml exists
|
||||
) else (
|
||||
echo C:\unattend.xml does not exist
|
||||
)
|
||||
if exist "C:\Windows\Setup\Scripts\SetupComplete.cmd" (
|
||||
echo C:\Windows\Setup\Scripts\SetupComplete.cmd exists
|
||||
) else (
|
||||
echo C:\Windows\Setup\Scripts\SetupComplete.cmd does not exist
|
||||
)
|
||||
if exist "C:\Windows\Panther\unattend.xml" (
|
||||
echo C:\Windows\Panther\unattend.xml exists
|
||||
) else (
|
||||
echo C:\Windows\Panther\unattend.xml does not exist
|
||||
)
|
||||
if exist "C:\Windows\System32\Sysprep\unattend.xml" (
|
||||
echo C:\Windows\System32\Sysprep\unattend.xml exists
|
||||
) else (
|
||||
echo C:\Windows\System32\Sysprep\unattend.xml does not exist
|
||||
)
|
||||
if exist "C:\Windows\FirstStartup.ps1" (
|
||||
echo C:\Windows\FirstStartup.ps1 exists
|
||||
) else (
|
||||
echo C:\Windows\FirstStartup.ps1 does not exist
|
||||
)
|
||||
if exist "C:\Windows\winutil.ps1" (
|
||||
echo C:\Windows\winutil.ps1 exists
|
||||
) else (
|
||||
echo C:\Windows\winutil.ps1 does not exist
|
||||
)
|
||||
if exist "C:\Windows\LogSpecialize.txt" (
|
||||
echo C:\Windows\LogSpecialize.txt exists
|
||||
) else (
|
||||
echo C:\Windows\LogSpecialize.txt does not exist
|
||||
)
|
||||
if exist "C:\Windows\LogAuditUser.txt" (
|
||||
echo C:\Windows\LogAuditUser.txt exists
|
||||
) else (
|
||||
echo C:\Windows\LogAuditUser.txt does not exist
|
||||
)
|
||||
if exist "C:\Windows\LogOobeSystem.txt" (
|
||||
echo C:\Windows\LogOobeSystem.txt exists
|
||||
) else (
|
||||
echo C:\Windows\LogOobeSystem.txt does not exist
|
||||
)
|
||||
if exist "c:\windows\csup.txt" (
|
||||
echo c:\windows\csup.txt exists
|
||||
) else (
|
||||
echo c:\windows\csup.txt does not exist
|
||||
)
|
||||
if exist "c:\windows\LogFirstRun.txt" (
|
||||
echo c:\windows\LogFirstRun.txt exists
|
||||
) else (
|
||||
echo c:\windows\LogFirstRun.txt does not exist
|
||||
)
|
||||
'@
|
||||
$checkInstall | Out-File -FilePath "$env:temp\checkinstall.cmd" -Force -Encoding Ascii
|
||||
}
|
||||
|
||||
function New-FirstRun {
|
||||
|
||||
# using here string to embedd firstrun
|
||||
$firstRun = @'
|
||||
# Set the global error action preference to continue
|
||||
$ErrorActionPreference = "Continue"
|
||||
function Remove-RegistryValue {
|
||||
param (
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$RegistryPath,
|
||||
|
||||
[Parameter(Mandatory = $true)]
|
||||
[string]$ValueName
|
||||
)
|
||||
|
||||
# Check if the registry path exists
|
||||
if (Test-Path -Path $RegistryPath) {
|
||||
$registryValue = Get-ItemProperty -Path $RegistryPath -Name $ValueName -ErrorAction SilentlyContinue
|
||||
|
||||
# Check if the registry value exists
|
||||
if ($registryValue) {
|
||||
# Remove the registry value
|
||||
Remove-ItemProperty -Path $RegistryPath -Name $ValueName -Force
|
||||
Write-Host "Registry value '$ValueName' removed from '$RegistryPath'."
|
||||
} else {
|
||||
Write-Host "Registry value '$ValueName' not found in '$RegistryPath'."
|
||||
}
|
||||
} else {
|
||||
Write-Host "Registry path '$RegistryPath' not found."
|
||||
}
|
||||
}
|
||||
|
||||
"FirstStartup has worked" | Out-File -FilePath c:\windows\LogFirstRun.txt -Append -NoClobber
|
||||
|
||||
$taskbarPath = "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
|
||||
# Delete all files on the Taskbar
|
||||
Get-ChildItem -Path $taskbarPath -File | Remove-Item -Force
|
||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesRemovedChanges"
|
||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesChanges"
|
||||
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "Favorites"
|
||||
|
||||
# Delete Edge Icon from the desktop
|
||||
$edgeShortcutFiles = Get-ChildItem -Path $desktopPath -Filter "*Edge*.lnk"
|
||||
# Check if Edge shortcuts exist on the desktop
|
||||
if ($edgeShortcutFiles) {
|
||||
foreach ($shortcutFile in $edgeShortcutFiles) {
|
||||
# Remove each Edge shortcut
|
||||
Remove-Item -Path $shortcutFile.FullName -Force
|
||||
Write-Host "Edge shortcut '$($shortcutFile.Name)' removed from the desktop."
|
||||
}
|
||||
}
|
||||
Remove-Item -Path "$env:USERPROFILE\Desktop\*.lnk"
|
||||
Remove-Item -Path "C:\Users\Default\Desktop\*.lnk"
|
||||
|
||||
# ************************************************
|
||||
# Create WinUtil shortcut on the desktop
|
||||
#
|
||||
$desktopPath = "$($env:USERPROFILE)\Desktop"
|
||||
# Specify the target PowerShell command
|
||||
$command = "powershell.exe -NoProfile -ExecutionPolicy Bypass -Command 'irm https://christitus.com/win | iex'"
|
||||
# Specify the path for the shortcut
|
||||
$shortcutPath = Join-Path $desktopPath 'winutil.lnk'
|
||||
# Create a shell object
|
||||
$shell = New-Object -ComObject WScript.Shell
|
||||
|
||||
# Create a shortcut object
|
||||
$shortcut = $shell.CreateShortcut($shortcutPath)
|
||||
|
||||
if (Test-Path -Path "c:\Windows\cttlogo.png") {
|
||||
$shortcut.IconLocation = "c:\Windows\cttlogo.png"
|
||||
}
|
||||
|
||||
# Set properties of the shortcut
|
||||
$shortcut.TargetPath = "powershell.exe"
|
||||
$shortcut.Arguments = "-NoProfile -ExecutionPolicy Bypass -Command `"$command`""
|
||||
# Save the shortcut
|
||||
$shortcut.Save()
|
||||
|
||||
# Make the shortcut have 'Run as administrator' property on
|
||||
$bytes = [System.IO.File]::ReadAllBytes($shortcutPath)
|
||||
# Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex
|
||||
$bytes[0x15] = $bytes[0x15] -bor 0x20
|
||||
[System.IO.File]::WriteAllBytes($shortcutPath, $bytes)
|
||||
|
||||
Write-Host "Shortcut created at: $shortcutPath"
|
||||
#
|
||||
# Done create WinUtil shortcut on the desktop
|
||||
# ************************************************
|
||||
|
||||
Start-Process explorer
|
||||
|
||||
'@
|
||||
$firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force
|
||||
}
|
@ -1,81 +0,0 @@
|
||||
function Invoke-WinUtilSSHServer {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Enables OpenSSH server to remote into your windows device
|
||||
#>
|
||||
|
||||
# Get the latest version of OpenSSH Server
|
||||
$FeatureName = Get-WindowsCapability -Online | Where-Object { $_.Name -like "OpenSSH.Server*" }
|
||||
|
||||
# Install the OpenSSH Server feature if not already installed
|
||||
if ($FeatureName.State -ne "Installed") {
|
||||
Write-Host "Enabling OpenSSH Server"
|
||||
Add-WindowsCapability -Online -Name $FeatureName.Name
|
||||
}
|
||||
|
||||
# Sets up the OpenSSH Server service
|
||||
Write-Host "Starting the services"
|
||||
Start-Service -Name sshd
|
||||
Set-Service -Name sshd -StartupType Automatic
|
||||
|
||||
# Sets up the ssh-agent service
|
||||
Start-Service 'ssh-agent'
|
||||
Set-Service -Name 'ssh-agent' -StartupType 'Automatic'
|
||||
|
||||
# Confirm the required services are running
|
||||
$SSHDaemonService = Get-Service -Name sshd
|
||||
$SSHAgentService = Get-Service -Name 'ssh-agent'
|
||||
|
||||
if ($SSHDaemonService.Status -eq 'Running') {
|
||||
Write-Host "OpenSSH Server is running."
|
||||
} else {
|
||||
try {
|
||||
Write-Host "OpenSSH Server is not running. Attempting to restart..."
|
||||
Restart-Service -Name sshd -Force
|
||||
Write-Host "OpenSSH Server has been restarted successfully."
|
||||
} catch {
|
||||
Write-Host "Failed to restart OpenSSH Server: $_"
|
||||
}
|
||||
}
|
||||
if ($SSHAgentService.Status -eq 'Running') {
|
||||
Write-Host "ssh-agent is running."
|
||||
} else {
|
||||
try {
|
||||
Write-Host "ssh-agent is not running. Attempting to restart..."
|
||||
Restart-Service -Name sshd -Force
|
||||
Write-Host "ssh-agent has been restarted successfully."
|
||||
} catch {
|
||||
Write-Host "Failed to restart ssh-agent : $_"
|
||||
}
|
||||
}
|
||||
|
||||
#Adding Firewall rule for port 22
|
||||
Write-Host "Setting up firewall rules"
|
||||
$firewallRule = (Get-NetFirewallRule -Name 'sshd').Enabled
|
||||
if ($firewallRule) {
|
||||
Write-Host "Firewall rule for OpenSSH Server (sshd) already exists."
|
||||
} else {
|
||||
New-NetFirewallRule -Name sshd -DisplayName 'OpenSSH Server (sshd)' -Enabled True -Direction Inbound -Protocol TCP -Action Allow -LocalPort 22
|
||||
Write-Host "Firewall rule for OpenSSH Server created and enabled."
|
||||
}
|
||||
|
||||
# Check for the authorized_keys file
|
||||
$sshFolderPath = "$env:HOMEDRIVE\$env:HOMEPATH\.ssh"
|
||||
$authorizedKeysPath = "$sshFolderPath\authorized_keys"
|
||||
|
||||
if (-not (Test-Path -Path $sshFolderPath)) {
|
||||
Write-Host "Creating ssh directory..."
|
||||
New-Item -Path $sshFolderPath -ItemType Directory -Force
|
||||
}
|
||||
|
||||
if (-not (Test-Path -Path $authorizedKeysPath)) {
|
||||
Write-Host "Creating authorized_keys file..."
|
||||
New-Item -Path $authorizedKeysPath -ItemType File -Force
|
||||
Write-Host "authorized_keys file created at $authorizedKeysPath."
|
||||
} else {
|
||||
Write-Host "authorized_keys file already exists at $authorizedKeysPath."
|
||||
}
|
||||
Write-Host "OpenSSH server was successfully enabled."
|
||||
Write-Host "The config file can be located at C:\ProgramData\ssh\sshd_config "
|
||||
Write-Host "Add your public keys to this file -> $authorizedKeysPath"
|
||||
}
|
@ -14,7 +14,7 @@ function Invoke-WinUtilSnapFlyout {
|
||||
Write-Host "Disabling Snap Assist Flyout On startup"
|
||||
$value = 0
|
||||
}
|
||||
|
||||
# taskkill.exe /F /IM "explorer.exe"
|
||||
$Path = "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced"
|
||||
taskkill.exe /F /IM "explorer.exe"
|
||||
Set-ItemProperty -Path $Path -Name EnableSnapAssistFlyout -Value $value
|
||||
|
@ -1,187 +0,0 @@
|
||||
function Invoke-WinUtilUninstallPSProfile {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
# Uninstalls the CTT PowerShell profile then restores the original profile.
|
||||
#>
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PROFILE -DebugPreference $DebugPreference -ScriptBlock {
|
||||
# Remap the automatic built-in $PROFILE variable to the parameter named $PSProfile.
|
||||
param ($PSProfile)
|
||||
|
||||
# Helper function used to uninstall a specific Nerd Fonts font package.
|
||||
function Uninstall-NerdFonts {
|
||||
# Define the parameters block for the Uninstall-NerdFonts function.
|
||||
param (
|
||||
[string]$FontsPath = "$env:LOCALAPPDATA\Microsoft\Windows\Fonts",
|
||||
[string]$FontFamilyName = "CaskaydiaCoveNerdFont"
|
||||
)
|
||||
|
||||
# Get the list of installed fonts as specified by the FontFamilyName parameter.
|
||||
$Fonts = Get-ChildItem $FontsPath -Recurse -Filter "*.ttf" | Where-Object { $_.Name -match $FontFamilyName }
|
||||
|
||||
# Check if the specified fonts are currently installed on the system.
|
||||
if ($Fonts) {
|
||||
# Let the user know that the Nerd Fonts are currently being uninstalled.
|
||||
Write-Host "===> Uninstalling: Nerd Fonts... <===" -ForegroundColor Yellow
|
||||
|
||||
# Loop over the font files and remove each installed font file one-by-one.
|
||||
$Fonts | ForEach-Object {
|
||||
# Check if the font file exists on the disk before attempting to remove it.
|
||||
if (Test-Path "$($_.FullName)") {
|
||||
# Remove the found font files from the disk; uninstalling the font.
|
||||
Remove-Item "$($_.FullName)"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Let the user know that the Nerd Fonts package has been uninstalled from the system.
|
||||
if (-not $Fonts) {
|
||||
Write-Host "===> Successfully Uninstalled: Nerd Fonts. <===" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
|
||||
# Check if Chris Titus Tech's PowerShell profile is currently available in the PowerShell profile folder.
|
||||
if (Test-Path $PSProfile -PathType Leaf) {
|
||||
# Set the GitHub repo path used for looking up the name of Chris Titus Tech's powershell-profile repo.
|
||||
$GitHubRepoPath = "ChrisTitusTech/powershell-profile"
|
||||
|
||||
# Get the unique identifier used to test for the presence of Chris Titus Tech's PowerShell profile.
|
||||
$PSProfileIdentifier = (Invoke-RestMethod "https://api.github.com/repos/$GitHubRepoPath").full_name
|
||||
|
||||
# Check if Chris Titus Tech's PowerShell profile is currently installed in the PowerShell profile folder.
|
||||
if ((Get-Content $PSProfile) -match $PSProfileIdentifier) {
|
||||
# Attempt to uninstall Chris Titus Tech's PowerShell profile from the PowerShell profile folder.
|
||||
try {
|
||||
# Get the content of the backup PowerShell profile and store it in-memory.
|
||||
$PSProfileContent = Get-Content "$PSProfile.bak"
|
||||
|
||||
# Store the flag used to check if OhMyPosh is in use by the backup PowerShell profile.
|
||||
$OhMyPoshInUse = $PSProfileContent -match "oh-my-posh init"
|
||||
|
||||
# Check if OhMyPosh is not currently in use by the backup PowerShell profile.
|
||||
if (-not $OhMyPoshInUse) {
|
||||
# If OhMyPosh is currently installed attempt to uninstall it from the system.
|
||||
if (Get-Command oh-my-posh -ErrorAction SilentlyContinue) {
|
||||
# Let the user know that OhMyPosh is currently being uninstalled from their system.
|
||||
Write-Host "===> Uninstalling: OhMyPosh... <===" -ForegroundColor Yellow
|
||||
|
||||
# Attempt to uninstall OhMyPosh from the system with the WinGet package manager.
|
||||
winget uninstall -e --id JanDeDobbeleer.OhMyPosh
|
||||
}
|
||||
} else {
|
||||
# Let the user know that the uninstallation of OhMyPosh has been skipped because it is in use.
|
||||
Write-Host "===> Skipped Uninstall: OhMyPosh In-Use. <===" -ForegroundColor Yellow
|
||||
}
|
||||
} catch {
|
||||
# Let the user know that an error was encountered when uninstalling OhMyPosh.
|
||||
Write-Host "Failed to uninstall OhMyPosh. Error: $_" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Attempt to uninstall the specified Nerd Fonts package from the system.
|
||||
try {
|
||||
# Specify the directory that the specified font package will be uninstalled from.
|
||||
[string]$FontsPath = "$env:LOCALAPPDATA\Microsoft\Windows\Fonts"
|
||||
|
||||
# Specify the name of the font package that is to be uninstalled from the system.
|
||||
[string]$FontFamilyName = "CaskaydiaCoveNerdFont"
|
||||
|
||||
# Call the function used to uninstall the specified Nerd Fonts package from the system.
|
||||
Uninstall-NerdFonts -FontsPath $FontsPath -FontFamilyName $FontFamilyName
|
||||
} catch {
|
||||
# Let the user know that an error was encountered when uninstalling Nerd Fonts.
|
||||
Write-Host "Failed to uninstall Nerd Fonts. Error: $_" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Attempt to uninstall the Terminal-Icons PowerShell module from the system.
|
||||
try {
|
||||
# Get the content of the backup PowerShell profile and store it in-memory.
|
||||
$PSProfileContent = Get-Content "$PSProfile.bak"
|
||||
|
||||
# Store the flag used to check if Terminal-Icons is in use by the backup PowerShell profile.
|
||||
$TerminalIconsInUse = $PSProfileContent -match "Import-Module" -and $PSProfileContent -match "Terminal-Icons"
|
||||
|
||||
# Check if Terminal-Icons is not currently in use by the backup PowerShell profile.
|
||||
if (-not $TerminalIconsInUse) {
|
||||
# If Terminal-Icons is currently installed attempt to uninstall it from the system.
|
||||
if (Get-Module -ListAvailable Terminal-Icons) {
|
||||
# Let the user know that Terminal-Icons is currently being uninstalled from their system.
|
||||
Write-Host "===> Uninstalling: Terminal-Icons... <===" -ForegroundColor Yellow
|
||||
|
||||
# Attempt to uninstall Terminal-Icons from the system with Uninstall-Module.
|
||||
Uninstall-Module -Name Terminal-Icons
|
||||
}
|
||||
} else {
|
||||
# Let the user know that the uninstallation of Terminal-Icons has been skipped because it is in use.
|
||||
Write-Host "===> Skipped Uninstall: Terminal-Icons In-Use. <===" -ForegroundColor Yellow
|
||||
}
|
||||
} catch {
|
||||
# Let the user know that an error was encountered when uninstalling Terminal-Icons.
|
||||
Write-Host "Failed to uninstall Terminal-Icons. Error: $_" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Attempt to uninstall the Zoxide application from the system.
|
||||
try {
|
||||
# Get the content of the backup PowerShell profile and store it in-memory.
|
||||
$PSProfileContent = Get-Content "$PSProfile.bak"
|
||||
|
||||
# Store the flag used to check if Zoxide is in use by the backup PowerShell profile.
|
||||
$ZoxideInUse = $PSProfileContent -match "zoxide init"
|
||||
|
||||
# Check if Zoxide is not currently in use by the backup PowerShell profile.
|
||||
if (-not $ZoxideInUse) {
|
||||
# If Zoxide is currently installed attempt to uninstall it from the system.
|
||||
if (Get-Command zoxide -ErrorAction SilentlyContinue) {
|
||||
# Let the user know that Zoxide is currently being uninstalled from their system.
|
||||
Write-Host "===> Uninstalling: Zoxide... <===" -ForegroundColor Yellow
|
||||
|
||||
# Attempt to uninstall Zoxide from the system with the WinGet package manager.
|
||||
winget uninstall -e --id ajeetdsouza.zoxide
|
||||
}
|
||||
} else {
|
||||
# Let the user know that the uninstallation of Zoxide been skipped because it is in use.
|
||||
Write-Host "===> Skipped Uninstall: Zoxide In-Use. <===" -ForegroundColor Yellow
|
||||
}
|
||||
} catch {
|
||||
# Let the user know that an error was encountered when uninstalling Zoxide.
|
||||
Write-Host "Failed to uninstall Zoxide. Error: $_" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Attempt to uninstall the CTT PowerShell profile from the system.
|
||||
try {
|
||||
# Try and remove the CTT PowerShell Profile file from the disk with Remove-Item.
|
||||
Remove-Item $PSProfile
|
||||
|
||||
# Let the user know that the CTT PowerShell profile has been uninstalled from the system.
|
||||
Write-Host "Profile has been uninstalled. Please restart your shell to reflect the changes!" -ForegroundColor Magenta
|
||||
} catch {
|
||||
# Let the user know that an error was encountered when uninstalling the profile.
|
||||
Write-Host "Failed to uninstall profile. Error: $_" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Attempt to move the user's original PowerShell profile backup back to its original location.
|
||||
try {
|
||||
# Check if the backup PowerShell profile exists before attempting to restore the backup.
|
||||
if (Test-Path "$PSProfile.bak") {
|
||||
# Restore the backup PowerShell profile and move it to its original location.
|
||||
Move-Item "$PSProfile.bak" $PSProfile
|
||||
|
||||
# Let the user know that their PowerShell profile backup has been successfully restored.
|
||||
Write-Host "===> Restored Profile Backup. <===" -ForegroundColor Yellow
|
||||
}
|
||||
} catch {
|
||||
# Let the user know that an error was encountered when restoring the profile backup.
|
||||
Write-Host "Failed to restore profile backup. Error: $_" -ForegroundColor Red
|
||||
}
|
||||
|
||||
# Silently cleanup the oldprofile.ps1 file that was created when the CTT PowerShell profile was installed.
|
||||
Remove-Item "$env:USERPROFILE\oldprofile.ps1" | Out-Null
|
||||
} else {
|
||||
# Let the user know that the CTT PowerShell profile is not installed and that the uninstallation was skipped.
|
||||
Write-Host "===> Chris Titus Tech's PowerShell Profile Not Found. Skipped Uninstallation. <===" -ForegroundColor Magenta
|
||||
}
|
||||
} else {
|
||||
# Let the user know that no PowerShell profile was found and that the uninstallation was skipped.
|
||||
Write-Host "===> No PowerShell Profile Found. Skipped Uninstallation. <===" -ForegroundColor Magenta
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
Function Install-WinUtilProgramWinget {
|
||||
Function Invoke-WinUtilWingetProgram {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Runs the designated action on the provided programs using Winget
|
@ -1,50 +0,0 @@
|
||||
function Invoke-WinUtilpsProfile {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Installs & applies the CTT Powershell Profile
|
||||
#>
|
||||
Invoke-WPFRunspace -Argumentlist $PROFILE -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param ( $psprofile)
|
||||
function Invoke-PSSetup {
|
||||
$url = "https://raw.githubusercontent.com/ChrisTitusTech/powershell-profile/main/Microsoft.PowerShell_profile.ps1"
|
||||
$oldhash = Get-FileHash $psprofile -ErrorAction SilentlyContinue
|
||||
Invoke-RestMethod $url -OutFile "$env:temp/Microsoft.PowerShell_profile.ps1"
|
||||
$newhash = Get-FileHash "$env:temp/Microsoft.PowerShell_profile.ps1"
|
||||
if ($newhash.Hash -ne $oldhash.Hash) {
|
||||
write-host "===> Installing Profile.. <===" -ForegroundColor Yellow
|
||||
# Starting new hidden shell process bc setup does not work in a runspace
|
||||
Start-Process -FilePath "pwsh" -ArgumentList "-ExecutionPolicy Bypass -NoProfile -Command `"Invoke-Expression (Invoke-WebRequest `'https://github.com/ChrisTitusTech/powershell-profile/raw/main/setup.ps1`')`"" -WindowStyle Hidden -Wait
|
||||
Write-Host "Profile has been installed. Please restart your shell to reflect changes!" -ForegroundColor Magenta
|
||||
write-host "===> Finished <===" -ForegroundColor Yellow
|
||||
} else {
|
||||
Write-Host "Profile is up to date" -ForegroundColor Green
|
||||
}
|
||||
}
|
||||
|
||||
if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
|
||||
if ($PSVersionTable.PSVersion.Major -ge 7) {
|
||||
Invoke-PSSetup
|
||||
}
|
||||
else {
|
||||
write-host "Profile requires Powershell 7, which is currently installed but not used!" -ForegroundColor Red
|
||||
# Load the necessary assembly for Windows Forms
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
# Display the Yes/No message box
|
||||
$question = [System.Windows.Forms.MessageBox]::Show("Profile requires Powershell 7, which is currently installed but not used! Do you want to install Profile for Powershell 7?", "Question",
|
||||
[System.Windows.Forms.MessageBoxButtons]::YesNo,
|
||||
[System.Windows.Forms.MessageBoxIcon]::Question)
|
||||
|
||||
# Check the result
|
||||
if ($question -eq [System.Windows.Forms.DialogResult]::Yes) {
|
||||
Invoke-PSSetup
|
||||
}
|
||||
else {
|
||||
Write-Host "Not proceeding with the profile setup!"
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
write-host "Profile requires Powershell 7, which is not installed!" -ForegroundColor Red
|
||||
}
|
||||
}
|
||||
}
|
@ -1,180 +0,0 @@
|
||||
function Invoke-WinutilThemeChange {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Toggles between light and dark themes for a Windows utility application.
|
||||
|
||||
.DESCRIPTION
|
||||
This function toggles the theme of the user interface between 'Light' and 'Dark' modes,
|
||||
modifying various UI elements such as colors, margins, corner radii, font families, etc.
|
||||
If the '-init' switch is used, it initializes the theme based on the system's current dark mode setting.
|
||||
|
||||
.PARAMETER init
|
||||
A switch parameter. If set to $true, the function initializes the theme based on the system’s current dark mode setting.
|
||||
|
||||
.EXAMPLE
|
||||
Invoke-WinutilThemeChange
|
||||
# Toggles the theme between 'Light' and 'Dark'.
|
||||
|
||||
.EXAMPLE
|
||||
Invoke-WinutilThemeChange -init
|
||||
# Initializes the theme based on the system's dark mode and applies the shared theme.
|
||||
#>
|
||||
param (
|
||||
[switch]$init = $false,
|
||||
[string]$theme
|
||||
)
|
||||
|
||||
function Set-WinutilTheme {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Applies the specified theme to the application's user interface.
|
||||
|
||||
.DESCRIPTION
|
||||
This internal function applies the given theme by setting the relevant properties
|
||||
like colors, font families, corner radii, etc., in the UI. It uses the
|
||||
'Set-ThemeResourceProperty' helper function to modify the application's resources.
|
||||
|
||||
.PARAMETER currentTheme
|
||||
The name of the theme to be applied. Common values are "Light", "Dark", or "shared".
|
||||
#>
|
||||
param (
|
||||
[string]$currentTheme
|
||||
)
|
||||
|
||||
function Set-ThemeResourceProperty {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets a specific UI property in the application's resources.
|
||||
|
||||
.DESCRIPTION
|
||||
This helper function sets a property (e.g., color, margin, corner radius) in the
|
||||
application's resources, based on the provided type and value. It includes
|
||||
error handling to manage potential issues while setting a property.
|
||||
|
||||
.PARAMETER Name
|
||||
The name of the resource property to modify (e.g., "MainBackgroundColor", "ButtonBackgroundMouseoverColor").
|
||||
|
||||
.PARAMETER Value
|
||||
The value to assign to the resource property (e.g., "#FFFFFF" for a color).
|
||||
|
||||
.PARAMETER Type
|
||||
The type of the resource, such as "ColorBrush", "CornerRadius", "GridLength", or "FontFamily".
|
||||
#>
|
||||
param($Name, $Value, $Type)
|
||||
try {
|
||||
# Set the resource property based on its type
|
||||
$sync.Form.Resources[$Name] = switch ($Type) {
|
||||
"ColorBrush" { [Windows.Media.SolidColorBrush]::new($Value) }
|
||||
"Color" {
|
||||
# Convert hex string to RGB values
|
||||
$hexColor = $Value.TrimStart("#")
|
||||
$r = [Convert]::ToInt32($hexColor.Substring(0,2), 16)
|
||||
$g = [Convert]::ToInt32($hexColor.Substring(2,2), 16)
|
||||
$b = [Convert]::ToInt32($hexColor.Substring(4,2), 16)
|
||||
[Windows.Media.Color]::FromRgb($r, $g, $b)
|
||||
}
|
||||
"CornerRadius" { [System.Windows.CornerRadius]::new($Value) }
|
||||
"GridLength" { [System.Windows.GridLength]::new($Value) }
|
||||
"Thickness" {
|
||||
# Parse the Thickness value (supports 1, 2, or 4 inputs)
|
||||
$values = $Value -split ","
|
||||
switch ($values.Count) {
|
||||
1 { [System.Windows.Thickness]::new([double]$values[0]) }
|
||||
2 { [System.Windows.Thickness]::new([double]$values[0], [double]$values[1]) }
|
||||
4 { [System.Windows.Thickness]::new([double]$values[0], [double]$values[1], [double]$values[2], [double]$values[3]) }
|
||||
}
|
||||
}
|
||||
"FontFamily" { [Windows.Media.FontFamily]::new($Value) }
|
||||
"Double" { [double]$Value }
|
||||
default { $Value }
|
||||
}
|
||||
}
|
||||
catch {
|
||||
# Log a warning if there's an issue setting the property
|
||||
Write-Warning "Failed to set property $($Name): $_"
|
||||
}
|
||||
}
|
||||
|
||||
# Retrieve all theme properties from the theme configuration
|
||||
$themeProperties = $sync.configs.themes.$currentTheme.PSObject.Properties
|
||||
foreach ($_ in $themeProperties) {
|
||||
# Apply properties that deal with colors
|
||||
if ($_.Name -like "*color*") {
|
||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "ColorBrush"
|
||||
# For certain color properties, also set complementary values (e.g., BorderColor -> CBorderColor) This is required because e.g DropShadowEffect requires a <Color> and not a <SolidColorBrush> object
|
||||
if ($_.Name -in @("BorderColor", "ButtonBackgroundMouseoverColor")) {
|
||||
Set-ThemeResourceProperty -Name "C$($_.Name)" -Value $_.Value -Type "Color"
|
||||
}
|
||||
}
|
||||
# Apply corner radius properties
|
||||
elseif ($_.Name -like "*Radius*") {
|
||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "CornerRadius"
|
||||
}
|
||||
# Apply row height properties
|
||||
elseif ($_.Name -like "*RowHeight*") {
|
||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "GridLength"
|
||||
}
|
||||
# Apply thickness or margin properties
|
||||
elseif (($_.Name -like "*Thickness*") -or ($_.Name -like "*margin")) {
|
||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "Thickness"
|
||||
}
|
||||
# Apply font family properties
|
||||
elseif ($_.Name -like "*FontFamily*") {
|
||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "FontFamily"
|
||||
}
|
||||
# Apply any other properties as doubles (numerical values)
|
||||
else {
|
||||
Set-ThemeResourceProperty -Name $_.Name -Value $_.Value -Type "Double"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$LightPreferencePath = "$env:LOCALAPPDATA\winutil\LightTheme.ini"
|
||||
$DarkPreferencePath = "$env:LOCALAPPDATA\winutil\DarkTheme.ini"
|
||||
|
||||
if ($init) {
|
||||
Set-WinutilTheme -currentTheme "shared"
|
||||
if (Test-Path $LightPreferencePath) {
|
||||
$theme = "Light"
|
||||
}
|
||||
elseif (Test-Path $DarkPreferencePath) {
|
||||
$theme = "Dark"
|
||||
}
|
||||
else {
|
||||
$theme = "Auto"
|
||||
}
|
||||
}
|
||||
|
||||
switch ($theme) {
|
||||
"Auto" {
|
||||
$systemUsesDarkMode = Get-WinUtilToggleStatus WPFToggleDarkMode
|
||||
if ($systemUsesDarkMode) {
|
||||
Set-WinutilTheme -currentTheme "Dark"
|
||||
}
|
||||
else{
|
||||
Set-WinutilTheme -currentTheme "Light"
|
||||
}
|
||||
|
||||
|
||||
$themeButtonIcon = [char]0xF08C
|
||||
Remove-Item $LightPreferencePath -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item $DarkPreferencePath -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
"Dark" {
|
||||
Set-WinutilTheme -currentTheme $theme
|
||||
$themeButtonIcon = [char]0xE708
|
||||
$null = New-Item $DarkPreferencePath -Force
|
||||
Remove-Item $LightPreferencePath -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
"Light" {
|
||||
Set-WinutilTheme -currentTheme $theme
|
||||
$themeButtonIcon = [char]0xE706
|
||||
$null = New-Item $LightPreferencePath -Force
|
||||
Remove-Item $DarkPreferencePath -Force -ErrorAction SilentlyContinue
|
||||
}
|
||||
}
|
||||
|
||||
# Update the theme selector button with the appropriate icon
|
||||
$ThemeButton = $sync.Form.FindName("ThemeButton")
|
||||
$ThemeButton.Content = [string]$themeButtonIcon
|
||||
}
|
@ -35,14 +35,8 @@ function Set-WinUtilRegistry {
|
||||
New-Item -Path $Path -Force -ErrorAction Stop | Out-Null
|
||||
}
|
||||
|
||||
if ($Value -ne "<RemoveEntry>") {
|
||||
Write-Host "Set $Path\$Name to $Value"
|
||||
Set-ItemProperty -Path $Path -Name $Name -Type $Type -Value $Value -Force -ErrorAction Stop | Out-Null
|
||||
}
|
||||
else{
|
||||
Write-Host "Remove $Path\$Name"
|
||||
Remove-ItemProperty -Path $Path -Name $Name -Force -ErrorAction Stop | Out-Null
|
||||
}
|
||||
} catch [System.Security.SecurityException] {
|
||||
Write-Warning "Unable to set $Path\$Name to $Value due to a Security Exception"
|
||||
} catch [System.Management.Automation.ItemNotFoundException] {
|
||||
|
@ -61,13 +61,13 @@ function Set-WinUtilTaskbaritem {
|
||||
if ($overlay) {
|
||||
switch ($overlay) {
|
||||
'logo' {
|
||||
$sync["Form"].taskbarItemInfo.Overlay = $sync["logorender"]
|
||||
$sync["Form"].taskbarItemInfo.Overlay = "$env:LOCALAPPDATA\winutil\cttlogo.png"
|
||||
}
|
||||
'checkmark' {
|
||||
$sync["Form"].taskbarItemInfo.Overlay = $sync["checkmarkrender"]
|
||||
$sync["Form"].taskbarItemInfo.Overlay = "$env:LOCALAPPDATA\winutil\checkmark.png"
|
||||
}
|
||||
'warning' {
|
||||
$sync["Form"].taskbarItemInfo.Overlay = $sync["warningrender"]
|
||||
$sync["Form"].taskbarItemInfo.Overlay = "$env:LOCALAPPDATA\winutil\warning.png"
|
||||
}
|
||||
'None' {
|
||||
$sync["Form"].taskbarItemInfo.Overlay = $null
|
||||
|
50
functions/private/Set-WinUtilUiTheme.ps1
Normal file
50
functions/private/Set-WinUtilUiTheme.ps1
Normal file
@ -0,0 +1,50 @@
|
||||
function Set-WinUtilUITheme {
|
||||
<#
|
||||
.SYNOPSIS
|
||||
Sets the theme of the XAML file
|
||||
|
||||
.PARAMETER inputXML
|
||||
A string representing the XAML object to modify
|
||||
|
||||
.PARAMETER themeName
|
||||
The name of the theme to set the XAML to. Defaults to 'matrix'
|
||||
|
||||
.EXAMPLE
|
||||
Set-WinUtilUITheme -inputXAML $inputXAML
|
||||
#>
|
||||
|
||||
param
|
||||
(
|
||||
[Parameter(Mandatory, position=0)]
|
||||
[string]$inputXML,
|
||||
[Parameter(position=1)]
|
||||
[string]$themeName = 'matrix'
|
||||
)
|
||||
|
||||
try {
|
||||
# Convert the JSON to a PowerShell object
|
||||
$themes = $sync.configs.themes
|
||||
# Select the specified theme
|
||||
$selectedTheme = $themes.$themeName
|
||||
|
||||
if ($selectedTheme) {
|
||||
# Loop through all key-value pairs in the selected theme
|
||||
foreach ($property in $selectedTheme.PSObject.Properties) {
|
||||
$key = $property.Name
|
||||
$value = $property.Value
|
||||
# Add curly braces around the key
|
||||
$formattedKey = "{$key}"
|
||||
# Replace the key with the value in the input XML
|
||||
$inputXML = $inputXML.Replace($formattedKey, $value)
|
||||
}
|
||||
} else {
|
||||
Write-Host "Theme '$themeName' not found."
|
||||
}
|
||||
|
||||
} catch {
|
||||
Write-Warning "Unable to apply theme"
|
||||
Write-Warning $psitem.Exception.StackTrace
|
||||
}
|
||||
|
||||
return $inputXML;
|
||||
}
|
@ -33,25 +33,25 @@ function Show-CustomDialog {
|
||||
#>
|
||||
param(
|
||||
[string]$Message,
|
||||
[int]$Width = $sync.Form.Resources.CustomDialogWidth,
|
||||
[int]$Height = $sync.Form.Resources.CustomDialogHeight,
|
||||
[int]$FontSize = $sync.Form.Resources.CustomDialogFontSize,
|
||||
[int]$HeaderFontSize = $sync.Form.Resources.CustomDialogFontSizeHeader,
|
||||
[int]$IconSize = $sync.Form.Resources.CustomDialogLogoSize,
|
||||
[int]$Width = 300,
|
||||
[int]$Height = 200,
|
||||
[int]$FontSize = 10,
|
||||
[int]$HeaderFontSize = 14,
|
||||
[int]$IconSize = 25,
|
||||
[bool]$EnableScroll = $false
|
||||
)
|
||||
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
|
||||
# Define theme colors
|
||||
$foregroundColor = $sync.Form.Resources.MainForegroundColor
|
||||
$backgroundColor = $sync.Form.Resources.MainBackgroundColor
|
||||
$foregroundColor = $sync.configs.themes.$ctttheme.MainForegroundColor
|
||||
$backgroundColor = $sync.configs.themes.$ctttheme.MainBackgroundColor
|
||||
$font = New-Object Windows.Media.FontFamily("Consolas")
|
||||
$borderColor = $sync.Form.Resources.BorderColor # ButtonInstallBackgroundColor
|
||||
$buttonBackgroundColor = $sync.Form.Resources.ButtonInstallBackgroundColor
|
||||
$buttonForegroundColor = $sync.Form.Resources.ButtonInstallForegroundColor
|
||||
$borderColor = $sync.configs.themes.$ctttheme.BorderColor # ButtonInstallBackgroundColor
|
||||
$buttonBackgroundColor = $sync.configs.themes.$ctttheme.ButtonInstallBackgroundColor
|
||||
$buttonForegroundColor = $sync.configs.themes.$ctttheme.ButtonInstallForegroundColor
|
||||
$shadowColor = [Windows.Media.ColorConverter]::ConvertFromString("#AAAAAAAA")
|
||||
$logocolor = $sync.Form.Resources.LabelboxForegroundColor
|
||||
$logocolor = $sync.configs.themes.$ctttheme.ButtonBackgroundPressedColor
|
||||
|
||||
# Create a custom dialog window
|
||||
$dialog = New-Object Windows.Window
|
||||
@ -128,15 +128,73 @@ function Show-CustomDialog {
|
||||
$grid.Children.Add($stackPanel)
|
||||
[Windows.Controls.Grid]::SetRow($stackPanel, 0) # Set the row to the second row (0-based index)
|
||||
|
||||
$viewbox = New-Object Windows.Controls.Viewbox
|
||||
$viewbox.Width = $IconSize
|
||||
$viewbox.Height = $IconSize
|
||||
|
||||
# Combine the paths into a single string
|
||||
# $cttLogoPath = @"
|
||||
# M174 1094 c-4 -14 -4 -55 -2 -92 3 -57 9 -75 41 -122 41 -60 45 -75 22 -84 -25 -9 -17 -21 30 -44 l45 -22 0 -103 c0 -91 3 -109 26 -155 30 -60 65 -87 204 -157 l95 -48 110 58 c184 96 205 127 205 293 l0 108 45 22 c47 23 55 36 30 46 -22 8 -18 30 9 63 13 16 34 48 46 71 20 37 21 52 15 116 l-6 73 -69 -23 c-38 -12 -137 -59 -220 -103 -82 -45 -160 -81 -171 -81 -12 0 -47 15 -78 34 -85 51 -239 127 -309 151 l-62 22 -6 -23z m500 -689 c20 -8 36 -19 36 -24 0 -18 -53 -51 -80 -51 -28 0 -80 33 -80 51 0 10 55 38 76 39 6 0 28 -7 48 -15z
|
||||
# M177 711 c-19 -88 4 -242 49 -318 43 -74 107 -127 232 -191 176 -90 199 -84 28 7 -169 91 -214 129 -258 220 -29 58 -32 74 -37 190 -4 90 -8 116 -14 92z
|
||||
# M1069 610 c-4 -131 -5 -137 -38 -198 -43 -79 -89 -119 -210 -181 -53 -27 -116 -61 -141 -76 -74 -43 -6 -20 115 40 221 109 296 217 294 425 -1 144 -16 137 -20 -10z
|
||||
# "@
|
||||
$cttLogoPath = @"
|
||||
M 18.00,14.00
|
||||
C 18.00,14.00 45.00,27.74 45.00,27.74
|
||||
45.00,27.74 57.40,34.63 57.40,34.63
|
||||
57.40,34.63 59.00,43.00 59.00,43.00
|
||||
59.00,43.00 59.00,83.00 59.00,83.00
|
||||
55.35,81.66 46.99,77.79 44.72,74.79
|
||||
41.17,70.10 42.01,59.80 42.00,54.00
|
||||
42.00,51.62 42.20,48.29 40.98,46.21
|
||||
38.34,41.74 25.78,38.60 21.28,33.79
|
||||
16.81,29.02 18.00,20.20 18.00,14.00 Z
|
||||
M 107.00,14.00
|
||||
C 109.01,19.06 108.93,30.37 104.66,34.21
|
||||
100.47,37.98 86.38,43.10 84.60,47.21
|
||||
83.94,48.74 84.01,51.32 84.00,53.00
|
||||
83.97,57.04 84.46,68.90 83.26,72.00
|
||||
81.06,77.70 72.54,81.42 67.00,83.00
|
||||
67.00,83.00 67.00,43.00 67.00,43.00
|
||||
67.00,43.00 67.99,35.63 67.99,35.63
|
||||
67.99,35.63 80.00,28.26 80.00,28.26
|
||||
80.00,28.26 107.00,14.00 107.00,14.00 Z
|
||||
M 19.00,46.00
|
||||
C 21.36,47.14 28.67,50.71 30.01,52.63
|
||||
31.17,54.30 30.99,57.04 31.00,59.00
|
||||
31.04,65.41 30.35,72.16 33.56,78.00
|
||||
38.19,86.45 46.10,89.04 54.00,93.31
|
||||
56.55,94.69 60.10,97.20 63.00,97.22
|
||||
65.50,97.24 68.77,95.36 71.00,94.25
|
||||
76.42,91.55 84.51,87.78 88.82,83.68
|
||||
94.56,78.20 95.96,70.59 96.00,63.00
|
||||
96.01,60.24 95.59,54.63 97.02,52.39
|
||||
98.80,49.60 103.95,47.87 107.00,47.00
|
||||
107.00,47.00 107.00,67.00 107.00,67.00
|
||||
106.90,87.69 96.10,93.85 80.00,103.00
|
||||
76.51,104.98 66.66,110.67 63.00,110.52
|
||||
60.33,110.41 55.55,107.53 53.00,106.25
|
||||
46.21,102.83 36.63,98.57 31.04,93.68
|
||||
16.88,81.28 19.00,62.88 19.00,46.00 Z
|
||||
"@
|
||||
|
||||
# Add SVG path
|
||||
$svgPath = New-Object Windows.Shapes.Path
|
||||
$svgPath.Data = [Windows.Media.Geometry]::Parse($cttLogoPath)
|
||||
$svgPath.Fill = $logocolor # Set fill color to white
|
||||
|
||||
# Add SVG path to Viewbox
|
||||
$viewbox.Child = $svgPath
|
||||
|
||||
# Add SVG path to the stack panel
|
||||
$stackPanel.Children.Add((Invoke-WinUtilAssets -Type "logo" -Size 25))
|
||||
$stackPanel.Children.Add($viewbox)
|
||||
|
||||
# Add "Winutil" text
|
||||
$winutilTextBlock = New-Object Windows.Controls.TextBlock
|
||||
$winutilTextBlock.Text = "Winutil"
|
||||
$winutilTextBlock.FontSize = $HeaderFontSize
|
||||
$winutilTextBlock.Foreground = $logocolor
|
||||
$winutilTextBlock.Margin = New-Object Windows.Thickness(10, 10, 10, 5) # Add margins around the text block
|
||||
$winutilTextBlock.Margin = New-Object Windows.Thickness(10, 5, 10, 5) # Add margins around the text block
|
||||
$stackPanel.Children.Add($winutilTextBlock)
|
||||
# Add TextBlock for information with text wrapping and margins
|
||||
$messageTextBlock = New-Object Windows.Controls.TextBlock
|
||||
@ -162,7 +220,7 @@ function Show-CustomDialog {
|
||||
$hyperlink.NavigateUri = New-Object System.Uri($match.Groups[1].Value)
|
||||
$hyperlink.Inlines.Add($match.Groups[2].Value)
|
||||
$hyperlink.TextDecorations = [Windows.TextDecorations]::None # Remove underline
|
||||
$hyperlink.Foreground = $sync.Form.Resources.LinkForegroundColor
|
||||
$hyperlink.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor
|
||||
|
||||
$hyperlink.Add_Click({
|
||||
param($sender, $args)
|
||||
@ -170,11 +228,11 @@ function Show-CustomDialog {
|
||||
})
|
||||
$hyperlink.Add_MouseEnter({
|
||||
param($sender, $args)
|
||||
$sender.Foreground = $sync.Form.Resources.LinkHoverForegroundColor
|
||||
$sender.Foreground = $sync.configs.themes.$ctttheme.LinkHoverForegroundColor
|
||||
})
|
||||
$hyperlink.Add_MouseLeave({
|
||||
param($sender, $args)
|
||||
$sender.Foreground = $sync.Form.Resources.LinkForegroundColor
|
||||
$sender.Foreground = $sync.configs.themes.$ctttheme.LinkForegroundColor
|
||||
})
|
||||
|
||||
$messageTextBlock.Inlines.Add($hyperlink)
|
||||
|
@ -11,7 +11,7 @@ Function Update-WinUtilProgramWinget {
|
||||
|
||||
$host.ui.RawUI.WindowTitle = """Winget Install"""
|
||||
|
||||
Start-Transcript "$logdir\winget-update_$dateTime.log" -Append
|
||||
Start-Transcript $ENV:TEMP\winget-update.log -Append
|
||||
winget upgrade --all --accept-source-agreements --accept-package-agreements --scope=machine --silent
|
||||
|
||||
}
|
||||
|
@ -19,14 +19,15 @@ function Invoke-WPFButton {
|
||||
}
|
||||
|
||||
Switch -Wildcard ($Button) {
|
||||
|
||||
"WPFTab?BT" {Invoke-WPFTab $Button}
|
||||
"WPFInstall" {Invoke-WPFInstall}
|
||||
"WPFUninstall" {Invoke-WPFUnInstall}
|
||||
"WPFinstall" {Invoke-WPFInstall}
|
||||
"WPFuninstall" {Invoke-WPFUnInstall}
|
||||
"WPFInstallUpgrade" {Invoke-WPFInstallUpgrade}
|
||||
"WPFStandard" {Invoke-WPFPresets "Standard" -checkboxfilterpattern "WPFTweak*"}
|
||||
"WPFMinimal" {Invoke-WPFPresets "Minimal" -checkboxfilterpattern "WPFTweak*"}
|
||||
"WPFClearTweaksSelection" {Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFTweak*"}
|
||||
"WPFClearInstallSelection" {Invoke-WPFPresets -imported $true -checkboxfilterpattern "WPFInstall*"}
|
||||
"WPFstandard" {Invoke-WPFPresets "Standard"}
|
||||
"WPFminimal" {Invoke-WPFPresets "Minimal"}
|
||||
"WPFclear" {Invoke-WPFPresets -preset $null -imported $true}
|
||||
"WPFclearWinget" {Invoke-WPFPresets -preset $null -imported $true -CheckBox "WPFInstall"}
|
||||
"WPFtweaksbutton" {Invoke-WPFtweaksbutton}
|
||||
"WPFOOSUbutton" {Invoke-WPFOOSU}
|
||||
"WPFAddUltPerf" {Invoke-WPFUltimatePerformance -State "Enable"}
|
||||
@ -40,7 +41,6 @@ function Invoke-WPFButton {
|
||||
"WPFPanelpower" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelregion" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelsound" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelprinter" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPanelsystem" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFPaneluser" {Invoke-WPFControlPanel -Panel $button}
|
||||
"WPFUpdatesdefault" {Invoke-WPFUpdatesdefault}
|
||||
@ -53,12 +53,9 @@ function Invoke-WPFButton {
|
||||
"WPFWinUtilShortcut" {Invoke-WPFShortcut -ShortcutToAdd "WinUtil" -RunAsAdmin $true}
|
||||
"WPFGetInstalled" {Invoke-WPFGetInstalled -CheckBox "winget"}
|
||||
"WPFGetInstalledTweaks" {Invoke-WPFGetInstalled -CheckBox "tweaks"}
|
||||
"WPFGetIso" {Invoke-MicrowinGetIso}
|
||||
"WPFMicrowin" {Invoke-Microwin}
|
||||
"WPFGetIso" {Invoke-WPFGetIso}
|
||||
"WPFMicrowin" {Invoke-WPFMicrowin}
|
||||
"WPFCloseButton" {Invoke-WPFCloseButton}
|
||||
"MicrowinScratchDirBT" {Invoke-ScratchDialog}
|
||||
"WPFWinUtilInstallPSProfile" {Invoke-WinUtilInstallPSProfile}
|
||||
"WPFWinUtilUninstallPSProfile" {Invoke-WinUtilUninstallPSProfile}
|
||||
"WPFWinUtilSSHServer" {Invoke-WinUtilSSHServer}
|
||||
}
|
||||
}
|
||||
|
@ -16,7 +16,6 @@ function Invoke-WPFControlPanel {
|
||||
"WPFPanelpower" {cmd /c powercfg.cpl}
|
||||
"WPFPanelregion" {cmd /c intl.cpl}
|
||||
"WPFPanelsound" {cmd /c mmsys.cpl}
|
||||
"WPFPanelprinter" {Start-Process "shell:::{A8A91A66-3A7D-4424-8D24-04E180695C7A}"}
|
||||
"WPFPanelsystem" {cmd /c sysdm.cpl}
|
||||
"WPFPaneluser" {cmd /c "control userpasswords2"}
|
||||
}
|
||||
|
@ -1,6 +1,6 @@
|
||||
function Invoke-WPFGetInstalled {
|
||||
<#
|
||||
TODO: Add the Option to use Chocolatey as Engine
|
||||
|
||||
.SYNOPSIS
|
||||
Invokes the function that gets the checkboxes to check in a new runspace
|
||||
|
||||
@ -16,12 +16,12 @@ function Invoke-WPFGetInstalled {
|
||||
return
|
||||
}
|
||||
|
||||
if(($sync.WPFpreferChocolatey.IsChecked -eq $false) -and ((Test-WinUtilPackageManager -winget) -eq "not-installed") -and $checkbox -eq "winget") {
|
||||
if(((Test-WinUtilPackageManager -winget) -eq "not-installed") -and $checkbox -eq "winget") {
|
||||
return
|
||||
}
|
||||
$preferChoco = $sync.WPFpreferChocolatey.IsChecked
|
||||
Invoke-WPFRunspace -ArgumentList $checkbox, $preferChoco -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($checkbox, $preferChoco, $DebugPreference)
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $checkbox -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($checkbox, $DebugPreference)
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" })
|
||||
@ -32,12 +32,8 @@ function Invoke-WPFGetInstalled {
|
||||
if($checkbox -eq "tweaks") {
|
||||
Write-Host "Getting Installed Tweaks..."
|
||||
}
|
||||
if ($preferChoco -and $checkbox -eq "winget") {
|
||||
$Checkboxes = Invoke-WinUtilCurrentSystem -CheckBox "choco"
|
||||
}
|
||||
else{
|
||||
|
||||
$Checkboxes = Invoke-WinUtilCurrentSystem -CheckBox $checkbox
|
||||
}
|
||||
|
||||
$sync.form.Dispatcher.invoke({
|
||||
foreach($checkbox in $Checkboxes) {
|
||||
|
@ -1,4 +1,4 @@
|
||||
function Invoke-MicrowinGetIso {
|
||||
function Invoke-WPFGetIso {
|
||||
<#
|
||||
.DESCRIPTION
|
||||
Function to get the path to Iso file for MicroWin, unpack that isom=, read basic information and populate the UI Options
|
||||
@ -50,7 +50,7 @@ function Invoke-MicrowinGetIso {
|
||||
return
|
||||
} else {
|
||||
[System.Windows.MessageBox]::Show("oscdimge.exe is not found on the system, winutil will now attempt do download and install it from github. This might take a long time.")
|
||||
Microwin-GetOscdimg -oscdimgPath $oscdimgPath
|
||||
Get-Oscdimg -oscdimgPath $oscdimgPath
|
||||
$oscdImgFound = Test-Path $oscdimgPath -PathType Leaf
|
||||
if (!$oscdImgFound) {
|
||||
$msg = "oscdimg was not downloaded can not proceed"
|
||||
@ -62,8 +62,6 @@ function Invoke-MicrowinGetIso {
|
||||
}
|
||||
}
|
||||
|
||||
if ($sync["ISOmanual"].IsChecked) {
|
||||
# Open file dialog to let user choose the ISO file
|
||||
[System.Reflection.Assembly]::LoadWithPartialName("System.windows.forms") | Out-Null
|
||||
$openFileDialog = New-Object System.Windows.Forms.OpenFileDialog
|
||||
$openFileDialog.initialDirectory = $initialDirectory
|
||||
@ -76,66 +74,6 @@ function Invoke-MicrowinGetIso {
|
||||
$sync.BusyMessage.Visibility="Hidden"
|
||||
return
|
||||
}
|
||||
} elseif ($sync["ISOdownloader"].IsChecked) {
|
||||
# Create folder browsers for user-specified locations
|
||||
[System.Reflection.Assembly]::LoadWithPartialName("System.Windows.Forms") | Out-Null
|
||||
$isoDownloaderFBD = New-Object System.Windows.Forms.FolderBrowserDialog
|
||||
$isoDownloaderFBD.Description = "Please specify the path to download the ISO file to:"
|
||||
$isoDownloaderFBD.ShowNewFolderButton = $true
|
||||
if ($isoDownloaderFBD.ShowDialog() -ne [System.Windows.Forms.DialogResult]::OK)
|
||||
{
|
||||
return
|
||||
}
|
||||
|
||||
# Grab the location of the selected path
|
||||
$targetFolder = $isoDownloaderFBD.SelectedPath
|
||||
|
||||
# Auto download newest ISO
|
||||
# Credit: https://github.com/pbatard/Fido
|
||||
$fidopath = "$env:temp\Fido.ps1"
|
||||
$originalLocation = $PSScriptRoot
|
||||
|
||||
Invoke-WebRequest "https://github.com/pbatard/Fido/raw/master/Fido.ps1" -OutFile $fidopath
|
||||
|
||||
Set-Location -Path $env:temp
|
||||
# Detect if the first option ("System language") has been selected and get a Fido-approved language from the current culture
|
||||
$lang = if ($sync["ISOLanguage"].SelectedIndex -eq 0) {
|
||||
Microwin-GetLangFromCulture -langName (Get-Culture).Name
|
||||
} else {
|
||||
$sync["ISOLanguage"].SelectedItem
|
||||
}
|
||||
|
||||
& $fidopath -Win 'Windows 11' -Rel $sync["ISORelease"].SelectedItem -Arch "x64" -Lang $lang -Ed "Windows 11 Home/Pro/Edu"
|
||||
if (-not $?)
|
||||
{
|
||||
Write-Host "Could not download the ISO file. Look at the output of the console for more information."
|
||||
$msg = "The ISO file could not be downloaded"
|
||||
[System.Windows.MessageBox]::Show($msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Error)
|
||||
return
|
||||
}
|
||||
Set-Location $originalLocation
|
||||
# Use the FullName property to only grab the file names. Using this property is necessary as, without it, you're passing the usual output of Get-ChildItem
|
||||
# to the variable, and let's be honest, that does NOT exist in the file system
|
||||
$filePath = (Get-ChildItem -Path "$env:temp" -Filter "Win11*.iso").FullName | Sort-Object LastWriteTime -Descending | Select-Object -First 1
|
||||
$fileName = [IO.Path]::GetFileName("$filePath")
|
||||
|
||||
if (($targetFolder -ne "") -and (Test-Path "$targetFolder"))
|
||||
{
|
||||
try
|
||||
{
|
||||
# "Let it download to $env:TEMP and then we **move** it to the file path." - CodingWonders
|
||||
$destinationFilePath = "$targetFolder\$fileName"
|
||||
Write-Host "Moving ISO file. Please wait..."
|
||||
Move-Item -Path "$filePath" -Destination "$destinationFilePath" -Force
|
||||
$filePath = $destinationFilePath
|
||||
}
|
||||
catch
|
||||
{
|
||||
Write-Host "Unable to move the ISO file to the location you specified. The downloaded ISO is in the `"$env:TEMP`" folder"
|
||||
Write-Host "Error information: $($_.Exception.Message)" -ForegroundColor Yellow
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Write-Host "File path $($filePath)"
|
||||
if (-not (Test-Path -Path "$filePath" -PathType Leaf)) {
|
||||
@ -176,7 +114,7 @@ function Invoke-MicrowinGetIso {
|
||||
# @ChrisTitusTech please copy this wiki and change the link below to your copy of the wiki
|
||||
Write-Error "Failed to mount the image. Error: $($_.Exception.Message)"
|
||||
Write-Error "This is NOT winutil's problem, your ISO might be corrupt, or there is a problem on the system"
|
||||
Write-Host "Please refer to this wiki for more details: https://christitustech.github.io/winutil/KnownIssues/#troubleshoot-errors-during-microwin-usage" -ForegroundColor Red
|
||||
Write-Error "Please refer to this wiki for more details https://github.com/ChrisTitusTech/winutil/blob/main/wiki/Error-in-Winutil-MicroWin-during-ISO-mounting%2Cmd"
|
||||
Set-WinUtilTaskbaritem -state "Error" -value 1 -overlay "warning"
|
||||
return
|
||||
}
|
@ -19,59 +19,42 @@ function Invoke-WPFImpex {
|
||||
$Config = $null
|
||||
)
|
||||
|
||||
function ConfigDialog {
|
||||
if (!$Config) {
|
||||
switch ($type) {
|
||||
"export" { $FileBrowser = New-Object System.Windows.Forms.SaveFileDialog }
|
||||
"import" { $FileBrowser = New-Object System.Windows.Forms.OpenFileDialog }
|
||||
if ($type -eq "export") {
|
||||
$FileBrowser = New-Object System.Windows.Forms.SaveFileDialog
|
||||
}
|
||||
if ($type -eq "import") {
|
||||
$FileBrowser = New-Object System.Windows.Forms.OpenFileDialog
|
||||
}
|
||||
|
||||
if (-not $Config) {
|
||||
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
||||
$FileBrowser.Filter = "JSON Files (*.json)|*.json"
|
||||
$FileBrowser.ShowDialog() | Out-Null
|
||||
|
||||
if($FileBrowser.FileName -eq "") {
|
||||
return $null
|
||||
return
|
||||
} else {
|
||||
return $FileBrowser.FileName
|
||||
}
|
||||
} else {
|
||||
return $Config
|
||||
$Config = $FileBrowser.FileName
|
||||
}
|
||||
}
|
||||
|
||||
switch ($type) {
|
||||
"export" {
|
||||
try {
|
||||
$Config = ConfigDialog
|
||||
if ($Config) {
|
||||
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false | ConvertTo-Json
|
||||
$jsonFile | Out-File $Config -Force
|
||||
"iex ""& { `$(irm christitus.com/win) } -Config '$Config'""" | Set-Clipboard
|
||||
if ($type -eq "export") {
|
||||
$jsonFile = Get-WinUtilCheckBoxes -unCheck $false
|
||||
$jsonFile | ConvertTo-Json | Out-File $FileBrowser.FileName -Force
|
||||
}
|
||||
} catch {
|
||||
Write-Error "An error occurred while exporting: $_"
|
||||
}
|
||||
}
|
||||
"import" {
|
||||
try {
|
||||
$Config = ConfigDialog
|
||||
if ($Config) {
|
||||
try {
|
||||
if ($Config -match '^https?://') {
|
||||
$jsonFile = (Invoke-WebRequest "$Config").Content | ConvertFrom-Json
|
||||
} else {
|
||||
if ($type -eq "import") {
|
||||
$jsonFile = Get-Content $Config | ConvertFrom-Json
|
||||
|
||||
$flattenedJson = @()
|
||||
$jsonFile.PSObject.Properties | ForEach-Object {
|
||||
$category = $_.Name
|
||||
foreach ($checkboxName in $_.Value) {
|
||||
if ($category -ne "Install") {
|
||||
$flattenedJson += $checkboxName
|
||||
}
|
||||
} catch {
|
||||
Write-Error "Failed to load the JSON file from the specified path or URL: $_"
|
||||
return
|
||||
}
|
||||
$flattenedJson = $jsonFile.PSObject.Properties.Where({ $_.Name -ne "Install" }).ForEach({ $_.Value })
|
||||
}
|
||||
|
||||
Invoke-WPFPresets -preset $flattenedJson -imported $true
|
||||
}
|
||||
} catch {
|
||||
Write-Error "An error occurred while importing: $_"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -19,9 +19,10 @@ function Invoke-WPFInstall {
|
||||
[System.Windows.MessageBox]::Show($WarningMsg, $AppTitle, [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Warning)
|
||||
return
|
||||
}
|
||||
$ChocoPreference = $($sync.WPFpreferChocolatey.IsChecked)
|
||||
$installHandle = Invoke-WPFRunspace -ParameterList @(("PackagesToInstall", $PackagesToInstall),("ChocoPreference", $ChocoPreference)) -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $ChocoPreference, $DebugPreference)
|
||||
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $DebugPreference)
|
||||
if ($PackagesToInstall.count -eq 1) {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
} else {
|
||||
@ -29,28 +30,16 @@ function Invoke-WPFInstall {
|
||||
}
|
||||
$packagesWinget, $packagesChoco = {
|
||||
$packagesWinget = [System.Collections.ArrayList]::new()
|
||||
$packagesChoco = [System.Collections.ArrayList]::new()
|
||||
|
||||
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||
foreach ($package in $PackagesToInstall) {
|
||||
if ($ChocoPreference) {
|
||||
if ($package.choco -eq "na") {
|
||||
$packagesWinget.add($package.winget)
|
||||
Write-Host "Queueing $($package.winget) for Winget install"
|
||||
} else {
|
||||
$null = $packagesChoco.add($package.choco)
|
||||
Write-Host "Queueing $($package.choco) for Chocolatey install"
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($package.winget -eq "na") {
|
||||
$packagesChoco.add($package.choco)
|
||||
$packagesChoco.add($package)
|
||||
Write-Host "Queueing $($package.choco) for Chocolatey install"
|
||||
} else {
|
||||
$null = $packagesWinget.add($($package.winget))
|
||||
Write-Host "Queueing $($package.winget) for Winget install"
|
||||
}
|
||||
}
|
||||
}
|
||||
return $packagesWinget, $packagesChoco
|
||||
}.Invoke($PackagesToInstall)
|
||||
|
||||
@ -59,12 +48,12 @@ function Invoke-WPFInstall {
|
||||
$errorPackages = @()
|
||||
if($packagesWinget.Count -gt 0) {
|
||||
Install-WinUtilWinget
|
||||
Install-WinUtilProgramWinget -Action Install -Programs $packagesWinget
|
||||
|
||||
$errorPackages += Invoke-WinUtilWingetProgram -Action Install -Programs $packagesWinget
|
||||
$errorPackages| ForEach-Object {if($_.choco -ne "na") {$packagesChoco += $_}}
|
||||
}
|
||||
if($packagesChoco.Count -gt 0) {
|
||||
Install-WinUtilChoco
|
||||
Install-WinUtilProgramChoco -Action Install -Programs $packagesChoco
|
||||
Install-WinUtilProgramChoco -ProgramsToInstall $packagesChoco
|
||||
}
|
||||
Write-Host "==========================================="
|
||||
Write-Host "-- Installs have finished ---"
|
||||
|
@ -2,20 +2,9 @@ function Invoke-WPFInstallUpgrade {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Invokes the function that upgrades all installed programs
|
||||
Invokes the function that upgrades all installed programs using winget
|
||||
|
||||
#>
|
||||
if ($sync.WPFpreferChocolatey.IsChecked) {
|
||||
Install-WinUtilChoco
|
||||
$chocoUpgradeStatus = (Start-Process "choco" -ArgumentList "upgrade all -y" -Wait -PassThru -NoNewWindow).ExitCode
|
||||
if ($chocoUpgradeStatus -eq 0) {
|
||||
Write-Host "Upgrade Successful"
|
||||
}
|
||||
else{
|
||||
Write-Host "Error Occured. Return Code: $chocoUpgradeStatus"
|
||||
}
|
||||
}
|
||||
else{
|
||||
if((Test-WinUtilPackageManager -winget) -eq "not-installed") {
|
||||
return
|
||||
}
|
||||
@ -26,6 +15,8 @@ function Invoke-WPFInstallUpgrade {
|
||||
return
|
||||
}
|
||||
|
||||
# Set-WinUtilTaskbaritem -state "Indeterminate"
|
||||
|
||||
Update-WinUtilProgramWinget
|
||||
|
||||
Write-Host "==========================================="
|
||||
@ -33,4 +24,3 @@ function Invoke-WPFInstallUpgrade {
|
||||
Write-Host "-- You can close this window if desired ---"
|
||||
Write-Host "==========================================="
|
||||
}
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
function Invoke-Microwin {
|
||||
function Invoke-WPFMicrowin {
|
||||
<#
|
||||
.DESCRIPTION
|
||||
Invoke MicroWin routines...
|
||||
@ -51,6 +51,10 @@ public class PowerManagement {
|
||||
$index = $sync.MicrowinWindowsFlavors.SelectedValue.Split(":")[0].Trim()
|
||||
Write-Host "Index chosen: '$index' from $($sync.MicrowinWindowsFlavors.SelectedValue)"
|
||||
|
||||
$keepPackages = $sync.WPFMicrowinKeepProvisionedPackages.IsChecked
|
||||
$keepProvisionedPackages = $sync.WPFMicrowinKeepAppxPackages.IsChecked
|
||||
$keepDefender = $sync.WPFMicrowinKeepDefender.IsChecked
|
||||
$keepEdge = $sync.WPFMicrowinKeepEdge.IsChecked
|
||||
$copyToUSB = $sync.WPFMicrowinCopyToUsb.IsChecked
|
||||
$injectDrivers = $sync.MicrowinInjectDrivers.IsChecked
|
||||
$importDrivers = $sync.MicrowinImportDrivers.IsChecked
|
||||
@ -76,10 +80,9 @@ public class PowerManagement {
|
||||
}
|
||||
|
||||
$imgVersion = (Get-WindowsImage -ImagePath $mountDir\sources\install.wim -Index $index).Version
|
||||
Write-Host "The Windows Image Build Version is: $imgVersion"
|
||||
|
||||
# Detect image version to avoid performing MicroWin processing on Windows 8 and earlier
|
||||
if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,10240,0))) -eq $false) {
|
||||
if ((Test-CompatibleImage $imgVersion $([System.Version]::new(10,0,10240,0))) -eq $false) {
|
||||
$msg = "This image is not compatible with MicroWin processing. Make sure it isn't a Windows 8 or earlier image."
|
||||
$dlg_msg = $msg + "`n`nIf you want more information, the version of the image selected is $($imgVersion)`n`nIf an image has been incorrectly marked as incompatible, report an issue to the developers."
|
||||
Write-Host $msg
|
||||
@ -88,14 +91,6 @@ public class PowerManagement {
|
||||
return
|
||||
}
|
||||
|
||||
# Detect whether the image to process contains Windows 10 and show warning
|
||||
if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,21996,1))) -eq $false) {
|
||||
$msg = "Windows 10 has been detected in the image you want to process. While you can continue, Windows 10 is not a recommended target for MicroWin, and you may not get the full experience."
|
||||
$dlg_msg = $msg
|
||||
Write-Host $msg
|
||||
[System.Windows.MessageBox]::Show($dlg_msg, "Winutil", [System.Windows.MessageBoxButton]::OK, [System.Windows.MessageBoxImage]::Exclamation)
|
||||
}
|
||||
|
||||
$mountDirExists = Test-Path $mountDir
|
||||
$scratchDirExists = Test-Path $scratchDir
|
||||
if (-not $mountDirExists -or -not $scratchDirExists) {
|
||||
@ -156,69 +151,47 @@ public class PowerManagement {
|
||||
}
|
||||
|
||||
Write-Host "Remove Features from the image"
|
||||
Microwin-RemoveFeatures
|
||||
Remove-Features
|
||||
Write-Host "Removing features complete!"
|
||||
Write-Host "Removing OS packages"
|
||||
Microwin-RemovePackages
|
||||
Remove-Packages
|
||||
Write-Host "Removing Appx Bloat"
|
||||
Microwin-RemoveProvisionedPackages
|
||||
Remove-ProvisionedPackages
|
||||
|
||||
# Detect Windows 11 24H2 and add dependency to FileExp to prevent Explorer look from going back - thanks @WitherOrNot and @thecatontheceiling
|
||||
if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,26100,1))) -eq $true) {
|
||||
try {
|
||||
if (Test-Path "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" -PathType Leaf) {
|
||||
# Found the culprit. Do the following:
|
||||
# 1. Take ownership of the file, from TrustedInstaller to Administrators
|
||||
takeown /F "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" /A
|
||||
# 2. Set ACLs so that we can write to it
|
||||
icacls "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" /grant "$(Microwin-GetLocalizedUsers -admins $true):(M)" | Out-Host
|
||||
# 3. Open the file and do the modification
|
||||
$appxManifest = Get-Content -Path "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml"
|
||||
$originalLine = $appxManifest[13]
|
||||
$dependency = "`n <PackageDependency Name=`"Microsoft.WindowsAppRuntime.CBS`" MinVersion=`"1.0.0.0`" Publisher=`"CN=Microsoft Corporation, O=Microsoft Corporation, L=Redmond, S=Washington, C=US`" />"
|
||||
$appxManifest[13] = "$originalLine$dependency"
|
||||
Set-Content -Path "$scratchDir\Windows\SystemApps\MicrosoftWindows.Client.FileExp_cw5n1h2txyewy\appxmanifest.xml" -Value $appxManifest -Force -Encoding utf8
|
||||
}
|
||||
}
|
||||
catch {
|
||||
# Do nothing
|
||||
}
|
||||
}
|
||||
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\DiagTrack" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\InboxApps" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LocationNotificationWindows.exe"
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Photo Viewer" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Photo Viewer" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Media Player" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Media Player" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Mail" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Mail" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Internet Explorer" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Internet Explorer" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\GameBarPresenceWriter"
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\OneDriveSetup.exe"
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\OneDrive.ico"
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*narratorquickstart*" -Directory
|
||||
Microwin-RemoveFileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*ParentalControls*" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LogFiles\WMI\RtBackup" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\DiagTrack" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\InboxApps" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\LocationNotificationWindows.exe"
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Photo Viewer" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Photo Viewer" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Media Player" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Media Player" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Windows Mail" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Windows Mail" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files (x86)\Internet Explorer" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Program Files\Internet Explorer" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\GameBarPresenceWriter"
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\OneDriveSetup.exe"
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\System32\OneDrive.ico"
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*narratorquickstart*" -Directory
|
||||
Remove-FileOrDirectory -pathToDelete "$($scratchDir)\Windows\SystemApps" -mask "*ParentalControls*" -Directory
|
||||
Write-Host "Removal complete!"
|
||||
|
||||
Write-Host "Create unattend.xml"
|
||||
|
||||
#New-Unattend
|
||||
if ($sync.MicrowinUserName.Text -eq "")
|
||||
{
|
||||
Microwin-NewUnattend -userName "User"
|
||||
New-Unattend -userName "User"
|
||||
}
|
||||
else
|
||||
{
|
||||
if ($sync.MicrowinUserPassword.Password -eq "")
|
||||
{
|
||||
Microwin-NewUnattend -userName "$($sync.MicrowinUserName.Text)"
|
||||
New-Unattend -userName "$($sync.MicrowinUserName.Text)"
|
||||
}
|
||||
else
|
||||
{
|
||||
Microwin-NewUnattend -userName "$($sync.MicrowinUserName.Text)" -userPassword "$($sync.MicrowinUserPassword.Password)"
|
||||
New-Unattend -userName "$($sync.MicrowinUserName.Text)" -userPassword "$($sync.MicrowinUserPassword.Password)"
|
||||
}
|
||||
}
|
||||
Write-Host "Done Create unattend.xml"
|
||||
@ -231,7 +204,7 @@ public class PowerManagement {
|
||||
Write-Host "Done Copy unattend.xml"
|
||||
|
||||
Write-Host "Create FirstRun"
|
||||
Microwin-NewFirstRun
|
||||
New-FirstRun
|
||||
Write-Host "Done create FirstRun"
|
||||
Write-Host "Copy FirstRun.ps1 into the ISO"
|
||||
Copy-Item "$env:temp\FirstStartup.ps1" "$($scratchDir)\Windows\FirstStartup.ps1" -force
|
||||
@ -243,7 +216,7 @@ public class PowerManagement {
|
||||
dism /English /image:$($scratchDir) /set-profilepath:"$($scratchDir)\Windows\Users\Default"
|
||||
|
||||
Write-Host "Copy checkinstall.cmd into the ISO"
|
||||
Microwin-NewCheckInstall
|
||||
New-CheckInstall
|
||||
Copy-Item "$env:temp\checkinstall.cmd" "$($scratchDir)\Windows\checkinstall.cmd" -force
|
||||
Write-Host "Done copy checkinstall.cmd"
|
||||
|
||||
@ -265,9 +238,6 @@ public class PowerManagement {
|
||||
# Write-Host Error code $LASTEXITCODE
|
||||
Write-Host "Done disabling Teams"
|
||||
|
||||
Write-Host "Fix Windows Volume Mixer Issue"
|
||||
reg add "HKLM\zNTUSER\Software\Microsoft\Internet Explorer\LowRegistry\Audio\PolicyConfig\PropertyStore" /f
|
||||
|
||||
Write-Host "Bypassing system requirements (system image)"
|
||||
reg add "HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV1" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\zDEFAULT\Control Panel\UnsupportedHardwareNotificationCache" /v "SV2" /t REG_DWORD /d 0 /f
|
||||
@ -293,8 +263,11 @@ public class PowerManagement {
|
||||
# reg delete "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\WindowsUpdate\Orchestrator\UScheduler\$_" /f | Out-Null
|
||||
|
||||
# When in Offline Image
|
||||
if (Test-Path "HKLM:\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\$_")
|
||||
{
|
||||
reg delete "HKLM\zSOFTWARE\Microsoft\WindowsUpdate\Orchestrator\UScheduler_Oobe\$_" /f | Out-Null
|
||||
}
|
||||
}
|
||||
|
||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "SearchboxTaskbarMode" /t REG_DWORD /d 0 /f
|
||||
Write-Host "Setting all services to start manually"
|
||||
@ -319,19 +292,6 @@ public class PowerManagement {
|
||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "AppsUseLightTheme" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\zSOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize" /v "SystemUsesLightTheme" /t REG_DWORD /d 0 /f
|
||||
|
||||
if ((Microwin-TestCompatibleImage $imgVersion $([System.Version]::new(10,0,21996,1))) -eq $false) {
|
||||
# We're dealing with Windows 10. Configure sane desktop settings. NOTE: even though stuff to disable News and Interests is there,
|
||||
# it doesn't seem to work, and I don't want to waste more time dealing with an operating system that will lose support in a year (2025)
|
||||
|
||||
# I invite anyone to work on improving stuff for News and Interests, but that won't be me!
|
||||
|
||||
Write-Host "Disabling Search Highlights..."
|
||||
reg add "HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Feeds\DSB" /v "ShowDynamicContent" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\SearchSettings" /v "IsDynamicSearchBoxEnabled" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\zSOFTWARE\Policies\Microsoft\Dsh" /v "AllowNewsAndInterests" /t REG_DWORD /d 0 /f
|
||||
reg add "HKLM\zNTUSER\SOFTWARE\Microsoft\Windows\CurrentVersion\Search" /v "TraySearchBoxVisible" /t REG_DWORD /d 1 /f
|
||||
}
|
||||
|
||||
} catch {
|
||||
Write-Error "An unexpected error occurred: $_"
|
||||
} finally {
|
||||
@ -431,7 +391,7 @@ public class PowerManagement {
|
||||
|
||||
if ($copyToUSB) {
|
||||
Write-Host "Copying target ISO to the USB drive"
|
||||
Microwin-CopyToUSB("$($SaveDialog.FileName)")
|
||||
Copy-ToUSB("$($SaveDialog.FileName)")
|
||||
if ($?) { Write-Host "Done Copying target ISO to USB drive!" } else { Write-Host "ISO copy failed." }
|
||||
}
|
||||
|
@ -10,20 +10,14 @@ function Invoke-WPFPresets {
|
||||
.PARAMETER imported
|
||||
If the preset is imported from a file, defaults to false
|
||||
|
||||
.PARAMETER checkboxfilterpattern
|
||||
The Pattern to use when filtering through CheckBoxes, defaults to "**"
|
||||
.PARAMETER checkbox
|
||||
The checkbox to set the options to, defaults to 'WPFTweaks'
|
||||
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(position=0)]
|
||||
[Array]$preset = "",
|
||||
|
||||
[Parameter(position=1)]
|
||||
[bool]$imported = $false,
|
||||
|
||||
[Parameter(position=2)]
|
||||
[string]$checkboxfilterpattern = "**"
|
||||
$preset,
|
||||
[bool]$imported = $false
|
||||
)
|
||||
|
||||
if($imported -eq $true) {
|
||||
@ -32,14 +26,13 @@ function Invoke-WPFPresets {
|
||||
$CheckBoxesToCheck = $sync.configs.preset.$preset
|
||||
}
|
||||
|
||||
$CheckBoxes = ($sync.GetEnumerator()).where{ $_.Value -is [System.Windows.Controls.CheckBox] -and $_.Name -notlike "WPFToggle*" -and $_.Name -like "$checkboxfilterpattern"}
|
||||
Write-Debug "Getting checkboxes to set, number of checkboxes: $($CheckBoxes.Count)"
|
||||
$CheckBoxes = $sync.GetEnumerator() | Where-Object { $_.Value -is [System.Windows.Controls.CheckBox] -and $_.Name -notlike "WPFToggle*" }
|
||||
Write-Debug "Getting checkboxes to set $($CheckBoxes.Count)"
|
||||
|
||||
if ($CheckBoxesToCheck -ne "") {
|
||||
$debugMsg = "CheckBoxes to Check are: "
|
||||
$CheckBoxesToCheck | ForEach-Object { $debugMsg += "$_, " }
|
||||
$debugMsg = $debugMsg -replace (',\s*$', '')
|
||||
Write-Debug "$debugMsg"
|
||||
$CheckBoxesToCheck | ForEach-Object {
|
||||
if ($_ -ne $null) {
|
||||
Write-Debug $_
|
||||
}
|
||||
}
|
||||
|
||||
foreach ($CheckBox in $CheckBoxes) {
|
||||
@ -51,7 +44,7 @@ function Invoke-WPFPresets {
|
||||
}
|
||||
|
||||
# Check if the checkbox name exists in the flattened JSON hashtable
|
||||
if ($CheckBoxesToCheck -contains $checkboxName) {
|
||||
if ($CheckBoxesToCheck.Contains($checkboxName)) {
|
||||
# If it exists, set IsChecked to true
|
||||
$sync.$checkboxName.IsChecked = $true
|
||||
Write-Debug "$checkboxName is checked"
|
||||
|
@ -11,23 +11,17 @@ function Invoke-WPFRunspace {
|
||||
.PARAMETER ArgumentList
|
||||
A list of arguments to pass to the runspace
|
||||
|
||||
.PARAMETER ParameterList
|
||||
A list of named parameters that should be provided.
|
||||
.EXAMPLE
|
||||
Invoke-WPFRunspace `
|
||||
-ScriptBlock $sync.ScriptsInstallPrograms `
|
||||
-ArgumentList "Installadvancedip,Installbitwarden" `
|
||||
|
||||
Invoke-WPFRunspace`
|
||||
-ScriptBlock $sync.ScriptsInstallPrograms `
|
||||
-ParameterList @(("PackagesToInstall", @("Installadvancedip,Installbitwarden")),("ChocoPreference", $true))
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
Param (
|
||||
$ScriptBlock,
|
||||
$ArgumentList,
|
||||
$ParameterList,
|
||||
$DebugPreference
|
||||
)
|
||||
|
||||
@ -37,10 +31,6 @@ function Invoke-WPFRunspace {
|
||||
# Add Scriptblock and Arguments to runspace
|
||||
$script:powershell.AddScript($ScriptBlock)
|
||||
$script:powershell.AddArgument($ArgumentList)
|
||||
|
||||
foreach ($parameter in $ParameterList) {
|
||||
$script:powershell.AddParameter($parameter[0], $parameter[1])
|
||||
}
|
||||
$script:powershell.AddArgument($DebugPreference) # Pass DebugPreference to the script block
|
||||
$script:powershell.RunspacePool = $sync.runspace
|
||||
|
||||
@ -55,6 +45,4 @@ function Invoke-WPFRunspace {
|
||||
$sync.runspace.Close()
|
||||
[System.GC]::Collect()
|
||||
}
|
||||
# Return the handle
|
||||
return $handle
|
||||
}
|
||||
|
69
functions/public/Invoke-WPFShortcut.ps1
Normal file
69
functions/public/Invoke-WPFShortcut.ps1
Normal file
@ -0,0 +1,69 @@
|
||||
function Invoke-WPFShortcut {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Creates a shortcut and prompts for a save location
|
||||
|
||||
.PARAMETER ShortcutToAdd
|
||||
The name of the shortcut to add
|
||||
|
||||
.PARAMETER RunAsAdmin
|
||||
A boolean value to make 'Run as administrator' property on (true) or off (false), defaults to off
|
||||
|
||||
#>
|
||||
param(
|
||||
$ShortcutToAdd,
|
||||
[bool]$RunAsAdmin = $false
|
||||
)
|
||||
|
||||
# Preper the Shortcut Fields and add an a Custom Icon if it's available, else don't add a Custom Icon.
|
||||
|
||||
Switch ($ShortcutToAdd) {
|
||||
"WinUtil" {
|
||||
# Use Powershell 7 if installed and fallback to PS5 if not
|
||||
if (Get-Command "pwsh" -ErrorAction SilentlyContinue) {
|
||||
$shell = "pwsh.exe"
|
||||
} else {
|
||||
$shell = "powershell.exe"
|
||||
}
|
||||
|
||||
$shellArgs = "-ExecutionPolicy Bypass -Command `"Start-Process $shell -verb runas -ArgumentList `'-Command `"irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1 | iex`"`'"
|
||||
|
||||
$DestinationName = "WinUtil.lnk"
|
||||
}
|
||||
}
|
||||
|
||||
# Show a File Dialog Browser, to let the User choose the Name and Location of where to save the Shortcut
|
||||
$FileBrowser = New-Object System.Windows.Forms.SaveFileDialog
|
||||
$FileBrowser.InitialDirectory = [Environment]::GetFolderPath('Desktop')
|
||||
$FileBrowser.Filter = "Shortcut Files (*.lnk)|*.lnk"
|
||||
$FileBrowser.FileName = $DestinationName
|
||||
|
||||
# Do an Early Return if the Save Operation was canceled by User's Input.
|
||||
$FileBrowserResult = $FileBrowser.ShowDialog()
|
||||
$DialogResultEnum = New-Object System.Windows.Forms.DialogResult
|
||||
if (-not ($FileBrowserResult -eq $DialogResultEnum::OK)) {
|
||||
return
|
||||
}
|
||||
|
||||
# Prepare the Shortcut paramter
|
||||
$WshShell = New-Object -comObject WScript.Shell
|
||||
$Shortcut = $WshShell.CreateShortcut($FileBrowser.FileName)
|
||||
$Shortcut.TargetPath = $shell
|
||||
$Shortcut.Arguments = $shellArgs
|
||||
if (Test-Path -Path $winutildir["logo.ico"]) {
|
||||
$shortcut.IconLocation = $winutildir["logo.ico"]
|
||||
}
|
||||
|
||||
# Save the Shortcut to disk
|
||||
$Shortcut.Save()
|
||||
|
||||
if ($RunAsAdmin -eq $true) {
|
||||
$bytes = [System.IO.File]::ReadAllBytes($FileBrowser.FileName)
|
||||
# Set byte value at position 0x15 in hex, or 21 in decimal, from the value 0x00 to 0x20 in hex
|
||||
$bytes[0x15] = $bytes[0x15] -bor 0x20
|
||||
[System.IO.File]::WriteAllBytes($FileBrowser.FileName, $bytes)
|
||||
}
|
||||
|
||||
Write-Host "Shortcut for $ShortcutToAdd has been saved to $($FileBrowser.FileName) with 'Run as administrator' set to $RunAsAdmin"
|
||||
}
|
@ -10,18 +10,17 @@ function Invoke-WPFTab {
|
||||
|
||||
#>
|
||||
|
||||
Param (
|
||||
[Parameter(Mandatory,position=0)]
|
||||
[string]$ClickedTab
|
||||
)
|
||||
Param ($ClickedTab)
|
||||
|
||||
$tabNav = Get-WinUtilVariables | Where-Object {$psitem -like "WPFTabNav"}
|
||||
$tabNumber = [int]($ClickedTab -replace "WPFTab","" -replace "BT","") - 1
|
||||
|
||||
$filter = Get-WinUtilVariables -Type ToggleButton | Where-Object {$psitem -like "WPFTab?BT"}
|
||||
($sync.GetEnumerator()).where{$psitem.Key -in $filter} | ForEach-Object {
|
||||
$sync.GetEnumerator() | Where-Object {$psitem.Key -in $filter} | ForEach-Object {
|
||||
if ($ClickedTab -ne $PSItem.name) {
|
||||
$sync[$PSItem.Name].IsChecked = $false
|
||||
# $tabNumber = [int]($PSItem.Name -replace "WPFTab","" -replace "BT","") - 1
|
||||
# $sync.$tabNav.Items[$tabNumber].IsSelected = $false
|
||||
} else {
|
||||
$sync["$ClickedTab"].IsChecked = $true
|
||||
$tabNumber = [int]($ClickedTab-replace "WPFTab","" -replace "BT","") - 1
|
||||
|
@ -15,25 +15,23 @@ function Invoke-WPFToggle {
|
||||
# Use this to get the name of the button
|
||||
#[System.Windows.MessageBox]::Show("$Button","Chris Titus Tech's Windows Utility","OK","Info")
|
||||
|
||||
$ToggleStatus = (Get-WinUtilToggleStatus $Button)
|
||||
|
||||
Switch -Wildcard ($Button) {
|
||||
|
||||
"WPFToggleDarkMode" {Invoke-WinUtilDarkMode $ToggleStatus}
|
||||
"WPFToggleBingSearch" {Invoke-WinUtilBingSearch $ToggleStatus}
|
||||
"WPFToggleNumLock" {Invoke-WinUtilNumLock $ToggleStatus}
|
||||
"WPFToggleVerboseLogon" {Invoke-WinUtilVerboseLogon $ToggleStatus}
|
||||
"WPFToggleShowExt" {Invoke-WinUtilShowExt $ToggleStatus}
|
||||
"WPFToggleSnapWindow" {Invoke-WinUtilSnapWindow $ToggleStatus}
|
||||
"WPFToggleSnapFlyout" {Invoke-WinUtilSnapFlyout $ToggleStatus}
|
||||
"WPFToggleSnapSuggestion" {Invoke-WinUtilSnapSuggestion $ToggleStatus}
|
||||
"WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $ToggleStatus}
|
||||
"WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $ToggleStatus}
|
||||
"WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $ToggleStatus}
|
||||
"WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $ToggleStatus}
|
||||
"WPFToggleTaskView" {Invoke-WinUtilTaskView $ToggleStatus}
|
||||
"WPFToggleHiddenFiles" {Invoke-WinUtilHiddenFiles $ToggleStatus}
|
||||
"WPFToggleTaskbarAlignment" {Invoke-WinUtilTaskbarAlignment $ToggleStatus}
|
||||
"WPFToggleDetailedBSoD" {Invoke-WinUtilDetailedBSoD $ToggleStatus}
|
||||
"WPFToggleDarkMode" {Invoke-WinUtilDarkMode -DarkMoveEnabled $(Get-WinUtilToggleStatus WPFToggleDarkMode)}
|
||||
"WPFToggleBingSearch" {Invoke-WinUtilBingSearch $(Get-WinUtilToggleStatus WPFToggleBingSearch)}
|
||||
"WPFToggleNumLock" {Invoke-WinUtilNumLock $(Get-WinUtilToggleStatus WPFToggleNumLock)}
|
||||
"WPFToggleVerboseLogon" {Invoke-WinUtilVerboseLogon $(Get-WinUtilToggleStatus WPFToggleVerboseLogon)}
|
||||
"WPFToggleShowExt" {Invoke-WinUtilShowExt $(Get-WinUtilToggleStatus WPFToggleShowExt)}
|
||||
"WPFToggleSnapWindow" {Invoke-WinUtilSnapWindow $(Get-WinUtilToggleStatus WPFToggleSnapWindow)}
|
||||
"WPFToggleSnapFlyout" {Invoke-WinUtilSnapFlyout $(Get-WinUtilToggleStatus WPFToggleSnapFlyout)}
|
||||
"WPFToggleSnapSuggestion" {Invoke-WinUtilSnapSuggestion $(Get-WinUtilToggleStatus WPFToggleSnapSuggestion)}
|
||||
"WPFToggleMouseAcceleration" {Invoke-WinUtilMouseAcceleration $(Get-WinUtilToggleStatus WPFToggleMouseAcceleration)}
|
||||
"WPFToggleStickyKeys" {Invoke-WinUtilStickyKeys $(Get-WinUtilToggleStatus WPFToggleStickyKeys)}
|
||||
"WPFToggleTaskbarWidgets" {Invoke-WinUtilTaskbarWidgets $(Get-WinUtilToggleStatus WPFToggleTaskbarWidgets)}
|
||||
"WPFToggleTaskbarSearch" {Invoke-WinUtilTaskbarSearch $(Get-WinUtilToggleStatus WPFToggleTaskbarSearch)}
|
||||
"WPFToggleTaskView" {Invoke-WinUtilTaskView $(Get-WinUtilToggleStatus WPFToggleTaskView)}
|
||||
"WPFToggleHiddenFiles" {Invoke-WinUtilHiddenFiles $(Get-WinUtilToggleStatus WPFToggleHiddenFiles)}
|
||||
"WPFToggleTaskbarAlignment" {Invoke-WinUtilTaskbarAlignment $(Get-WinUtilToggleStatus WPFToggleTaskbarAlignment)}
|
||||
"WPFToggleDetailedBSoD" {Invoke-WinUtilDetailedBSoD $(Get-WinUtilToggleStatus WPFToggleDetailedBSoD)}
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,7 @@ function Invoke-WPFTweakPS7{
|
||||
Write-Host "Powershell 7 is already installed."
|
||||
} else {
|
||||
Write-Host "Installing Powershell 7..."
|
||||
Install-WinUtilProgramWinget -Action Install -Programs @("Microsoft.PowerShell")
|
||||
Invoke-WinUtilWingetProgram -Action Install -Programs @("Microsoft.PowerShell")
|
||||
}
|
||||
$targetTerminalName = "PowerShell"
|
||||
}
|
||||
|
@ -15,43 +15,17 @@ function Invoke-WPFUIElements {
|
||||
#>
|
||||
|
||||
param(
|
||||
[Parameter(Mandatory, position=0)]
|
||||
[Parameter(Mandatory)]
|
||||
[PSCustomObject]$configVariable,
|
||||
|
||||
[Parameter(Mandatory, position=1)]
|
||||
[Parameter(Mandatory)]
|
||||
[string]$targetGridName,
|
||||
|
||||
[Parameter(Mandatory, position=2)]
|
||||
[Parameter(Mandatory)]
|
||||
[int]$columncount
|
||||
)
|
||||
|
||||
$window = $sync["Form"]
|
||||
|
||||
$theme = $sync.Form.Resources
|
||||
$borderstyle = $window.FindResource("BorderStyle")
|
||||
$HoverTextBlockStyle = $window.FindResource("HoverTextBlockStyle")
|
||||
$ColorfulToggleSwitchStyle = $window.FindResource("ColorfulToggleSwitchStyle")
|
||||
|
||||
if (!$borderstyle -or !$HoverTextBlockStyle -or !$ColorfulToggleSwitchStyle) {
|
||||
throw "Failed to retrieve Styles using 'FindResource' from main window element."
|
||||
}
|
||||
|
||||
$targetGrid = $window.FindName($targetGridName)
|
||||
|
||||
if (!$targetGrid) {
|
||||
throw "Failed to retrieve Target Grid by name, provided name: $targetGrid"
|
||||
}
|
||||
|
||||
# Clear existing ColumnDefinitions and Children
|
||||
$targetGrid.ColumnDefinitions.Clear() | Out-Null
|
||||
$targetGrid.Children.Clear() | Out-Null
|
||||
|
||||
# Add ColumnDefinitions to the target Grid
|
||||
for ($i = 0; $i -lt $columncount; $i++) {
|
||||
$colDef = New-Object Windows.Controls.ColumnDefinition
|
||||
$colDef.Width = New-Object Windows.GridLength(1, [Windows.GridUnitType]::Star)
|
||||
$targetGrid.ColumnDefinitions.Add($colDef) | Out-Null
|
||||
}
|
||||
$theme = $sync.configs.themes.$ctttheme
|
||||
|
||||
# Convert PSCustomObject to Hashtable
|
||||
$configHashtable = @{}
|
||||
@ -91,6 +65,22 @@ function Invoke-WPFUIElements {
|
||||
|
||||
# Store application data in an array under the category
|
||||
$organizedData[$entryObject.Panel][$entryObject.Category] += $entryObject
|
||||
}
|
||||
|
||||
# Retrieve the main window and the target Grid by name
|
||||
$window = $sync["Form"]
|
||||
$targetGrid = $window.FindName($targetGridName)
|
||||
|
||||
# Clear existing ColumnDefinitions and Children
|
||||
$targetGrid.ColumnDefinitions.Clear() | Out-Null
|
||||
$targetGrid.Children.Clear() | Out-Null
|
||||
|
||||
# Add ColumnDefinitions to the target Grid
|
||||
for ($i = 0; $i -lt $columncount; $i++) {
|
||||
$colDef = New-Object Windows.Controls.ColumnDefinition
|
||||
$colDef.Width = New-Object Windows.GridLength(1, [Windows.GridUnitType]::Star)
|
||||
$targetGrid.ColumnDefinitions.Add($colDef) | Out-Null
|
||||
}
|
||||
|
||||
# Only apply the logic for distributing entries across columns if the targetGridName is "appspanel"
|
||||
if ($targetGridName -eq "appspanel") {
|
||||
@ -98,7 +88,6 @@ function Invoke-WPFUIElements {
|
||||
$entrycount = $configHashtable.Keys.Count + $organizedData["0"].Keys.Count
|
||||
$maxcount = [Math]::Round($entrycount / $columncount + 0.5)
|
||||
}
|
||||
}
|
||||
|
||||
# Iterate through 'organizedData' by panel, category, and application
|
||||
$count = 0
|
||||
@ -107,7 +96,7 @@ function Invoke-WPFUIElements {
|
||||
$border = New-Object Windows.Controls.Border
|
||||
$border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically
|
||||
[System.Windows.Controls.Grid]::SetColumn($border, $panelcount)
|
||||
$border.style = $borderstyle
|
||||
$border.style = $window.FindResource("BorderStyle")
|
||||
$targetGrid.Children.Add($border) | Out-Null
|
||||
|
||||
# Create a StackPanel inside the Border
|
||||
@ -127,7 +116,7 @@ function Invoke-WPFUIElements {
|
||||
$border = New-Object Windows.Controls.Border
|
||||
$border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically
|
||||
[System.Windows.Controls.Grid]::SetColumn($border, $panelcount)
|
||||
$border.style = $borderstyle
|
||||
$border.style = $window.FindResource("BorderStyle")
|
||||
$targetGrid.Children.Add($border) | Out-Null
|
||||
|
||||
# Create a new StackPanel inside the Border
|
||||
@ -159,7 +148,7 @@ function Invoke-WPFUIElements {
|
||||
$border = New-Object Windows.Controls.Border
|
||||
$border.VerticalAlignment = "Stretch" # Ensure the border stretches vertically
|
||||
[System.Windows.Controls.Grid]::SetColumn($border, $panelcount)
|
||||
$border.style = $borderstyle
|
||||
$border.style = $window.FindResource("BorderStyle")
|
||||
$targetGrid.Children.Add($border) | Out-Null
|
||||
|
||||
# Create a new StackPanel inside the Border
|
||||
@ -179,14 +168,13 @@ function Invoke-WPFUIElements {
|
||||
$checkBox.Name = $entryInfo.Name
|
||||
$checkBox.HorizontalAlignment = "Right"
|
||||
$dockPanel.Children.Add($checkBox) | Out-Null
|
||||
$checkBox.Style = $ColorfulToggleSwitchStyle
|
||||
$checkBox.Style = $window.FindResource("ColorfulToggleSwitchStyle")
|
||||
|
||||
$label = New-Object Windows.Controls.Label
|
||||
$label.Content = $entryInfo.Content
|
||||
$label.ToolTip = $entryInfo.Description
|
||||
$label.HorizontalAlignment = "Left"
|
||||
$label.FontSize = $theme.FontSize
|
||||
$label.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
|
||||
$dockPanel.Children.Add($label) | Out-Null
|
||||
$stackPanel.Children.Add($dockPanel) | Out-Null
|
||||
|
||||
@ -207,14 +195,14 @@ function Invoke-WPFUIElements {
|
||||
$toggleButton.HorizontalAlignment = "Left"
|
||||
$toggleButton.Height = $theme.TabButtonHeight
|
||||
$toggleButton.Width = $theme.TabButtonWidth
|
||||
$toggleButton.SetResourceReference([Windows.Controls.Control]::BackgroundProperty, "ButtonInstallBackgroundColor")
|
||||
$toggleButton.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "MainForegroundColor")
|
||||
$toggleButton.Background = $theme.ButtonInstallBackgroundColor
|
||||
$toggleButton.Foreground = [Windows.Media.Brushes]::White
|
||||
$toggleButton.FontWeight = [Windows.FontWeights]::Bold
|
||||
|
||||
$textBlock = New-Object Windows.Controls.TextBlock
|
||||
$textBlock.FontSize = $theme.TabButtonFontSize
|
||||
$textBlock.Background = [Windows.Media.Brushes]::Transparent
|
||||
$textBlock.SetResourceReference([Windows.Controls.Control]::ForegroundProperty, "ButtonInstallForegroundColor")
|
||||
$textBlock.Foreground = $theme.ButtonInstallForegroundColor
|
||||
|
||||
$underline = New-Object Windows.Documents.Underline
|
||||
$underline.Inlines.Add($entryInfo.name -replace "(.).*", "`$1")
|
||||
@ -250,7 +238,7 @@ function Invoke-WPFUIElements {
|
||||
$comboBox.Width = $theme.ButtonWidth
|
||||
$comboBox.HorizontalAlignment = "Left"
|
||||
$comboBox.VerticalAlignment = "Center"
|
||||
$comboBox.Margin = $theme.ButtonMargin
|
||||
$comboBox.Margin = "5,5"
|
||||
|
||||
foreach ($comboitem in ($entryInfo.ComboItems -split " ")) {
|
||||
$comboBoxItem = New-Object Windows.Controls.ComboBoxItem
|
||||
@ -272,7 +260,8 @@ function Invoke-WPFUIElements {
|
||||
$button.Name = $entryInfo.Name
|
||||
$button.Content = $entryInfo.Content
|
||||
$button.HorizontalAlignment = "Left"
|
||||
$button.Margin = $theme.ButtonMargin
|
||||
$button.Margin = "5"
|
||||
$button.Padding = "20,5"
|
||||
$button.FontSize = $theme.ButtonFontSize
|
||||
if ($entryInfo.ButtonWidth) {
|
||||
$button.Width = $entryInfo.ButtonWidth
|
||||
@ -292,7 +281,7 @@ function Invoke-WPFUIElements {
|
||||
$checkBox.FontSize = $theme.FontSize
|
||||
$checkBox.ToolTip = $entryInfo.Description
|
||||
$checkBox.Margin = $theme.CheckBoxMargin
|
||||
if ($entryInfo.Checked -eq $true) {
|
||||
if ($entryInfo.Checked) {
|
||||
$checkBox.IsChecked = $entryInfo.Checked
|
||||
}
|
||||
$horizontalStackPanel.Children.Add($checkBox) | Out-Null
|
||||
@ -302,7 +291,14 @@ function Invoke-WPFUIElements {
|
||||
$textBlock.Name = $checkBox.Name + "Link"
|
||||
$textBlock.Text = "(?)"
|
||||
$textBlock.ToolTip = $entryInfo.Link
|
||||
$textBlock.Style = $HoverTextBlockStyle
|
||||
$textBlock.Style = $window.FindResource("HoverTextBlockStyle")
|
||||
|
||||
# Add event handler for click to open link
|
||||
$handler = [System.Windows.Input.MouseButtonEventHandler]{
|
||||
param($sender, $e)
|
||||
Start-Process $sender.ToolTip.ToString()
|
||||
}
|
||||
$textBlock.AddHandler([Windows.Controls.TextBlock]::MouseLeftButtonUpEvent, $handler)
|
||||
|
||||
$horizontalStackPanel.Children.Add($textBlock) | Out-Null
|
||||
|
||||
|
@ -2,65 +2,43 @@ Function Invoke-WPFUltimatePerformance {
|
||||
<#
|
||||
|
||||
.SYNOPSIS
|
||||
Enables or disables the Ultimate Performance power scheme based on its GUID.
|
||||
Creates or removes the Ultimate Performance power scheme
|
||||
|
||||
.PARAMETER State
|
||||
Specifies whether to "Enable" or "Disable" the Ultimate Performance power scheme.
|
||||
Indicates whether to enable or disable the Ultimate Performance power scheme
|
||||
|
||||
#>
|
||||
param($State)
|
||||
|
||||
try {
|
||||
# GUID of the Ultimate Performance power plan
|
||||
$ultimateGUID = "e9a42b02-d5df-448d-aa00-03f14749eb61"
|
||||
|
||||
if ($State -eq "Enable") {
|
||||
# Duplicate the Ultimate Performance power plan using its GUID
|
||||
$duplicateOutput = powercfg /duplicatescheme $ultimateGUID
|
||||
|
||||
$guid = $null
|
||||
$nameFromFile = "ChrisTitus - Ultimate Power Plan"
|
||||
$description = "Ultimate Power Plan, added via WinUtils"
|
||||
|
||||
# Extract the new GUID from the duplicateOutput
|
||||
foreach ($line in $duplicateOutput) {
|
||||
if ($line -match "\b[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}\b") {
|
||||
$guid = $matches[0] # $matches[0] will contain the first match, which is the GUID
|
||||
Write-Output "GUID: $guid has been extracted and stored in the variable."
|
||||
break
|
||||
}
|
||||
# Check if Ultimate Performance plan is installed
|
||||
$ultimatePlan = powercfg -list | Select-String -Pattern "Ultimate Performance"
|
||||
if($state -eq "Enable") {
|
||||
if ($ultimatePlan) {
|
||||
Write-Host "Ultimate Performance plan is already installed."
|
||||
} else {
|
||||
Write-Host "Installing Ultimate Performance plan..."
|
||||
powercfg -duplicatescheme e9a42b02-d5df-448d-aa00-03f14749eb61
|
||||
Write-Host "> Ultimate Performance plan installed."
|
||||
}
|
||||
|
||||
if (-not $guid) {
|
||||
Write-Output "No GUID found in the duplicateOutput. Check the output format."
|
||||
exit 1
|
||||
# Set the Ultimate Performance plan as active
|
||||
$ultimatePlanGUID = (powercfg -list | Select-String -Pattern "Ultimate Performance").Line.Split()[3]
|
||||
powercfg -setactive $ultimatePlanGUID
|
||||
|
||||
Write-Host "Ultimate Performance plan is now active."
|
||||
|
||||
|
||||
}
|
||||
|
||||
# Change the name of the power plan and set its description
|
||||
$changeNameOutput = powercfg /changename $guid "$nameFromFile" "$description"
|
||||
Write-Output "The power plan name and description have been changed. Output:"
|
||||
Write-Output $changeNameOutput
|
||||
|
||||
# Set the duplicated Ultimate Performance plan as active
|
||||
$setActiveOutput = powercfg /setactive $guid
|
||||
Write-Output "The power plan has been set as active. Output:"
|
||||
Write-Output $setActiveOutput
|
||||
|
||||
Write-Host "> Ultimate Performance plan installed and set as active."
|
||||
|
||||
} elseif ($State -eq "Disable") {
|
||||
# Check if the Ultimate Performance plan is installed by GUID
|
||||
$installedPlan = (powercfg -list | Select-String -Pattern "ChrisTitus - Ultimate Power Plan").Line.Split()[3]
|
||||
|
||||
if ($installedPlan) {
|
||||
# Extract the GUID of the installed Ultimate Performance plan
|
||||
$ultimatePlanGUID = $installedPlan.Line.Split()[3]
|
||||
elseif($state -eq "Disable") {
|
||||
if ($ultimatePlan) {
|
||||
# Extract the GUID of the Ultimate Performance plan
|
||||
$ultimatePlanGUID = $ultimatePlan.Line.Split()[3]
|
||||
|
||||
# Set a different power plan as active before deleting the Ultimate Performance plan
|
||||
$balancedPlanGUID = 381b4222-f694-41f0-9685-ff5bb260df2e
|
||||
$balancedPlanGUID = (powercfg -list | Select-String -Pattern "Balanced").Line.Split()[3]
|
||||
powercfg -setactive $balancedPlanGUID
|
||||
|
||||
# Delete the Ultimate Performance plan by GUID
|
||||
# Delete the Ultimate Performance plan
|
||||
powercfg -delete $ultimatePlanGUID
|
||||
|
||||
Write-Host "Ultimate Performance plan has been uninstalled."
|
||||
@ -70,6 +48,6 @@ Function Invoke-WPFUltimatePerformance {
|
||||
}
|
||||
}
|
||||
} catch {
|
||||
Write-Error "Error occurred: $_"
|
||||
Write-Warning $psitem.Exception.Message
|
||||
}
|
||||
}
|
||||
|
@ -28,51 +28,38 @@ function Invoke-WPFUnInstall {
|
||||
$confirm = [System.Windows.MessageBox]::Show($Messageboxbody, $MessageboxTitle, $ButtonType, $MessageIcon)
|
||||
|
||||
if($confirm -eq "No") {return}
|
||||
$ChocoPreference = $($sync.WPFpreferChocolatey.IsChecked)
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList @(("PackagesToInstall", $PackagesToInstall),("ChocoPreference", $ChocoPreference)) -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $ChocoPreference, $DebugPreference)
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $DebugPreference)
|
||||
if ($PackagesToInstall.count -eq 1) {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
} else {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Normal" -value 0.01 -overlay "logo" })
|
||||
}
|
||||
$packagesWinget, $packagesChoco = {
|
||||
$packagesWinget = [System.Collections.ArrayList]::new()
|
||||
$packagesChoco = [System.Collections.ArrayList]::new()
|
||||
|
||||
$packagesWinget = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||
$packagesChoco = [System.Collections.Generic.List`1[System.Object]]::new()
|
||||
foreach ($package in $PackagesToInstall) {
|
||||
if ($ChocoPreference) {
|
||||
if ($package.choco -eq "na") {
|
||||
$packagesWinget.add($package.winget)
|
||||
Write-Host "Queueing $($package.winget) for Winget uninstall"
|
||||
} else {
|
||||
$null = $packagesChoco.add($package.choco)
|
||||
Write-Host "Queueing $($package.choco) for Chocolatey uninstall"
|
||||
}
|
||||
}
|
||||
else {
|
||||
if ($package.winget -eq "na") {
|
||||
$packagesChoco.add($package.choco)
|
||||
Write-Host "Queueing $($package.choco) for Chocolatey uninstall"
|
||||
$packagesChoco.add($package)
|
||||
Write-Host "Queueing $($package.choco) for Chocolatey Uninstall"
|
||||
} else {
|
||||
$null = $packagesWinget.add($($package.winget))
|
||||
Write-Host "Queueing $($package.winget) for Winget uninstall"
|
||||
}
|
||||
$packagesWinget.add($($package.winget))
|
||||
Write-Host "Queueing $($package.winget) for Winget Uninstall"
|
||||
}
|
||||
}
|
||||
return $packagesWinget, $packagesChoco
|
||||
}.Invoke($PackagesToInstall)
|
||||
|
||||
try {
|
||||
$sync.ProcessRunning = $true
|
||||
|
||||
# Install all selected programs in new window
|
||||
if($packagesWinget.Count -gt 0) {
|
||||
Install-WinUtilProgramWinget -Action Uninstall -Programs $packagesWinget
|
||||
Invoke-WinUtilWingetProgram -Action Uninstall -Programs $packagesWinget
|
||||
}
|
||||
if($packagesChoco.Count -gt 0) {
|
||||
Install-WinUtilProgramChoco -Action Uninstall -Programs $packagesChoco
|
||||
Install-WinUtilProgramChoco -ProgramsToInstall $packagesChoco -Manage "Uninstalling"
|
||||
}
|
||||
|
||||
Write-Host "==========================================="
|
||||
|
@ -42,24 +42,4 @@ function Invoke-WPFUpdatesdefault {
|
||||
Write-Host "==================================================="
|
||||
Write-Host "--- Windows Update Settings Reset to Default ---"
|
||||
Write-Host "==================================================="
|
||||
|
||||
Start-Process -FilePath "secedit" -ArgumentList "/configure /cfg $env:windir\inf\defltbase.inf /db defltbase.sdb /verbose" -Wait
|
||||
Start-Process -FilePath "cmd.exe" -ArgumentList "/c RD /S /Q $env:WinDir\System32\GroupPolicyUsers" -Wait
|
||||
Start-Process -FilePath "cmd.exe" -ArgumentList "/c RD /S /Q $env:WinDir\System32\GroupPolicy" -Wait
|
||||
Start-Process -FilePath "gpupdate" -ArgumentList "/force" -Wait
|
||||
Remove-Item -Path "HKCU:\Software\Microsoft\Windows\CurrentVersion\Policies" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "HKCU:\Software\Microsoft\WindowsSelfHost" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "HKCU:\Software\Policies" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "HKLM:\Software\Microsoft\Policies" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\Policies" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "HKLM:\Software\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "HKLM:\Software\Microsoft\WindowsSelfHost" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "HKLM:\Software\Policies" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "HKLM:\Software\WOW6432Node\Microsoft\Policies" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\Policies" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
Remove-Item -Path "HKLM:\Software\WOW6432Node\Microsoft\Windows\CurrentVersion\WindowsStore\WindowsUpdate" -Recurse -Force -ErrorAction SilentlyContinue
|
||||
|
||||
Write-Host "==================================================="
|
||||
Write-Host "--- Windows Local Policies Reset to Default ---"
|
||||
Write-Host "==================================================="
|
||||
}
|
||||
|
@ -24,12 +24,8 @@ function Invoke-WPFtweaksbutton {
|
||||
|
||||
Write-Debug "Number of tweaks to process: $($Tweaks.Count)"
|
||||
|
||||
# The leading "," in the ParameterList is nessecary because we only provide one argument and powershell cannot be convinced that we want a nested loop with only one argument otherwise
|
||||
$tweaksHandle = Invoke-WPFRunspace -ParameterList @(,("tweaks",$tweaks)) -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param(
|
||||
$tweaks,
|
||||
$DebugPreference
|
||||
)
|
||||
Invoke-WPFRunspace -ArgumentList $Tweaks -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($Tweaks, $DebugPreference)
|
||||
Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)"
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
@ -42,9 +38,8 @@ function Invoke-WPFtweaksbutton {
|
||||
# Execute other selected tweaks
|
||||
|
||||
for ($i = 0; $i -lt $Tweaks.Count; $i++) {
|
||||
Set-WinUtilProgressBar -Label "Applying $($tweaks[$i])" -Percent ($i / $tweaks.Count * 100)
|
||||
Invoke-WinUtilTweaks $tweaks[$i]
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$Tweaks.Count) })
|
||||
Set-WinUtilProgressBar -Label "Applying $($tweaks[$i])" -Percent ($i / $Tweaks.Count * 100)
|
||||
Invoke-WinUtilTweaks $tweaks[$i]$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -value ($i/$Tweaks.Count) })
|
||||
}
|
||||
Set-WinUtilProgressBar -Label "Tweaks finished" -Percent 100
|
||||
$sync.ProcessRunning = $false
|
||||
|
@ -1,13 +1,5 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block header %}
|
||||
{{ super() }}
|
||||
<div style="color: red; text-align: center; padding: 10px; font-size: 20px;">
|
||||
<strong>Announcement:</strong> We are currently not adding any applications to WinUtil and any apps that will be added through a PR will be declined by the maintainer.
|
||||
<strong>Announcement:</strong> We are currently reworking the docs to use Hugo rather then mkdocs.
|
||||
</div>
|
||||
{% endblock %}
|
||||
|
||||
{% block footer %}
|
||||
{# Empty block to override the footer #}
|
||||
{% endblock %}
|
||||
|
@ -37,12 +37,6 @@ Describe "Config Files" -ForEach @(
|
||||
$result = New-Object System.Collections.Generic.List[System.Object]
|
||||
Foreach ($application in $applications) {
|
||||
$compare = $global:importedconfigs.$name.$application | Get-Member -MemberType NoteProperty | Select-Object -ExpandProperty name
|
||||
if (-not $compare) {
|
||||
throw "Comparison object for application '$application' is null."
|
||||
}
|
||||
if (-not $template) {
|
||||
throw "Template object for application '$application' is null."
|
||||
}
|
||||
if ($(Compare-Object $compare $template) -ne $null) {
|
||||
$result.Add($application)
|
||||
}
|
||||
|
222
scripts/main.ps1
222
scripts/main.ps1
@ -10,7 +10,7 @@ $InitialSessionState = [System.Management.Automation.Runspaces.InitialSessionSta
|
||||
$InitialSessionState.Variables.Add($hashVars)
|
||||
|
||||
# Get every private function and add them to the session state
|
||||
$functions = Get-ChildItem function:\ | Where-Object { $_.Name -imatch 'winutil|Microwin|WPF' }
|
||||
$functions = (Get-ChildItem function:\).where{$_.name -like "*winutil*" -or $_.name -like "*WPF*"}
|
||||
foreach ($function in $functions) {
|
||||
$functionDefinition = Get-Content function:\$($function.name)
|
||||
$functionEntry = New-Object System.Management.Automation.Runspaces.SessionStateFunctionEntry -ArgumentList $($function.name), $functionDefinition
|
||||
@ -52,84 +52,49 @@ $sync.runspace.Open()
|
||||
|
||||
$inputXML = $inputXML -replace 'mc:Ignorable="d"', '' -replace "x:N", 'N' -replace '^<Win.*', '<Window'
|
||||
|
||||
if ((Get-WinUtilToggleStatus WPFToggleDarkMode) -eq $True) {
|
||||
if (Invoke-WinUtilGPU -eq $True) {
|
||||
$ctttheme = 'Matrix'
|
||||
} else {
|
||||
$ctttheme = 'Dark'
|
||||
}
|
||||
} else {
|
||||
$ctttheme = 'Classic'
|
||||
}
|
||||
$inputXML = Set-WinUtilUITheme -inputXML $inputXML -themeName $ctttheme
|
||||
|
||||
[void][System.Reflection.Assembly]::LoadWithPartialName('presentationframework')
|
||||
[xml]$XAML = $inputXML
|
||||
|
||||
# Read the XAML file
|
||||
$readerOperationSuccessful = $false # There's more cases of failure then success.
|
||||
$reader = (New-Object System.Xml.XmlNodeReader $xaml)
|
||||
try {
|
||||
$sync["Form"] = [Windows.Markup.XamlReader]::Load( $reader )
|
||||
$readerOperationSuccessful = $true
|
||||
} catch [System.Management.Automation.MethodInvocationException] {
|
||||
Write-Host "We ran into a problem with the XAML code. Check the syntax for this control..." -ForegroundColor Red
|
||||
Write-Warning "We ran into a problem with the XAML code. Check the syntax for this control..."
|
||||
Write-Host $error[0].Exception.Message -ForegroundColor Red
|
||||
|
||||
If ($error[0].Exception.Message -like "*button*") {
|
||||
write-Host "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n" -ForegroundColor Red
|
||||
write-warning "Ensure your <button in the `$inputXML does NOT have a Click=ButtonClick property. PS can't handle this`n`n`n`n"
|
||||
}
|
||||
} catch {
|
||||
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed." -ForegroundColor Red
|
||||
Write-Host "Unable to load Windows.Markup.XamlReader. Double-check syntax and ensure .net is installed."
|
||||
}
|
||||
|
||||
if (-NOT ($readerOperationSuccessful)) {
|
||||
Write-Host "Failed to parse xaml content using Windows.Markup.XamlReader's Load Method." -ForegroundColor Red
|
||||
Write-Host "Quitting winutil..." -ForegroundColor Red
|
||||
$sync.runspace.Dispose()
|
||||
$sync.runspace.Close()
|
||||
[System.GC]::Collect()
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Setup the Window to follow listen for windows Theme Change events and update the winutil theme
|
||||
# throttle logic needed, because windows seems to send more than one theme change event per change
|
||||
$lastThemeChangeTime = [datetime]::MinValue
|
||||
$debounceInterval = [timespan]::FromSeconds(2)
|
||||
$sync.Form.Add_Loaded({
|
||||
$interopHelper = New-Object System.Windows.Interop.WindowInteropHelper $sync.Form
|
||||
$hwndSource = [System.Windows.Interop.HwndSource]::FromHwnd($interopHelper.Handle)
|
||||
$hwndSource.AddHook({
|
||||
param (
|
||||
[System.IntPtr]$hwnd,
|
||||
[int]$msg,
|
||||
[System.IntPtr]$wParam,
|
||||
[System.IntPtr]$lParam,
|
||||
[ref]$handled
|
||||
)
|
||||
# Check for the Event WM_SETTINGCHANGE (0x1001A) and validate that Button shows the icon for "Auto" => [char]0xF08C
|
||||
if (($msg -eq 0x001A) -and $sync.ThemeButton.Content -eq [char]0xF08C) {
|
||||
$currentTime = [datetime]::Now
|
||||
if ($currentTime - $lastThemeChangeTime -gt $debounceInterval) {
|
||||
Invoke-WinutilThemeChange -theme "Auto"
|
||||
$script:lastThemeChangeTime = $currentTime
|
||||
$handled = $true
|
||||
}
|
||||
}
|
||||
return 0
|
||||
})
|
||||
})
|
||||
|
||||
Invoke-WinutilThemeChange -init $true
|
||||
# Load the configuration files
|
||||
#Invoke-WPFUIElements -configVariable $sync.configs.nav -targetGridName "WPFMainGrid"
|
||||
Invoke-WPFUIElements -configVariable $sync.configs.applications -targetGridName "appspanel" -columncount 5
|
||||
Invoke-WPFUIElements -configVariable $sync.configs.tweaks -targetGridName "tweakspanel" -columncount 2
|
||||
Invoke-WPFUIElements -configVariable $sync.configs.feature -targetGridName "featurespanel" -columncount 2
|
||||
|
||||
|
||||
#===========================================================================
|
||||
# Store Form Objects In PowerShell
|
||||
#===========================================================================
|
||||
|
||||
$xaml.SelectNodes("//*[@Name]") | ForEach-Object {$sync["$("$($psitem.Name)")"] = $sync["Form"].FindName($psitem.Name)}
|
||||
|
||||
#Persist the Chocolatey preference across winutil restarts
|
||||
$ChocoPreferencePath = "$env:LOCALAPPDATA\winutil\preferChocolatey.ini"
|
||||
$sync.WPFpreferChocolatey.Add_Checked({New-Item -Path $ChocoPreferencePath -Force })
|
||||
$sync.WPFpreferChocolatey.Add_Unchecked({Remove-Item $ChocoPreferencePath -Force})
|
||||
if (Test-Path $ChocoPreferencePath) {
|
||||
$sync.WPFpreferChocolatey.IsChecked = $true
|
||||
}
|
||||
|
||||
$sync.keys | ForEach-Object {
|
||||
if($sync.$psitem) {
|
||||
if($($sync["$psitem"].GetType() | Select-Object -ExpandProperty Name) -eq "ToggleButton") {
|
||||
@ -254,34 +219,24 @@ $commonKeyEvents = {
|
||||
$sync["Form"].Add_PreViewKeyDown($commonKeyEvents)
|
||||
|
||||
$sync["Form"].Add_MouseLeftButtonDown({
|
||||
# Hide Settings and Theme Popup on click anywhere else
|
||||
if ($sync.SettingsButton.IsOpen -or
|
||||
$sync.ThemePopup.IsOpen) {
|
||||
$sync.SettingsPopup.IsOpen = $false
|
||||
$sync.ThemePopup.IsOpen = $false
|
||||
if ($sync["SettingsPopup"].IsOpen) {
|
||||
$sync["SettingsPopup"].IsOpen = $false
|
||||
}
|
||||
$sync["Form"].DragMove()
|
||||
})
|
||||
|
||||
$sync["Form"].Add_MouseDoubleClick({
|
||||
if ($_.OriginalSource -is [System.Windows.Controls.Grid] -or
|
||||
$_.OriginalSource -is [System.Windows.Controls.StackPanel]) {
|
||||
if ($sync["Form"].WindowState -eq [Windows.WindowState]::Normal) {
|
||||
$sync["Form"].WindowState = [Windows.WindowState]::Maximized
|
||||
}
|
||||
else{
|
||||
$sync["Form"].WindowState = [Windows.WindowState]::Normal
|
||||
}
|
||||
$sync["Form"].WindowState = [Windows.WindowState]::Maximized;
|
||||
} else {
|
||||
$sync["Form"].WindowState = [Windows.WindowState]::Normal;
|
||||
}
|
||||
})
|
||||
|
||||
$sync["Form"].Add_Deactivated({
|
||||
Write-Debug "WinUtil lost focus"
|
||||
# Hide Settings and Theme Popup on Winutil Focus Loss
|
||||
if ($sync.SettingsButton.IsOpen -or
|
||||
$sync.ThemePopup.IsOpen) {
|
||||
$sync.SettingsPopup.IsOpen = $false
|
||||
$sync.ThemePopup.IsOpen = $false
|
||||
if ($sync["SettingsPopup"].IsOpen) {
|
||||
$sync["SettingsPopup"].IsOpen = $false
|
||||
}
|
||||
})
|
||||
|
||||
@ -399,33 +354,6 @@ Add-Type @"
|
||||
|
||||
})
|
||||
|
||||
# Add event handlers for the RadioButtons
|
||||
$sync["ISOdownloader"].add_Checked({
|
||||
$sync["ISORelease"].Visibility = [System.Windows.Visibility]::Visible
|
||||
$sync["ISOLanguage"].Visibility = [System.Windows.Visibility]::Visible
|
||||
})
|
||||
|
||||
$sync["ISOmanual"].add_Checked({
|
||||
$sync["ISORelease"].Visibility = [System.Windows.Visibility]::Collapsed
|
||||
$sync["ISOLanguage"].Visibility = [System.Windows.Visibility]::Collapsed
|
||||
})
|
||||
|
||||
$sync["ISORelease"].Items.Add("24H2") | Out-Null
|
||||
$sync["ISORelease"].SelectedItem = "24H2"
|
||||
|
||||
$sync["ISOLanguage"].Items.Add("System Language ($(Microwin-GetLangFromCulture -langName $((Get-Culture).Name)))") | Out-Null
|
||||
if ($currentCulture -ne "English International") {
|
||||
$sync["ISOLanguage"].Items.Add("English International") | Out-Null
|
||||
}
|
||||
if ($currentCulture -ne "English") {
|
||||
$sync["ISOLanguage"].Items.Add("English") | Out-Null
|
||||
}
|
||||
if ($sync["ISOLanguage"].Items.Count -eq 1) {
|
||||
$sync["ISOLanguage"].IsEnabled = $false
|
||||
}
|
||||
$sync["ISOLanguage"].SelectedIndex = 0
|
||||
|
||||
|
||||
# Load Checkboxes and Labels outside of the Filter function only once on startup for performance reasons
|
||||
$filter = Get-WinUtilVariables -Type CheckBox
|
||||
$CheckBoxes = ($sync.GetEnumerator()).where{ $psitem.Key -in $filter }
|
||||
@ -448,8 +376,8 @@ $sync["SearchBar"].Add_TextChanged({
|
||||
$textToSearch = $sync.SearchBar.Text.ToLower()
|
||||
|
||||
foreach ($CheckBox in $CheckBoxes) {
|
||||
# Skip if the checkbox is null, it doesn't have content or it is the prefer Choco checkbox
|
||||
if ($CheckBox -eq $null -or $CheckBox.Value -eq $null -or $CheckBox.Value.Content -eq $null -or $CheckBox.Name -eq "WPFpreferChocolatey") {
|
||||
# Check if the checkbox is null or if it doesn't have content
|
||||
if ($CheckBox -eq $null -or $CheckBox.Value -eq $null -or $CheckBox.Value.Content -eq $null) {
|
||||
continue
|
||||
}
|
||||
|
||||
@ -459,7 +387,7 @@ $sync["SearchBar"].Add_TextChanged({
|
||||
# Retrieve the corresponding text block based on the generated name
|
||||
$textBlock = $sync[$textBlockName]
|
||||
|
||||
if ($CheckBox.Value.Content.ToString().ToLower().Contains($textToSearch)) {
|
||||
if ($CheckBox.Value.Content.ToLower().Contains($textToSearch)) {
|
||||
$CheckBox.Value.Visibility = "Visible"
|
||||
$activeApplications += $sync.configs.applications.$checkboxName
|
||||
# Set the corresponding text block visibility
|
||||
@ -490,78 +418,50 @@ $sync["SearchBar"].Add_TextChanged({
|
||||
}
|
||||
})
|
||||
|
||||
$sync["Form"].Add_Loaded({
|
||||
param($e)
|
||||
$sync["Form"].MaxWidth = [Double]::PositiveInfinity
|
||||
$sync["Form"].MaxHeight = [Double]::PositiveInfinity
|
||||
})
|
||||
|
||||
$NavLogoPanel = $sync["Form"].FindName("NavLogoPanel")
|
||||
$NavLogoPanel.Children.Add((Invoke-WinUtilAssets -Type "logo" -Size 25)) | Out-Null
|
||||
|
||||
# Initialize the hashtable
|
||||
$winutildir = @{}
|
||||
|
||||
# Set the path for the winutil directory
|
||||
$winutildir["path"] = "$env:LOCALAPPDATA\winutil\"
|
||||
[System.IO.Directory]::CreateDirectory($winutildir["path"]) | Out-Null
|
||||
|
||||
$winutildir["logo.ico"] = $winutildir["path"] + "cttlogo.ico"
|
||||
|
||||
if (Test-Path $winutildir["logo.ico"]) {
|
||||
$sync["logorender"] = $winutildir["logo.ico"]
|
||||
} else {
|
||||
$sync["logorender"] = (Invoke-WinUtilAssets -Type "Logo" -Size 90 -Render)
|
||||
if (-NOT (Test-Path -Path $winutildir["path"])) {
|
||||
New-Item -Path $winutildir["path"] -ItemType Directory
|
||||
}
|
||||
$sync["checkmarkrender"] = (Invoke-WinUtilAssets -Type "checkmark" -Size 512 -Render)
|
||||
$sync["warningrender"] = (Invoke-WinUtilAssets -Type "warning" -Size 512 -Render)
|
||||
|
||||
# Set the path for the logo and checkmark images
|
||||
$winutildir["logo.png"] = $winutildir["path"] + "cttlogo.png"
|
||||
$winutildir["logo.ico"] = $winutildir["path"] + "cttlogo.ico"
|
||||
if (-NOT (Test-Path -Path $winutildir["logo.png"])) {
|
||||
Invoke-WebRequest -Uri "https://christitus.com/images/logo-full.png" -OutFile $winutildir["logo.png"]
|
||||
}
|
||||
|
||||
if (-NOT (Test-Path -Path $winutildir["logo.ico"])) {
|
||||
ConvertTo-Icon -bitmapPath $winutildir["logo.png"] -iconPath $winutildir["logo.ico"]
|
||||
}
|
||||
|
||||
$winutildir["checkmark.png"] = $winutildir["path"] + "checkmark.png"
|
||||
$winutildir["warning.png"] = $winutildir["path"] + "warning.png"
|
||||
if (-NOT (Test-Path -Path $winutildir["checkmark.png"])) {
|
||||
Invoke-WebRequest -Uri "https://christitus.com/images/checkmark.png" -OutFile $winutildir["checkmark.png"]
|
||||
}
|
||||
if (-NOT (Test-Path -Path $winutildir["warning.png"])) {
|
||||
Invoke-WebRequest -Uri "https://christitus.com/images/warning.png" -OutFile $winutildir["warning.png"]
|
||||
}
|
||||
|
||||
|
||||
Set-WinUtilTaskbaritem -overlay "logo"
|
||||
|
||||
$sync["Form"].Add_Activated({
|
||||
Set-WinUtilTaskbaritem -overlay "logo"
|
||||
})
|
||||
# Define event handler for ThemeButton click
|
||||
$sync["ThemeButton"].Add_Click({
|
||||
if ($sync.ThemePopup.IsOpen) {
|
||||
$sync.ThemePopup.IsOpen = $false
|
||||
}
|
||||
else{
|
||||
$sync.ThemePopup.IsOpen = $true
|
||||
}
|
||||
$sync.SettingsPopup.IsOpen = $false
|
||||
})
|
||||
|
||||
# Define event handlers for menu items
|
||||
$sync["AutoThemeMenuItem"].Add_Click({
|
||||
$sync.ThemePopup.IsOpen = $false
|
||||
Invoke-WinutilThemeChange -theme "Auto"
|
||||
$_.Handled = $false
|
||||
})
|
||||
# Define event handlers for menu items
|
||||
$sync["DarkThemeMenuItem"].Add_Click({
|
||||
$sync.ThemePopup.IsOpen = $false
|
||||
Invoke-WinutilThemeChange -theme "Dark"
|
||||
$_.Handled = $false
|
||||
})
|
||||
# Define event handlers for menu items
|
||||
$sync["LightThemeMenuItem"].Add_Click({
|
||||
$sync.ThemePopup.IsOpen = $false
|
||||
Invoke-WinutilThemeChange -theme "Light"
|
||||
$_.Handled = $false
|
||||
})
|
||||
|
||||
|
||||
# Define event handler for button click
|
||||
$sync["SettingsButton"].Add_Click({
|
||||
Write-Debug "SettingsButton clicked"
|
||||
if ($sync.SettingsPopup.IsOpen) {
|
||||
$sync.SettingsPopup.IsOpen = $false
|
||||
if ($sync["SettingsPopup"].IsOpen) {
|
||||
$sync["SettingsPopup"].IsOpen = $false
|
||||
} else {
|
||||
$sync["SettingsPopup"].IsOpen = $true
|
||||
}
|
||||
else{
|
||||
$sync.SettingsPopup.IsOpen = $true
|
||||
}
|
||||
$sync.ThemePopup.IsOpen = $false
|
||||
$_.Handled = $false
|
||||
})
|
||||
|
||||
@ -593,8 +493,12 @@ MicroWin : <a href="https://github.com/KonTy">@KonTy</a>
|
||||
GitHub : <a href="https://github.com/ChrisTitusTech/winutil">ChrisTitusTech/winutil</a>
|
||||
Version : <a href="https://github.com/ChrisTitusTech/winutil/releases/tag/$($sync.version)">$($sync.version)</a>
|
||||
"@
|
||||
|
||||
Show-CustomDialog -Message $authorInfo -LogoSize $LogoSize
|
||||
$FontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSize
|
||||
$HeaderFontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSizeHeader
|
||||
$IconSize = $sync.configs.themes.$ctttheme.CustomDialogIconSize
|
||||
$Width = $sync.configs.themes.$ctttheme.CustomDialogWidth
|
||||
$Height = $sync.configs.themes.$ctttheme.CustomDialogHeight
|
||||
Show-CustomDialog -Message $authorInfo -Width $Width -Height $Height -FontSize $FontSize -HeaderFontSize $HeaderFontSize -IconSize $IconSize
|
||||
})
|
||||
|
||||
$sync["SponsorMenuItem"].Add_Click({
|
||||
@ -615,8 +519,12 @@ $sync["SponsorMenuItem"].Add_Click({
|
||||
$authorInfo += "An error occurred while fetching or processing the sponsors: $_`n"
|
||||
}
|
||||
|
||||
Show-CustomDialog -Message $authorInfo -EnableScroll $true
|
||||
$FontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSize
|
||||
$HeaderFontSize = $sync.configs.themes.$ctttheme.CustomDialogFontSizeHeader
|
||||
$IconSize = $sync.configs.themes.$ctttheme.CustomDialogIconSize
|
||||
$Width = $sync.configs.themes.$ctttheme.CustomDialogWidth
|
||||
$Height = $sync.configs.themes.$ctttheme.CustomDialogHeight
|
||||
Show-CustomDialog -Message $authorInfo -Width $Width -Height $Height -FontSize $FontSize -HeaderFontSize $HeaderFontSize -IconSize $IconSize -EnableScroll $true
|
||||
})
|
||||
|
||||
$sync["Form"].ShowDialog() | out-null
|
||||
Stop-Transcript
|
||||
|
@ -5,7 +5,6 @@
|
||||
GitHub : https://github.com/ChrisTitusTech
|
||||
Version : #{replaceme}
|
||||
#>
|
||||
|
||||
param (
|
||||
[switch]$Debug,
|
||||
[string]$Config,
|
||||
@ -28,6 +27,12 @@ if ($Run) {
|
||||
$PARAM_RUN = $true
|
||||
}
|
||||
|
||||
if (!(Test-Path -Path $ENV:TEMP)) {
|
||||
New-Item -ItemType Directory -Force -Path $ENV:TEMP
|
||||
}
|
||||
|
||||
Start-Transcript $ENV:TEMP\Winutil.log -Append
|
||||
|
||||
# Load DLLs
|
||||
Add-Type -AssemblyName PresentationFramework
|
||||
Add-Type -AssemblyName System.Windows.Forms
|
||||
@ -39,38 +44,15 @@ $sync.version = "#{replaceme}"
|
||||
$sync.configs = @{}
|
||||
$sync.ProcessRunning = $false
|
||||
|
||||
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch."
|
||||
$argList = @()
|
||||
|
||||
$PSBoundParameters.GetEnumerator() | ForEach-Object {
|
||||
$argList += if ($_.Value -is [switch] -and $_.Value) {
|
||||
"-$($_.Key)"
|
||||
} elseif ($_.Value) {
|
||||
"-$($_.Key) `"$($_.Value)`""
|
||||
}
|
||||
}
|
||||
|
||||
$script = if ($MyInvocation.MyCommand.Path) {
|
||||
"& { & '$($MyInvocation.MyCommand.Path)' $argList }"
|
||||
} else {
|
||||
"iex '& { $(irm https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1) } $argList'"
|
||||
}
|
||||
|
||||
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
|
||||
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd }
|
||||
|
||||
Start-Process $processCmd -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -Command $script" -Verb RunAs
|
||||
|
||||
# If script isn't running as admin, show error message and quit
|
||||
If (([Security.Principal.WindowsIdentity]::GetCurrent()).Owner.Value -ne "S-1-5-32-544") {
|
||||
Write-Host "===========================================" -Foregroundcolor Red
|
||||
Write-Host "-- Scripts must be run as Administrator ---" -Foregroundcolor Red
|
||||
Write-Host "-- Right-Click Start -> Terminal(Admin) ---" -Foregroundcolor Red
|
||||
Write-Host "===========================================" -Foregroundcolor Red
|
||||
break
|
||||
}
|
||||
|
||||
$dateTime = Get-Date -Format "yyyy-MM-dd_HH-mm-ss"
|
||||
|
||||
$logdir = "$env:localappdata\winutil\logs"
|
||||
[System.IO.Directory]::CreateDirectory("$logdir") | Out-Null
|
||||
Start-Transcript -Path "$logdir\winutil_$dateTime.log" -Append -NoClobber | Out-Null
|
||||
|
||||
# Set PowerShell window title
|
||||
$Host.UI.RawUI.WindowTitle = $myInvocation.MyCommand.Definition + "(Admin)"
|
||||
clear-host
|
||||
|
@ -39,7 +39,7 @@ function Invoke-Preprocessing {
|
||||
.EXAMPLE
|
||||
Invoke-Preprocessing -ThrowExceptionOnEmptyFilesList -WorkingDir "DRIVE:\Path\To\Folder\" -ExcludedFiles @('file.txt', '.\.git\', '*.png') -ProgressStatusMessage "Doing Preprocessing"
|
||||
|
||||
Same as Example No. 1, but uses '-ThrowExceptionOnEmptyFilesList', which's an optional parameter that'll make 'Invoke-Preprocessing' throw an exception when no files are found in 'WorkingDir' (not including the ExcludedFiles, of course), useful when you want to double check your parameters & you're sure there's files to process in the 'WorkingDir'.
|
||||
Same as Example No. 1, but will throw an exception when 'Invoke-Preprocessing' function doesn't find any files in 'WorkingDir' (not including 'ExcludedFiles' list).
|
||||
|
||||
.EXAMPLE
|
||||
Invoke-Preprocessing -Skip -WorkingDir "DRIVE:\Path\To\Folder\" -ExcludedFiles @('file.txt', '.\.git\', '*.png') -ProgressStatusMessage "Doing Preprocessing"
|
||||
@ -72,45 +72,22 @@ function Invoke-Preprocessing {
|
||||
throw "[Invoke-Preprocessing] Invalid Paramter Value for 'WorkingDir', passed value: '$WorkingDir'. Either the path is a File or Non-Existing/Invlid, please double check your code."
|
||||
}
|
||||
|
||||
$InternalExcludedFiles = [System.Collections.Generic.List[string]]::new($ExcludedFiles.Count)
|
||||
ForEach ($excludedFile in $ExcludedFiles) {
|
||||
$InternalExcludedFiles.Add($excludedFile) | Out-Null
|
||||
}
|
||||
|
||||
# Validate the ExcludedItems List before continuing on,
|
||||
# that's if there's a list in the first place, and '-SkipInternalExcludedFilesValidation' was not provided.
|
||||
if ($ExcludedFiles.Count -gt 0) {
|
||||
ForEach ($excludedFile in $ExcludedFiles) {
|
||||
$count = $ExcludedFiles.Count
|
||||
if ((-NOT ($count -eq 0)) -AND (-NOT $SkipExcludedFilesValidation)) {
|
||||
for ($i = 0; $i -lt $count; $i++) {
|
||||
$excludedFile = $ExcludedFiles[$i]
|
||||
$filePath = "$(($WorkingDir -replace ('\\$', '')) + '\' + ($excludedFile -replace ('\.\\', '')))"
|
||||
$files = Get-ChildItem -Recurse -Path "$filePath" -File -Force
|
||||
if ($files.Count -gt 0) {
|
||||
ForEach ($file in $files) {
|
||||
$InternalExcludedFiles.Add("$($file.FullName)") | Out-Null
|
||||
if (-NOT (Get-ChildItem -Recurse -Path "$filePath" -File)) {
|
||||
$failedFilesList += "'$filePath', "
|
||||
}
|
||||
} else { $failedFilesList += "'$filePath', " }
|
||||
}
|
||||
$failedFilesList = $failedFilesList -replace (',\s*$', '')
|
||||
if ((-not $failedFilesList -eq "") -and (-not $SkipExcludedFilesValidation)) {
|
||||
throw "[Invoke-Preprocessing] One or more File Paths and/or File Patterns were not found, you can use '-SkipExcludedFilesValidation' switch to skip this check, the failed to validate are: $failedFilesList"
|
||||
if (-NOT $failedFilesList -eq "") {
|
||||
throw "[Invoke-Preprocessing] One or more File Paths & File Patterns were not found, you can use '-SkipExcludedFilesValidation' switch to skip this check, and the failed files are: $failedFilesList"
|
||||
}
|
||||
}
|
||||
|
||||
# Get Files List
|
||||
[System.Collections.ArrayList]$files = Get-ChildItem -LiteralPath $WorkingDir -Recurse -Exclude $InternalExcludedFiles -File -Force
|
||||
|
||||
# Only keep the 'FullName' Property for every entry in the list
|
||||
for ($i = 0; $i -lt $files.Count; $i++) {
|
||||
$file = $files[$i]
|
||||
$files[$i] = $file.FullName
|
||||
}
|
||||
|
||||
# If a file(s) are found in Exclude List,
|
||||
# Remove the file from files list.
|
||||
ForEach ($excludedFile in $InternalExcludedFiles) {
|
||||
$index = $files.IndexOf("$excludedFile")
|
||||
if ($index -ge 0) { $files.RemoveAt($index) }
|
||||
}
|
||||
|
||||
$files = Get-ChildItem $WorkingDir -Recurse -Exclude $ExcludedFiles -File
|
||||
$numOfFiles = $files.Count
|
||||
|
||||
if ($numOfFiles -eq 0) {
|
||||
@ -122,11 +99,26 @@ function Invoke-Preprocessing {
|
||||
}
|
||||
|
||||
for ($i = 0; $i -lt $numOfFiles; $i++) {
|
||||
$fullFileName = $files[$i]
|
||||
$file = $files[$i]
|
||||
|
||||
# If the file is in Exclude List, don't proceed to check/modify said file.
|
||||
$fileIsExcluded = $False
|
||||
for ($j = 0; $j -lt $excludedFiles.Count; $j++) {
|
||||
$excluded = $excludedFiles[$j]
|
||||
$strToCompare = ($excluded) -replace ('^\.\\', '')
|
||||
if ($file.FullName.Contains("$strToCompare")) {
|
||||
$fileIsExcluded = $True
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
if ($fileIsExcluded) {
|
||||
continue
|
||||
}
|
||||
|
||||
# TODO:
|
||||
# make more formatting rules, and document them in WinUtil Official Documentation
|
||||
(Get-Content "$fullFileName").TrimEnd() `
|
||||
(Get-Content "$file").TrimEnd() `
|
||||
-replace ('\t', ' ') `
|
||||
-replace ('\)\s*\{', ') {') `
|
||||
-replace ('(?<keyword>if|for|foreach)\s*(?<condition>\([.*?]\))\s*\{', '${keyword} ${condition} {') `
|
||||
@ -137,8 +129,8 @@ function Invoke-Preprocessing {
|
||||
-replace ('\}\s*Catch', '} catch') `
|
||||
-replace ('\}\s*Catch\s*(?<exceptions>(\[.*?\]\s*(\,)?\s*)+)\s*\{', '} catch ${exceptions} {') `
|
||||
-replace ('\}\s*Catch\s*(?<exceptions>\[.*?\])\s*\{', '} catch ${exceptions} {') `
|
||||
-replace ('(?<parameter_type>\[[^$0-9]+\])\s*(?<str_after_type>\$.*?)', '${parameter_type}${str_after_type}') `
|
||||
| Set-Content "$fullFileName"
|
||||
-replace ('(?<parameter_type>\[.*?\])\s*(?<str_after_type>\$.*?(,|\s*\)))', '${parameter_type}${str_after_type}') `
|
||||
| Set-Content "$file"
|
||||
|
||||
Write-Progress -Activity $ProgressActivity -Status "$ProgressStatusMessage - Finished $i out of $numOfFiles" -PercentComplete (($i/$numOfFiles)*100)
|
||||
}
|
||||
|
17
windev.ps1
17
windev.ps1
@ -30,24 +30,11 @@ function RedirectToLatestPreRelease {
|
||||
if ($latestRelease) {
|
||||
$url = "https://github.com/ChrisTitusTech/winutil/releases/download/$latestRelease/winutil.ps1"
|
||||
} else {
|
||||
Write-Host 'No pre-release version found. This is most likely because the latest release is a full release and no newer pre-release exists.' -ForegroundColor Yellow
|
||||
Write-Host 'Unable to determine latest pre-release version.' -ForegroundColor Red
|
||||
Write-Host "Using latest Full Release"
|
||||
$url = "https://github.com/ChrisTitusTech/winutil/releases/latest/download/winutil.ps1"
|
||||
}
|
||||
|
||||
$script = Invoke-RestMethod $url
|
||||
# Elevate Shell if necessary
|
||||
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
|
||||
Write-Output "Winutil needs to be run as Administrator. Attempting to relaunch."
|
||||
|
||||
$powershellcmd = if (Get-Command pwsh -ErrorAction SilentlyContinue) { "pwsh" } else { "powershell" }
|
||||
$processCmd = if (Get-Command wt.exe -ErrorAction SilentlyContinue) { "wt.exe" } else { $powershellcmd }
|
||||
|
||||
Start-Process $processCmd -ArgumentList "$powershellcmd -ExecutionPolicy Bypass -NoProfile -Command $(Invoke-Expression $script)" -Verb RunAs
|
||||
}
|
||||
else{
|
||||
Invoke-Expression $script
|
||||
}
|
||||
Invoke-RestMethod $url | Invoke-Expression
|
||||
}
|
||||
|
||||
# Call the redirect function
|
||||
|
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user