mirror of
https://github.com/ChrisTitusTech/winutil
synced 2026-06-04 14:17:27 +00:00
fix import (#4447)
* Made -Config use Runspaces main.ps1 * Fix no-UI config autorun * Skip empty no-UI autorun sections * Update Invoke-WinUtilAutoRun.ps1 * Ignore blank DNS selection during autorun * Update main.ps1 * Update Invoke-WPFRunspace.ps1 * Update Invoke-WPFRunspace.ps1 * Update Invoke-WinUtilAutoRun.ps1 * Update Invoke-WinUtilAutoRun.ps1 * Update Invoke-WPFtweaksbutton.ps1 * Update start.ps1 * Update main.ps1 * Update Invoke-WPFtweaksbutton.ps1 * Update Invoke-WPFRunspace.ps1 * Update _index.md * Merge branch 'ChrisTitusTech:main' into patch-3 * Merge branch 'ChrisTitusTech:main' into patch-3
This commit is contained in:
@@ -16,7 +16,7 @@ To create a config file:
|
|||||||
|
|
||||||
Once you have exported a config, launch Winutil with it using this command:
|
Once you have exported a config, launch Winutil with it using this command:
|
||||||
```powershell
|
```powershell
|
||||||
& ([ScriptBlock]::Create((irm "https://christitus.com/win"))) -Config "C:\Path\To\Config.json" -Run
|
& ([ScriptBlock]::Create((irm "https://christitus.com/win"))) -Config "C:\Path\To\Config.json"
|
||||||
```
|
```
|
||||||
|
|
||||||
This is useful for:
|
This is useful for:
|
||||||
|
|||||||
@@ -14,6 +14,9 @@ function Invoke-WPFtweaksbutton {
|
|||||||
|
|
||||||
$Tweaks = $sync.selectedTweaks
|
$Tweaks = $sync.selectedTweaks
|
||||||
$dnsProvider = $sync["WPFchangedns"].text
|
$dnsProvider = $sync["WPFchangedns"].text
|
||||||
|
if (-not ($dnsProvider)) {
|
||||||
|
$dnsProvider = "Default"
|
||||||
|
}
|
||||||
$restorePointTweak = "WPFTweaksRestorePoint"
|
$restorePointTweak = "WPFTweaksRestorePoint"
|
||||||
$restorePointSelected = $Tweaks -contains $restorePointTweak
|
$restorePointSelected = $Tweaks -contains $restorePointTweak
|
||||||
$tweaksToRun = @($Tweaks | Where-Object { $_ -ne $restorePointTweak })
|
$tweaksToRun = @($Tweaks | Where-Object { $_ -ne $restorePointTweak })
|
||||||
|
|||||||
@@ -6,43 +6,29 @@ function Invoke-WinUtilAutoRun {
|
|||||||
#>
|
#>
|
||||||
|
|
||||||
function BusyWait {
|
function BusyWait {
|
||||||
Start-Sleep -Seconds 5
|
Start-Sleep -Milliseconds 100
|
||||||
while ($sync.ProcessRunning) {
|
while ($sync.ProcessRunning) {
|
||||||
Start-Sleep -Seconds 5
|
Start-Sleep -Milliseconds 100
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
BusyWait
|
|
||||||
|
|
||||||
Write-Host "Applying tweaks..."
|
|
||||||
Invoke-WPFtweaksbutton
|
|
||||||
BusyWait
|
|
||||||
|
|
||||||
Write-Host "Applying toggles..."
|
|
||||||
$handle = Invoke-WPFRunspace -ScriptBlock {
|
|
||||||
$Toggles = $sync.selectedToggles
|
|
||||||
Write-Debug "Inside Number of toggles to process: $($Toggles.Count)"
|
|
||||||
|
|
||||||
$sync.ProcessRunning = $true
|
|
||||||
|
|
||||||
for ($i = 0; $i -lt $Tweaks.Count; $i++) {
|
|
||||||
Invoke-WinUtilTweaks $Toggles[$i]
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$sync.ProcessRunning = $false
|
|
||||||
Write-Host "================================="
|
|
||||||
Write-Host "-- Toggles are Finished ---"
|
|
||||||
Write-Host "================================="
|
|
||||||
}
|
}
|
||||||
BusyWait
|
|
||||||
|
|
||||||
Write-Host "Applying features..."
|
if ($sync.selectedTweaks.Count -gt 0) {
|
||||||
Invoke-WPFFeatureInstall
|
Write-Host "Applying tweaks..."
|
||||||
BusyWait
|
Invoke-WPFtweaksbutton
|
||||||
|
BusyWait
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "Installing applications..."
|
if ($sync.selectedFeatures.Count -gt 0) {
|
||||||
Invoke-WPFInstall
|
Write-Host "Applying features..."
|
||||||
BusyWait
|
Invoke-WPFFeatureInstall
|
||||||
|
BusyWait
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($sync.selectedApps.Count -gt 0) {
|
||||||
|
Write-Host "Installing applications..."
|
||||||
|
Invoke-WPFInstall
|
||||||
|
BusyWait
|
||||||
|
}
|
||||||
|
|
||||||
Write-Host "Done."
|
Write-Host "Done."
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-7
@@ -75,12 +75,8 @@ if ($PARAM_NOUI) {
|
|||||||
if ($PARAM_CONFIG -and -not [string]::IsNullOrWhiteSpace($PARAM_CONFIG)) {
|
if ($PARAM_CONFIG -and -not [string]::IsNullOrWhiteSpace($PARAM_CONFIG)) {
|
||||||
Write-Host "Running config file tasks..."
|
Write-Host "Running config file tasks..."
|
||||||
Invoke-WPFImpex -type "import" -Config $PARAM_CONFIG
|
Invoke-WPFImpex -type "import" -Config $PARAM_CONFIG
|
||||||
if ($PARAM_RUN) {
|
Invoke-WinUtilAutoRun
|
||||||
Invoke-WinUtilAutoRun
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Host "Did you forget to add '--Run'?";
|
|
||||||
}
|
|
||||||
$sync.runspace.Dispose()
|
$sync.runspace.Dispose()
|
||||||
$sync.runspace.Close()
|
$sync.runspace.Close()
|
||||||
[System.GC]::Collect()
|
[System.GC]::Collect()
|
||||||
@@ -386,7 +382,7 @@ $sync["Form"].Add_ContentRendered({
|
|||||||
if ($PARAM_CONFIG -and -not [string]::IsNullOrWhiteSpace($PARAM_CONFIG)) {
|
if ($PARAM_CONFIG -and -not [string]::IsNullOrWhiteSpace($PARAM_CONFIG)) {
|
||||||
Write-Host "Running config file tasks..."
|
Write-Host "Running config file tasks..."
|
||||||
Invoke-WPFImpex -type "import" -Config $PARAM_CONFIG
|
Invoke-WPFImpex -type "import" -Config $PARAM_CONFIG
|
||||||
if ($PARAM_RUN) {
|
Invoke-WPFRunspace -ScriptBlock {
|
||||||
Invoke-WinUtilAutoRun
|
Invoke-WinUtilAutoRun
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
|
|
||||||
param (
|
param (
|
||||||
[string]$Config,
|
[string]$Config,
|
||||||
[switch]$Run,
|
|
||||||
[switch]$Noui,
|
[switch]$Noui,
|
||||||
[switch]$Offline
|
[switch]$Offline
|
||||||
)
|
)
|
||||||
@@ -17,12 +16,6 @@ if ($Config) {
|
|||||||
$PARAM_CONFIG = $Config
|
$PARAM_CONFIG = $Config
|
||||||
}
|
}
|
||||||
|
|
||||||
$PARAM_RUN = $false
|
|
||||||
# Handle the -Run switch
|
|
||||||
if ($Run) {
|
|
||||||
$PARAM_RUN = $true
|
|
||||||
}
|
|
||||||
|
|
||||||
$PARAM_NOUI = $false
|
$PARAM_NOUI = $false
|
||||||
if ($Noui) {
|
if ($Noui) {
|
||||||
$PARAM_NOUI = $true
|
$PARAM_NOUI = $true
|
||||||
|
|||||||
Reference in New Issue
Block a user