first of all, you can use #!/usr/bin/env pwsh to indicate files as powershell scripts,
and change profile command to powershell.exe -NoLogo to disable startup banner
some magic registry tweaks
# New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\CI\Policy' -Name 'VerifiedAndReputablePolicyState' -PropertyType DWord -Value 2 -Force # 0
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\TimeZoneInformation' -Name 'RealTimeIsUniversal' -PropertyType DWord -Value 1 -Force # null
# New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Bluetooth\Audio\AVRCP\CT' -Name 'DisableAbsoluteVolume' -PropertyType DWord -Value 1 -Force # 0
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Services\usbhub\HubG' -Name 'DisableOnSoftRemove' -PropertyType DWord -Value 1 -Force # null
# New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\SecureBoot\SBAT' -Name 'OptOut' -PropertyType DWord -Value 1 -Force # null
New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\Lsa' -Name 'LsaCfgFlags' -PropertyType DWord -Value 0 -Force # null
# New-ItemProperty -Path 'HKCU:\SOFTWARE\Classes\CLSID\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}' -Name 'System.IsPinnedToNameSpaceTree' -PropertyType DWord -Value 0 -Force # null
# reg add HKEY_CURRENT_USER\Software\Classes\CLSID\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c} /f /v "System.IsPinnedToNameSpaceTree" /t REG_DWORD /d 0x00000000
# reg delete HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c} /f
Remove-Item -Path 'HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\Desktop\NameSpace\{e88865ea-0e1c-4e20-9aa6-edcd0212c87c}' -Recurse -Force
Remove-ItemProperty -Path 'HKLM:\SOFTWARE\RegisteredApplications' -Name 'Firefox-308046B0AF4A39CB' -Force # REG_SZ Software\Clients\StartMenuInternet\Firefox-308046B0AF4A39CB\Capabilities
[Environment]::SetEnvironmentVariable('PortableProgramFiles', "${Env:SystemDrive}\Portable", 'Machine')
[Environment]::SetEnvironmentVariable('POWERSHELL_TELEMETRY_OPTOUT', '1', 'Machine')
[Environment]::SetEnvironmentVariable('POWERSHELL_UPDATECHECK', 'LTS', 'Machine')
[Environment]::SetEnvironmentVariable('DOTNET_CLI_TELEMETRY_OPTOUT', '1', 'Machine')
# [Environment]::SetEnvironmentVariable('LANG', 'C', 'Machine')
[Environment]::SetEnvironmentVariable('MSYS', 'winsymlinks:lnk', 'Machine')
[Environment]::SetEnvironmentVariable('MSYS2_PATH_TYPE', 'strict', 'Machine') # strict (without %WINDIR%) | minimal (only %WINDIR%) | inherit (unrestricted)
## also, 'C:\Users\Misaka4a92\AppData\Local\Microsoft\Edge\User Data\Default\Top Sites' deny delete,change
## msiexec /i firefox.msi DESKTOP_SHORTCUT=false OPTIONAL_EXTENSIONS=false
Get-WmiObject Win32_Product | Sort-Object -Property Name | Format-Table
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope LocalMachine
Get-ExecutionPolicy LocalMachine
winget
winget.exe source remove msstore
winget.exe install --scope machine --source winget -e --id Nushell.Nushell -h --override "/QN ALLUSERS=1"
winget.exe install --scope machine --source winget -e elves.elvish aria2.aria2 Neovim.Neovim Google.PlatformTools twpayne.chezmoi Git.MinGit.BusyBox Hugo.Hugo.Extended
winget.exe install --scope machine --source winget -e --id EclipseAdoptium.Temurin.21.JRE # or winget.exe install --scope machine --source winget -e --id EclipseAdoptium.Temurin.21.JDK
winget.exe install --scope machine --source winget -e --id voidtools.Everything.Lite
# winget.exe install --scope machine --source winget -e --id uutils.coreutils
Appx removal
$aAppxToRemove = "Microsoft.Windows.PeopleExperienceHost"
# $aAppxToRemove = "Microsoft.Windows.CloudExperienceHost"
$aAllAppxPackage = Get-AppxPackage -Allusers $aAppxToRemove
foreach ($Appx in $aAllAppxPackage) {
New-Item ("HKLM:\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\Deprovisioned\{0}" -f $Appx.PackageFamilyName) -Force | Out-Null
$aSIDs = ($Appx | Select-Object -ExpandProperty PackageUserInformation).UserSecurityId.Sid
foreach ($sSID in $aSIDs) {
New-Item ("HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\EndOfLife\{0}" -f $sSID) -Force | Out-Null
New-Item ("HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\EndOfLife\{0}\{1}" -f $sSID , $Appx.PackageFullName) -Force | Out-Null
}
}
Get-AppxPackage -AllUsers $aAppxToRemove | Remove-AppxPackage -Allusers | Out-Null
foreach ($Appx in $aAllAppxPackage) {
$aSIDs = ($Appx | Select-Object -ExpandProperty PackageUserInformation).UserSecurityId.Sid
foreach ($sSID in $aSIDs) {
# Remove-Item ("HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Appx\AppxAllUserStore\EndOfLife\{0}\{1}" -f $sSID , $Appx.PackageFullName) -Recurse -Force | Out-Null
}
}
Get-AppxPackage -AllUsers $aAppxToRemove