-
-
Notifications
You must be signed in to change notification settings - Fork 80
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use scheduled task instead of PowerShell logon script
- Loading branch information
1 parent
7b0dea1
commit ea73181
Showing
5 changed files
with
22 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,11 @@ | ||
reg.exe load 'HKU\DefaultUser' 'C:\Users\Default\NTUSER.DAT'; | ||
|
||
if( [System.Environment]::OSVersion.Version.Build -lt 20000 ) { | ||
# Windows 10 | ||
reg.exe load 'HKU\DefaultUser' 'C:\Users\Default\NTUSER.DAT'; | ||
Set-ItemProperty -LiteralPath 'Registry::HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Explorer' -Name 'EnableAutoTray' -Type 'DWord' -Value 0 -Force; | ||
reg.exe unload 'HKU\DefaultUser'; | ||
} else { | ||
# Windows 11 | ||
$command = 'powershell.exe -NoProfile -Command "{0}"' -f { | ||
Set-Location -LiteralPath 'HKCU:\'; | ||
Get-Item -Path 'HKCU:\Control Panel\NotifyIconSettings\*' -ErrorAction 'SilentlyContinue' | ForEach-Object -Process { | ||
$_ | Set-ItemProperty -Name 'IsPromoted' -Value 1 -Type 'DWord'; | ||
}; | ||
}; | ||
Set-ItemProperty -LiteralPath 'Registry::HKU\DefaultUser\Software\Microsoft\Windows\CurrentVersion\Run' -Name 'ShowAllTrayIcons' -Type 'String' -Value $command -Force; | ||
} | ||
|
||
reg.exe unload 'HKU\DefaultUser'; | ||
Register-ScheduledTask -TaskName 'ShowAllTrayIcons' -Xml $( | ||
Get-Content -LiteralPath "C:\Windows\Setup\Scripts\ShowAllTrayIcons.xml" -Raw; | ||
); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
Set shell = CreateObject( "WScript.Shell" ) | ||
Set exec = shell.Exec( "reg.exe QUERY ""HKCU\Control Panel\NotifyIconSettings""" ) | ||
Set re = New RegExp | ||
re.Pattern = "^HKEY_CURRENT_USER\\Control Panel\\NotifyIconSettings\\\d+$" | ||
While Not exec.StdOut.AtEndOfStream | ||
line = exec.StdOut.ReadLine | ||
If re.Test( line ) Then | ||
shell.RegWrite line + "\IsPromoted", 1, "REG_DWORD" | ||
End If | ||
Wend |
Binary file not shown.