diff --git a/README.md b/README.md index 656218d..60a0ebb 100644 --- a/README.md +++ b/README.md @@ -55,9 +55,9 @@ Just put the script with the **AppID** followed by the suffix to be considered i > Runs during uninstall (before uninstall check): `AppID-uninstall.ps1` > Runs after uninstall has been confirmed: `AppID-uninstalled.ps1` -If you're using [**WAU** (Winget-AutoUpdate)](https://github.com/Romanitho/Winget-AutoUpdate) they get copied to the **WAU mods** directory (except `-installed-once.ps1` and `-uninstall.ps1`) and also runs when upgrading apps in **WAU**. +If you're using [**WAU** (Winget-AutoUpdate)](https://github.com/Romanitho/Winget-AutoUpdate) they get copied to the **WAU mods** directory (except `-installed-once.ps1/-preuninstall.ps1/-uninstall.ps1/-uninstalled.ps1`) and also runs when upgrading apps in **WAU**. -`AppID-installed-once.ps1` runs instead of `AppID-installed.ps1` from **Winget-Install** and doesn't get copied to the **WAU mods** directory. +`AppID-installed-once.ps1` runs instead of `AppID-installed.ps1` from **Winget-Install**. They are deleted from **WAU** on an uninstall (if deployed from **Winget-Install**) diff --git a/mods/_AppID-template.ps1 b/mods/_AppID-template.ps1 index bfbcca6..4bbd952 100644 --- a/mods/_AppID-template.ps1 +++ b/mods/_AppID-template.ps1 @@ -1,6 +1,8 @@ <# ARRAYS/VARIABLES #> #App to Run (as SYSTEM) -#$RunWait = $False if it shouldn't be waited for completion +#$RunWait = $False if it shouldn't be waited for completion. Example: +#$RunSystem = "$PSScriptRoot\bins\MsiZap.exe" +#$RunSwitch = "tw! {GUID}" $RunSystem = "" $RunSwitch = "" $RunWait = $True diff --git a/mods/_Mods-Functions.ps1 b/mods/_Mods-Functions.ps1 index 40ecf98..607d3d0 100644 --- a/mods/_Mods-Functions.ps1 +++ b/mods/_Mods-Functions.ps1 @@ -162,7 +162,10 @@ function Remove-ModsLnk ($Lnk) { } function Add-ModsReg ($AddKey, $AddValue, $AddTypeData, $AddType) { - if (!Test-Path "$AddKey") { + if ($AddKey -like "HKEY_LOCAL_MACHINE*") { + $AddKey = $AddKey.replace("HKEY_LOCAL_MACHINE","HKLM:") + } + if (!(Test-Path "$AddKey")) { New-Item $AddKey -Force -ErrorAction SilentlyContinue | Out-Null } New-ItemProperty $AddKey -Name $AddValue -Value $AddTypeData -PropertyType $AddType -Force | Out-Null @@ -170,6 +173,9 @@ function Add-ModsReg ($AddKey, $AddValue, $AddTypeData, $AddType) { } function Remove-ModsReg ($DelKey, $DelValue) { + if ($DelKey -like "HKEY_LOCAL_MACHINE*") { + $DelKey = $DelKey.replace("HKEY_LOCAL_MACHINE","HKLM:") + } if (Test-Path "$DelKey") { if (!$DelValue) { Remove-Item $DelKey -Recurse -Force -ErrorAction SilentlyContinue | Out-Null diff --git a/mods/bins/README.md b/mods/bins/README.md new file mode 100644 index 0000000..810266a --- /dev/null +++ b/mods/bins/README.md @@ -0,0 +1,8 @@ +A Directory for placing useful **bins** (**MsiZap.exe** as a really good example) for running via the **Template Function** (https://support.microfocus.com/kb/doc.php?id=7023386): + +#$RunWait = $False if it shouldn't be waited for completion. Example: +#$RunSystem = "$PSScriptRoot\bins\MsiZap.exe" +#$RunSwitch = "tw! `{GUID}`" +$Run = "" +$RunSwitch = "" +$RunWait = $True