@@ -151,14 +151,14 @@ DO {
151
151
1 {
152
152
Set-ItemProperty - Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize - Name AppsUseLightTheme - Value 0
153
153
Set-ItemProperty - Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize - Name SystemUsesLightTheme - Value 0
154
- Write-Output " `n Dark mode applied, restarting explorer."
155
- Get-Process explorer | Stop-Process
154
+ Write-Output " `n Dark mode applied, attempting to restart explorer."
155
+ try { Get-Process explorer | Stop-Process } catch { Write-Output " Explorer restart failed: changes will apply after a restart " }
156
156
}
157
157
2 {
158
158
Set-ItemProperty - Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize - Name AppsUseLightTheme - Value 1
159
159
Set-ItemProperty - Path HKCU:\SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize - Name SystemUsesLightTheme - Value 1
160
- Write-Output " `n Light mode applied, restarting explorer."
161
- Get-Process explorer | Stop-Process
160
+ Write-Output " `n Light mode applied, attempting to restart explorer."
161
+ try { Get-Process explorer | Stop-Process } catch { Write-Output " Explorer restart failed: changes will apply after a restart " }
162
162
}
163
163
}
164
164
}
@@ -196,8 +196,8 @@ public class Wallpaper
196
196
if ($Mtrail -In 0 .. 7 ) {
197
197
# https://www.makeuseof.com/windows-mouse-trail-enable-disable/#enable-or-disable-mouse-pointer-trails-using-the-registry-editor
198
198
set-itemProperty ' hkcu:\Control Panel\Mouse' - name MouseTrails - value $Mtrail
199
- Write-Output " Mouse trail set to $Mtrail , restarting explorer"
200
- Get-Process explorer | Stop-Process
199
+ Write-Output " Mouse trail set to $Mtrail , attempting to restart explorer"
200
+ try { Get-Process explorer | Stop-Process } catch { Write-Output " Explorer restart failed: changes will apply after a restart " }
201
201
}
202
202
}
203
203
4 { # Cursor style
@@ -507,8 +507,8 @@ public class Wallpaper
507
507
if ($LongTimePattern -match " \S" ) {
508
508
Set-ItemProperty - Path " HKCU:\Control Panel\International" - name sTimeFormat - value " $LongTimePattern "
509
509
}
510
- Write-Output " Settings applied - restarting explorer"
511
- Get-Process explorer | Stop-Process
510
+ Write-Output " Settings applied, attempting to restart explorer"
511
+ try { Get-Process explorer | Stop-Process } catch { Write-Output " Explorer restart failed: changes will apply after a restart " }
512
512
}
513
513
}
514
514
}
@@ -521,11 +521,11 @@ public class Wallpaper
521
521
}
522
522
1 { # Show long time
523
523
Set-ItemProperty - Path " HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" - name " ShowSecondsInSystemClock" - value 1
524
- Get-Process explorer | Stop-Process
524
+ try { Get-Process explorer | Stop-Process } catch { Write-Output " Explorer restart failed: changes will apply after a restart " }
525
525
}
526
526
2 { # Show short time
527
527
Set-ItemProperty - Path " HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" - name " ShowSecondsInSystemClock" - value 0
528
- Get-Process explorer | Stop-Process
528
+ try { Get-Process explorer | Stop-Process } catch { Write-Output " Explorer restart failed: changes will apply after a restart " }
529
529
}
530
530
}
531
531
}
@@ -579,8 +579,8 @@ public class Wallpaper
579
579
$Settings = (Get-ItemProperty HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3 - Name Settings).Settings
580
580
$Settings [12 ] = $bit
581
581
Set-ItemProperty HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\StuckRects3 - Name Settings - Value $Settings
582
- Write-Output " `n Taskbar moved, restarting explorer."
583
- Get-Process explorer | Stop-Process
582
+ Write-Output " `n Taskbar moved, attempting to restart explorer."
583
+ try { Get-Process explorer | Stop-Process } catch { Write-Output " Explorer restart failed: changes will apply after a restart " }
584
584
}
585
585
3 { # Pin and unpin items ( https://github.com/Ccmexec/PowerShell/blob/master/Customize%20TaskBar%20and%20Start%20Windows%2011/CustomizeTaskbar.ps1 )
586
586
DO {
@@ -696,12 +696,12 @@ public class Wallpaper
696
696
} catch {
697
697
New-ItemProperty - Path " HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" - Name " Start_ShowClassicMode" - Value 1
698
698
}
699
- Get-Process explorer | Stop-Process
699
+ try { Get-Process explorer | Stop-Process } catch { Write-Output " Explorer restart failed: changes will apply after a restart " }
700
700
}
701
701
2 { # New taskbar
702
702
try {
703
703
Set-ItemProperty - Path " HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Advanced" - Name " Start_ShowClassicMode" - Value 0
704
- Get-Process explorer | Stop-Process
704
+ try { Get-Process explorer | Stop-Process } catch { Write-Output " Explorer restart failed: changes will apply after a restart " }
705
705
} catch {
706
706
Write-Output " " # No key is the same as one set to 0
707
707
}
0 commit comments