mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-05-24 00:07:24 -05:00

* Better formatting A bit cleaner * Remove unused scripts This gets rid of file not found errors during setup * Have a fallback method for Recall fixes Go back to the delayed disablement procedure if we fail at modifying the manifest * Ignore Recall disablement when disabled, and more - If Recall is disabled, don't disable it again. This may be a waste of time - Disable certain notification sources that I think are quite annoying, like those from Suggested or the Startup App Notification * Hopefully? Get rid of News and Interests on Win10 Based on PR #3289, add News and Interests removal to MicroWin. Hopefully Windows 10 gets to cooperate this time, compared to last time, where it was quite stubborn. *This means that people never give up trying to fight against something they don't like* * Revert "Refactor preferChocolatey system to handle other package managers eas…" (#3323) This reverts commit 89919494e5030f700664cfe01e9ffe3a49d48cd8. * Fixed all the things that could possibly break * Get rid of extra parameter Package removal fallback fails here. Quite likely a copy from feature disablement --------- Co-authored-by: Chris Titus <contact@christitus.com>
92 lines
3.9 KiB
PowerShell
92 lines
3.9 KiB
PowerShell
function Microwin-NewFirstRun {
|
|
|
|
# using here string to embedd firstrun
|
|
$firstRun = @'
|
|
# Set the global error action preference to continue
|
|
$ErrorActionPreference = "Continue"
|
|
function Remove-RegistryValue {
|
|
param (
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$RegistryPath,
|
|
|
|
[Parameter(Mandatory = $true)]
|
|
[string]$ValueName
|
|
)
|
|
|
|
# Check if the registry path exists
|
|
if (Test-Path -Path $RegistryPath) {
|
|
$registryValue = Get-ItemProperty -Path $RegistryPath -Name $ValueName -ErrorAction SilentlyContinue
|
|
|
|
# Check if the registry value exists
|
|
if ($registryValue) {
|
|
# Remove the registry value
|
|
Remove-ItemProperty -Path $RegistryPath -Name $ValueName -Force
|
|
Write-Host "Registry value '$ValueName' removed from '$RegistryPath'."
|
|
} else {
|
|
Write-Host "Registry value '$ValueName' not found in '$RegistryPath'."
|
|
}
|
|
} else {
|
|
Write-Host "Registry path '$RegistryPath' not found."
|
|
}
|
|
}
|
|
|
|
"FirstStartup has worked" | Out-File -FilePath "$env:HOMEDRIVE\windows\LogFirstRun.txt" -Append -NoClobber
|
|
|
|
$taskbarPath = "$env:AppData\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar"
|
|
# Delete all files on the Taskbar
|
|
Get-ChildItem -Path $taskbarPath -File | Remove-Item -Force
|
|
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesRemovedChanges"
|
|
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "FavoritesChanges"
|
|
Remove-RegistryValue -RegistryPath "HKCU:\Software\Microsoft\Windows\CurrentVersion\Explorer\Taskband" -ValueName "Favorites"
|
|
|
|
# Delete Edge Icon from the desktop
|
|
$edgeShortcutFiles = Get-ChildItem -Path $desktopPath -Filter "*Edge*.lnk"
|
|
# Check if Edge shortcuts exist on the desktop
|
|
if ($edgeShortcutFiles) {
|
|
foreach ($shortcutFile in $edgeShortcutFiles) {
|
|
# Remove each Edge shortcut
|
|
Remove-Item -Path $shortcutFile.FullName -Force
|
|
Write-Host "Edge shortcut '$($shortcutFile.Name)' removed from the desktop."
|
|
}
|
|
}
|
|
Remove-Item -Path "$env:USERPROFILE\Desktop\*.lnk"
|
|
Remove-Item -Path "$env:HOMEDRIVE\Users\Default\Desktop\*.lnk"
|
|
|
|
try
|
|
{
|
|
if ((Get-WindowsOptionalFeature -Online | Where-Object { $_.State -eq 'Enabled' -and $_.FeatureName -like "Recall" }).Count -gt 0)
|
|
{
|
|
Disable-WindowsOptionalFeature -Online -FeatureName "Recall" -Remove
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
|
|
}
|
|
|
|
# Get BCD entries and set bootmgr timeout accordingly
|
|
try
|
|
{
|
|
# Check if the number of occurrences of "path" is 2 - this fixes the Boot Manager screen issue (#2562)
|
|
if ((bcdedit | Select-String "path").Count -eq 2)
|
|
{
|
|
# Set bootmgr timeout to 0
|
|
bcdedit /set `{bootmgr`} timeout 0
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
|
|
}
|
|
|
|
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.Suggested" /f
|
|
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.Suggested" /v Enabled /t REG_DWORD /d 0 /f
|
|
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.StartupApp" /f
|
|
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Windows.SystemToast.StartupApp" /v Enabled /t REG_DWORD /d 0 /f
|
|
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.SkyDrive.Desktop" /f
|
|
reg add "HKCU\Software\Microsoft\Windows\CurrentVersion\Notifications\Settings\Microsoft.SkyDrive.Desktop" /v Enabled /t REG_DWORD /d 0 /f
|
|
|
|
'@
|
|
$firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force
|
|
}
|