PowerShell/full_update.ps1
2023-06-17 15:29:09 -06:00

26 lines
659 B
PowerShell

param([switch]$Elevated)
if ((Test-Admin) -eq $false) {
if ($elevated) {
# tried to elevate, did not work, aborting
}
else {
Start-Process powershell.exe -Verb RunAs -ArgumentList ('-noprofile -noexit -file "{0}" -elevated' -f ($myinvocation.MyCommand.Definition))
}
exit
}
Get-WindowsUpdate -AcceptAll -Install
if (Get-Command "scoop.exe" -ErrorAction SilentlyContinue) {
scoop update
scoop update --all
scoop cache rm *
}
if (Get-Command "bleachbit.exe" -ErrorAction SilentlyContinue) {
# Clean everything selected in the UI last time it was run.
# So... run The UI to set things up initially.
bleachbit --preset --clean
}