31 lines
953 B
PowerShell
31 lines
953 B
PowerShell
|
param([switch]$elevated)
|
||
|
# If not in an Administrator environment
|
||
|
If (!(New-Object Security.Principal.WindowsPrincipal $(
|
||
|
[Security.Principal.WindowsIdentity]::GetCurrent()
|
||
|
).IsInRole(
|
||
|
[Security.Principal.WindowsBuiltinRole]::Administrator
|
||
|
)
|
||
|
)) {
|
||
|
# and elevating hasn't already been tried
|
||
|
if (!$elevated) {
|
||
|
# attmempt to become Administrator by re-invoking this script
|
||
|
Start-Process PowerShell -Verb RunAs -ArgumentList (
|
||
|
'-noprofile -noexit -file "{0}" -elevated' -f ($MyInvocation.MyCommand.Definition)
|
||
|
)
|
||
|
}
|
||
|
# otherwise just exit.
|
||
|
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
|
||
|
}
|