2022-12-20 01:54:14 +00:00
|
|
|
<# ARRAYS/VARIABLES #>
|
2023-01-09 00:25:39 +00:00
|
|
|
#App to Run ($RunWait = $False if it shouldn't be waited for)
|
|
|
|
$Run = ""
|
|
|
|
$RunSwitch = ""
|
|
|
|
$RunWait = $True
|
|
|
|
|
2022-12-20 01:54:14 +00:00
|
|
|
#Beginning of Process Name to Stop - optional wildcard (*) after, without .exe, multiple: "proc1","proc2"
|
|
|
|
$Proc = @("")
|
|
|
|
|
2022-12-20 02:19:46 +00:00
|
|
|
#Beginning of Process Name to Wait for to End - optional wildcard (*) after, without .exe, multiple: "proc1","proc2"
|
2022-12-20 01:54:14 +00:00
|
|
|
$Wait = @("")
|
|
|
|
|
2022-12-21 22:56:59 +00:00
|
|
|
#Beginning of App Name string to Silently Uninstall (MSI/NSIS/INNO/EXE with defined silent uninstall in registry)
|
2023-01-05 14:37:30 +00:00
|
|
|
#Multiple: "app1*","app2*", required wildcard (*) after; search is done with "-like"!
|
|
|
|
$App = @("")
|
2022-12-20 01:54:14 +00:00
|
|
|
|
|
|
|
#Beginning of Desktop Link Name to Remove - optional wildcard (*) after, without .lnk, multiple: "lnk1","lnk2"
|
|
|
|
$Lnk = @("")
|
|
|
|
|
2023-01-03 05:16:19 +00:00
|
|
|
#Registry _value_ (DWord/String) to add in existing registry Key (Key created if not existing). Example:
|
2023-01-03 04:22:31 +00:00
|
|
|
#$AddKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
|
|
|
|
#$AddValue = "WAU_BypassListForUsers"
|
2023-01-03 04:29:13 +00:00
|
|
|
#$AddTypeData = "1"
|
2023-01-03 04:22:31 +00:00
|
|
|
#$AddType = "DWord"
|
|
|
|
$AddKey = ""
|
|
|
|
$AddValue = ""
|
2023-01-03 04:29:13 +00:00
|
|
|
$AddTypeData = ""
|
2023-01-03 04:22:31 +00:00
|
|
|
$AddType = ""
|
|
|
|
|
2023-01-05 07:00:41 +00:00
|
|
|
#Registry _value_ to delete in existing registry Key.
|
|
|
|
#Value can be omitted for deleting entire Key!. Example:
|
2023-01-03 04:22:31 +00:00
|
|
|
#$DelKey = "HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Winget-AutoUpdate"
|
|
|
|
#$DelValue = "WAU_BypassListForUsers"
|
|
|
|
$DelKey = ""
|
|
|
|
$DelValue = ""
|
|
|
|
|
2023-01-05 05:57:37 +00:00
|
|
|
#Remove file/directory, multiple: "file1","file2"
|
|
|
|
$DelFile = @("")
|
|
|
|
|
2023-01-08 22:18:40 +00:00
|
|
|
#Copy file/directory
|
|
|
|
#Example:
|
|
|
|
#$CopyFile = "C:\Logfiles"
|
|
|
|
#$CopyTo = "C:\Drawings\Logs"
|
|
|
|
$CopyFile = ""
|
|
|
|
$CopyTo = ""
|
|
|
|
|
2022-12-20 01:54:14 +00:00
|
|
|
<# FUNCTIONS #>
|
2022-12-20 02:36:44 +00:00
|
|
|
. $PSScriptRoot\_Mods-Functions.ps1
|
2022-12-20 01:54:14 +00:00
|
|
|
|
|
|
|
<# MAIN #>
|
2023-01-09 00:25:39 +00:00
|
|
|
if ($Run) {
|
|
|
|
Invoke-ModsApp $Run $RunSwitch $RunWait
|
|
|
|
}
|
2022-12-20 01:54:14 +00:00
|
|
|
if ($Proc) {
|
|
|
|
Stop-ModsProc $Proc
|
|
|
|
}
|
|
|
|
if ($Wait) {
|
|
|
|
Wait-ModsProc $Wait
|
|
|
|
}
|
|
|
|
if ($App) {
|
|
|
|
Uninstall-ModsApp $App
|
|
|
|
}
|
|
|
|
if ($Lnk) {
|
|
|
|
Remove-ModsLnk $Lnk
|
|
|
|
}
|
2023-01-03 04:29:13 +00:00
|
|
|
if ($AddKey -and $AddValue -and $AddTypeData -and $AddType) {
|
|
|
|
Add-ModsReg $AddKey $AddValue $AddTypeData $AddType
|
2023-01-03 04:22:31 +00:00
|
|
|
}
|
2023-01-05 07:00:41 +00:00
|
|
|
if ($DelKey) {
|
2023-01-03 04:22:31 +00:00
|
|
|
Remove-ModsReg $DelKey $DelValue
|
|
|
|
}
|
2023-01-05 05:57:37 +00:00
|
|
|
if ($DelFile) {
|
|
|
|
Remove-ModsFile $DelFile
|
|
|
|
}
|
2023-01-08 22:18:40 +00:00
|
|
|
if ($CopyFile -and $CopyTo) {
|
|
|
|
Copy-ModsFile $CopyFile $CopyTo
|
|
|
|
}
|
2022-12-20 01:54:14 +00:00
|
|
|
|
|
|
|
<# EXTRAS #>
|