mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-04-05 22:28:31 +00:00
* cleaned up typo, fixes, grammatical and other related fixes (#2) * typo in Lightshot app name * remove trailing comma in applications.json * consistent capitalization of Windows, WinGet - only user-facing text - includes update to devdocs-generator.ps1, so docs for tweaks modifying registry will have `Windows settings` rather than `windows settings` * various fixes for typos, style, punctuation and capitalization * capitalize 'AM' * Update README.md change formatting for GitHub UI interaction form code format (` `) to bold md Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com> * typos and wording in docs --------- Co-authored-by: Jay <65828559+Jay-o-Way@users.noreply.github.com>
50 lines
1.9 KiB
PowerShell
50 lines
1.9 KiB
PowerShell
function Invoke-WinUtilFeatureInstall {
|
|
<#
|
|
|
|
.SYNOPSIS
|
|
Converts all the values from the tweaks.json and routes them to the appropriate function
|
|
|
|
#>
|
|
|
|
param(
|
|
$CheckBox
|
|
)
|
|
|
|
if($sync.configs.feature.$CheckBox.feature) {
|
|
Foreach( $feature in $sync.configs.feature.$CheckBox.feature ) {
|
|
try {
|
|
Write-Host "Installing $feature"
|
|
Enable-WindowsOptionalFeature -Online -FeatureName $feature -All -NoRestart
|
|
} catch {
|
|
if ($CheckBox.Exception.Message -like "*requires elevation*") {
|
|
Write-Warning "Unable to Install $feature due to permissions. Are you running as admin?"
|
|
Invoke-WPFUIThread -ScriptBlock { Set-WinUtilTaskbaritem -state "Error" }
|
|
} else {
|
|
|
|
Write-Warning "Unable to Install $feature due to unhandled exception."
|
|
Write-Warning $CheckBox.Exception.StackTrace
|
|
}
|
|
}
|
|
}
|
|
}
|
|
if($sync.configs.feature.$CheckBox.InvokeScript) {
|
|
Foreach( $script in $sync.configs.feature.$CheckBox.InvokeScript ) {
|
|
try {
|
|
$Scriptblock = [scriptblock]::Create($script)
|
|
|
|
Write-Host "Running Script for $CheckBox"
|
|
Invoke-Command $scriptblock -ErrorAction stop
|
|
} catch {
|
|
if ($CheckBox.Exception.Message -like "*requires elevation*") {
|
|
Write-Warning "Unable to Install $feature due to permissions. Are you running as admin?"
|
|
Invoke-WPFUIThread -ScriptBlock { Set-WinUtilTaskbaritem -state "Error" }
|
|
} else {
|
|
Invoke-WPFUIThread -ScriptBlock { Set-WinUtilTaskbaritem -state "Error" }
|
|
Write-Warning "Unable to Install $feature due to unhandled exception."
|
|
Write-Warning $CheckBox.Exception.StackTrace
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|