mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-16 09:50:36 -06:00
Compare commits
No commits in common. "8b158df8c41fab931fb179b5246167221d15c9c3" and "5621b50762c40b10eb24df6282073696ff30de4d" have entirely different histories.
8b158df8c4
...
5621b50762
@ -2430,6 +2430,12 @@
|
|||||||
"Order": "a001_",
|
"Order": "a001_",
|
||||||
"InvokeScript": [
|
"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
|
# Check if System Restore is enabled for the main drive
|
||||||
try {
|
try {
|
||||||
# Try getting restore points to check if System Restore is enabled
|
# 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))"
|
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
|
$changeservice = $false
|
||||||
}
|
}
|
||||||
} catch {
|
} catch [System.ServiceProcess.ServiceNotFoundException] {
|
||||||
write-host "Unable to get service $($psitem.Name)"
|
Write-Warning "Service $($psitem.Name) was not found"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -26,7 +26,11 @@ Function Set-WinUtilService {
|
|||||||
|
|
||||||
# Service exists, proceed with changing properties
|
# Service exists, proceed with changing properties
|
||||||
$service | Set-Service -StartupType $StartupType -ErrorAction Stop
|
$service | Set-Service -StartupType $StartupType -ErrorAction Stop
|
||||||
|
} catch [System.ServiceProcess.ServiceNotFoundException] {
|
||||||
|
Write-Warning "Service $Name was not found"
|
||||||
} catch {
|
} 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
|
$sync["Form"].taskbarItemInfo.Description = $description
|
||||||
}
|
}
|
||||||
} catch {
|
} catch {
|
||||||
#do nothing
|
#nothing
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -18,12 +18,14 @@ function Invoke-WPFFeatureInstall {
|
|||||||
|
|
||||||
if ($FeatureConfig) {
|
if ($FeatureConfig) {
|
||||||
$Features = $FeatureConfig
|
$Features = $FeatureConfig
|
||||||
|
$automation = $true
|
||||||
} else {
|
} else {
|
||||||
$Features = (Get-WinUtilCheckBoxes)["WPFFeature"]
|
$Features = (Get-WinUtilCheckBoxes)["WPFFeature"]
|
||||||
|
$automation = $false
|
||||||
}
|
}
|
||||||
|
|
||||||
Invoke-WPFRunspace -ArgumentList $Features -DebugPreference $DebugPreference -ScriptBlock {
|
Invoke-WPFRunspace -ArgumentList $Features, $automation -DebugPreference $DebugPreference -ScriptBlock {
|
||||||
param($Features, $DebugPreference)
|
param($Features, $automation, $DebugPreference)
|
||||||
$sync.ProcessRunning = $true
|
$sync.ProcessRunning = $true
|
||||||
if ($Features.count -eq 1) {
|
if ($Features.count -eq 1) {
|
||||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||||
|
@ -18,8 +18,10 @@ function Invoke-WPFInstall {
|
|||||||
|
|
||||||
if ($InstallConfig) {
|
if ($InstallConfig) {
|
||||||
$PackagesToInstall = $InstallConfig
|
$PackagesToInstall = $InstallConfig
|
||||||
|
$automation = $true
|
||||||
} else {
|
} else {
|
||||||
$PackagesToInstall = (Get-WinUtilCheckBoxes)["Install"]
|
$PackagesToInstall = (Get-WinUtilCheckBoxes)["Install"]
|
||||||
|
$automation = $false
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($PackagesToInstall.Count -eq 0) {
|
if ($PackagesToInstall.Count -eq 0) {
|
||||||
@ -29,8 +31,8 @@ function Invoke-WPFInstall {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
Invoke-WPFRunspace -ArgumentList $PackagesToInstall -DebugPreference $DebugPreference -ScriptBlock {
|
Invoke-WPFRunspace -ArgumentList $PackagesToInstall, $automation -DebugPreference $DebugPreference -ScriptBlock {
|
||||||
param($PackagesToInstall, $DebugPreference)
|
param($PackagesToInstall, $automation, $DebugPreference)
|
||||||
if ($PackagesToInstall.count -eq 1) {
|
if ($PackagesToInstall.count -eq 1) {
|
||||||
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
$sync.form.Dispatcher.Invoke([action]{ Set-WinUtilTaskbaritem -state "Indeterminate" -value 0.01 -overlay "logo" })
|
||||||
} else {
|
} else {
|
||||||
|
@ -22,14 +22,13 @@ function Invoke-WPFRunspace {
|
|||||||
Param (
|
Param (
|
||||||
$ScriptBlock,
|
$ScriptBlock,
|
||||||
$ArgumentList,
|
$ArgumentList,
|
||||||
$DebugPreference
|
$DebugPreference,
|
||||||
|
$automation
|
||||||
)
|
)
|
||||||
|
|
||||||
if ($PARAM_RUN) {
|
if ($automation = $true) {
|
||||||
write-host "Running in Main Thread"
|
|
||||||
& $ScriptBlock @ArgumentList @DebugPreference
|
& $ScriptBlock @ArgumentList @DebugPreference
|
||||||
} else {
|
} else {
|
||||||
write-host "Running in Runspace"
|
|
||||||
# Create a PowerShell instance
|
# Create a PowerShell instance
|
||||||
$script:powershell = [powershell]::Create()
|
$script:powershell = [powershell]::Create()
|
||||||
|
|
||||||
|
@ -18,8 +18,10 @@ function Invoke-WPFtweaksbutton {
|
|||||||
|
|
||||||
if ($TweaksConfig) {
|
if ($TweaksConfig) {
|
||||||
$Tweaks = $TweaksConfig
|
$Tweaks = $TweaksConfig
|
||||||
|
$automation = $true
|
||||||
} else {
|
} else {
|
||||||
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
|
$Tweaks = (Get-WinUtilCheckBoxes)["WPFTweaks"]
|
||||||
|
$automation = $false
|
||||||
}
|
}
|
||||||
|
|
||||||
Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text
|
Set-WinUtilDNS -DNSProvider $sync["WPFchangedns"].text
|
||||||
@ -32,8 +34,8 @@ function Invoke-WPFtweaksbutton {
|
|||||||
|
|
||||||
Write-Debug "Number of tweaks to process: $($Tweaks.Count)"
|
Write-Debug "Number of tweaks to process: $($Tweaks.Count)"
|
||||||
|
|
||||||
Invoke-WPFRunspace -ArgumentList $Tweaks -DebugPreference $DebugPreference -ScriptBlock {
|
Invoke-WPFRunspace -ArgumentList $Tweaks, $automation -DebugPreference $DebugPreference -ScriptBlock {
|
||||||
param($Tweaks, $DebugPreference)
|
param($Tweaks, $automation, $DebugPreference)
|
||||||
Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)"
|
Write-Debug "Inside Number of tweaks to process: $($Tweaks.Count)"
|
||||||
|
|
||||||
$sync.ProcessRunning = $true
|
$sync.ProcessRunning = $true
|
||||||
|
Loading…
Reference in New Issue
Block a user