mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-16 01:40:35 -06:00
Compare commits
No commits in common. "8b158df8c41fab931fb179b5246167221d15c9c3" and "5621b50762c40b10eb24df6282073696ff30de4d" have entirely different histories.
8b158df8c4
...
5621b50762
@ -2430,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
|
||||
|
@ -59,8 +59,8 @@ function Invoke-WinUtilTweaks {
|
||||
Write-Debug "Service $($service.Name) was changed in the past to $($service.StartType.ToString()) from it's original type of $($psitem.$($values.OriginalService)), will not change it to $($psitem.$($values.service))"
|
||||
$changeservice = $false
|
||||
}
|
||||
} catch {
|
||||
write-host "Unable to get service $($psitem.Name)"
|
||||
} catch [System.ServiceProcess.ServiceNotFoundException] {
|
||||
Write-Warning "Service $($psitem.Name) was not found"
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,11 @@ Function Set-WinUtilService {
|
||||
|
||||
# Service exists, proceed with changing properties
|
||||
$service | Set-Service -StartupType $StartupType -ErrorAction Stop
|
||||
} catch [System.ServiceProcess.ServiceNotFoundException] {
|
||||
Write-Warning "Service $Name was not found"
|
||||
} catch {
|
||||
write-host "Unable to get service $($Name)"
|
||||
Write-Warning "Unable to set $Name due to unhandled exception"
|
||||
Write-Warning $_.Exception.Message
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -85,6 +85,6 @@ function Set-WinUtilTaskbaritem {
|
||||
$sync["Form"].taskbarItemInfo.Description = $description
|
||||
}
|
||||
} catch {
|
||||
#do nothing
|
||||
#nothing
|
||||
}
|
||||
}
|
||||
|
@ -18,12 +18,14 @@ function Invoke-WPFFeatureInstall {
|
||||
|
||||
if ($FeatureConfig) {
|
||||
$Features = $FeatureConfig
|
||||
$automation = $true
|
||||
} else {
|
||||
$Features = (Get-WinUtilCheckBoxes)["WPFFeature"]
|
||||
$automation = $false
|
||||
}
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $Features -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($Features, $DebugPreference)
|
||||
Invoke-WPFRunspace -ArgumentList $Features, $automation -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($Features, $automation, $DebugPreference)
|
||||
$sync.ProcessRunning = $true
|
||||
if ($Features.count -eq 1) {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
|
@ -18,8 +18,10 @@ function Invoke-WPFInstall {
|
||||
|
||||
if ($InstallConfig) {
|
||||
$PackagesToInstall = $InstallConfig
|
||||
$automation = $true
|
||||
} else {
|
||||
$PackagesToInstall = (Get-WinUtilCheckBoxes)["Install"]
|
||||
$automation = $false
|
||||
}
|
||||
|
||||
if ($PackagesToInstall.Count -eq 0) {
|
||||
@ -29,8 +31,8 @@ function Invoke-WPFInstall {
|
||||
}
|
||||
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $DebugPreference)
|
||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall, $automation -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($PackagesToInstall, $automation, $DebugPreference)
|
||||
if ($PackagesToInstall.count -eq 1) {
|
||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||
} else {
|
||||
|
@ -22,14 +22,13 @@ function Invoke-WPFRunspace {
|
||||
Param (
|
||||
$ScriptBlock,
|
||||
$ArgumentList,
|
||||
$DebugPreference
|
||||
$DebugPreference,
|
||||
$automation
|
||||
)
|
||||
|
||||
if ($PARAM_RUN) {
|
||||
write-host "Running in Main Thread"
|
||||
if ($automation = $true) {
|
||||
& $ScriptBlock @ArgumentList @DebugPreference
|
||||
} else {
|
||||
write-host "Running in Runspace"
|
||||
# Create a PowerShell instance
|
||||
$script:powershell = [powershell]::Create()
|
||||
|
||||
|
@ -18,8 +18,10 @@ function Invoke-WPFtweaksbutton {
|
||||
|
||||
if ($TweaksConfig) {
|
||||
$Tweaks = $TweaksConfig
|
||||
$automation = $true
|
||||
} else {
|
||||
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
|
||||
$automation = $false
|
||||
}
|
||||
|
||||
Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text
|
||||
@ -32,8 +34,8 @@ function Invoke-WPFtweaksbutton {
|
||||
|
||||
Write-Debug "Number of tweaks to process: $($Tweaks.Count)"
|
||||
|
||||
Invoke-WPFRunspace -ArgumentList $Tweaks -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($Tweaks, $DebugPreference)
|
||||
Invoke-WPFRunspace -ArgumentList $Tweaks, $automation -DebugPreference $DebugPreference -ScriptBlock {
|
||||
param($Tweaks, $automation, $DebugPreference)
|
||||
Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)"
|
||||
|
||||
$sync.ProcessRunning = $true
|
||||
|
Loading…
Reference in New Issue
Block a user