mirror of
https://github.com/ChrisTitusTech/winutil.git
synced 2025-01-12 16:00:37 -06:00
9183e92692
* Set Boot Manager entry timeout to 0 Fixes #2562 * Exclude Windows Hello stuff from package removal * Obscure passwords with Base64 and fix indentation Fixes #3064 * Fix name of excluded package * Update comment It reflects my feelings towards Microsoft when it comes to security a lot better * Remove jargon of scratch directory options * Package exclusion improvements - Removed AppX packages from OS package exclusion list - Added exclusion of PowerShell ISE (source: Discord server - yes, some people still use the PowerShell ISE) * Exclude Windows Photo Viewer from dir removal * Improve copy operation to Ventoy drives This change may fix the issues where there's a conflict between both Ventoy's and MicroWin's unattended answer files, causing target images to stop working as expected during OOBE * Add VirtIO functionality and more enhancements - Added the ability to grab VirtIO Guest Tools - Modified the description of the Copy ISO files function because it basically had nonsense * Fix typo (#3104) * Access specific property of ISO image object Only show the ISO path. No one is interested in the storage type * Add detections for expedited app removal They only affect 24H2 and newer. Earlier releases don't have these expedited apps * Update message * Add VirtIO instructions to MicroWin page * Add DISM command fallback This fallback is triggered if an exception occurs while getting information with the cmdlets (I couldn't test this on my host as everything magically works now - sometimes it threw the Class not registered error) * Exclude OpenSSH from package removal Some people need this to avoid installing third-party programs like PuTTY * Fixed some more indentation
85 lines
3.1 KiB
PowerShell
85 lines
3.1 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 { $_.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
|
|
{
|
|
|
|
}
|
|
|
|
'@
|
|
$firstRun | Out-File -FilePath "$env:temp\FirstStartup.ps1" -Force
|
|
}
|