Merge pull request #660 from silversword411/develop
Script library - uninstall software
This commit is contained in:
commit
b0b51f5730
|
@ -244,6 +244,16 @@
|
|||
"shell": "powershell",
|
||||
"category": "TRMM (Win):3rd Party Software"
|
||||
},
|
||||
{
|
||||
"guid": "907652a5-9ec1-4759-9871-a7743f805ff2",
|
||||
"filename": "Win_Software_Uninstall.ps1",
|
||||
"submittedBy": "https://github.com/subzdev",
|
||||
"name": "Software Uninstaller - list, find, and uninstall most software",
|
||||
"description": "Allows listing, finding and uninstalling most software on Windows. There will be a best effort to uninstall silently if the silent uninstall string is not provided.",
|
||||
"shell": "powershell",
|
||||
"category": "TRMM (Win):3rd Party Software",
|
||||
"default_timeout": "600"
|
||||
},
|
||||
{
|
||||
"guid": "64c3b1a8-c85f-4800-85a3-485f78a2d9ad",
|
||||
"filename": "Win_Bitdefender_GravityZone_Install.ps1",
|
||||
|
|
|
@ -24,6 +24,18 @@ This is better
|
|||
|
||||

|
||||
|
||||
## Install VSCode Extensions
|
||||
|
||||
[Remote - Containers](https://marketplace.visualstudio.com/items?itemName=ms-vscode-remote.remote-containers)
|
||||
|
||||
[Docker](https://marketplace.visualstudio.com/items?itemName=ms-azuretools.vscode-docker)
|
||||
|
||||
## Connect to WSL and clone your Github fork
|
||||
|
||||

|
||||
|
||||

|
||||
|
||||
## Create .env file
|
||||
|
||||
Under .devcontainer duplicate
|
||||
|
@ -46,7 +58,20 @@ Customize to your tastes (it doesn't need to be internet configured, just add re
|
|||
127.0.0.1 mesh.example.com
|
||||
```
|
||||
|
||||
## View mkdocks live edits in browser
|
||||
## Launch your Dev VM in Docker
|
||||
|
||||
Right-click `docker-compose.yml` and choose `Compose Up`
|
||||
|
||||
Wait, it'll take a while as docker downloads all the modules and gets running.
|
||||
|
||||
## Develop!
|
||||
|
||||
You're operational!
|
||||
|
||||
!!!note
|
||||
Self-signed certs are in your dev environment. Navigate to https://api.example.com and https://rmm.example.com and accept the self signed certs to get rid of errors.
|
||||
|
||||
### View mkdocks live edits in browser
|
||||
|
||||
Change stuff in `/docs/docs/`
|
||||
|
||||
|
@ -54,6 +79,7 @@ mkdocs is Exposed on Port: 8005
|
|||
|
||||
Open: [http://rmm.example.com:8005/](http://rmm.example.com:8005/)
|
||||
|
||||
## View django administration
|
||||
### View django administration
|
||||
|
||||
Open: [http://rmm.example.com:8000/admin/](http://rmm.example.com:8000/admin/)
|
||||
|
||||
Open: [http://rmm.example.com:8000/admin/](http://rmm.example.com:8000/admin/)
|
Binary file not shown.
After Width: | Height: | Size: 78 KiB |
Binary file not shown.
After Width: | Height: | Size: 6.8 KiB |
|
@ -105,4 +105,12 @@ Use powershell, make sure you can connect to 443 and 4222 from agent to server:
|
|||
Test-NetConnection -ComputerName api.example.com -Port 4222
|
||||
```
|
||||
|
||||
Are you trying to use a proxy to share your single home public IP with multiple services on 443? This is complicated, test your setup.
|
||||
```powershell
|
||||
Test-NetConnection -ComputerName api.example.com -Port 443
|
||||
```
|
||||
|
||||
```powershell
|
||||
Test-NetConnection -ComputerName rmm.example.com -Port 443
|
||||
```
|
||||
|
||||
Are you trying to use a proxy to share your single public IP with multiple services on 443? This is complicated and [unsupported by Tactical RMM](unsupported_scripts.md), test your setup.
|
|
@ -0,0 +1,206 @@
|
|||
<#
|
||||
.Synopsis
|
||||
Allows listing, finding and uninstalling most software on Windows. There will be a best effort to uninstall silently if the silent
|
||||
uninstall string is not provided.
|
||||
.DESCRIPTION
|
||||
Allows listing, finding and uninstalling most software on Windows. There will be a best effort to uninstall silently if the silent
|
||||
uninstall string is not provided.
|
||||
.INPUTS
|
||||
-list Will list all installed 32-bit and 64-bit software installed on the target machine.
|
||||
-list "<software name>" will find a particular application installed giving you the uninstall string and quiet uninstall string if it exists
|
||||
-list "<software name>" -u "<uninstall string>" will allow you to uninstall the software from the Windows machine silently
|
||||
-list "<software name>" -u "<quiet uninstall string>" will allow you to uninstall the software from the Windows machine silently
|
||||
.EXAMPLE
|
||||
Follow the steps below via script arguments to find and then uninstall VLC Media Player.
|
||||
Step 1: -list "vlc"
|
||||
Step 1 result:
|
||||
1 results
|
||||
**********
|
||||
Name: VLC media player
|
||||
Version: 3.0.12
|
||||
Uninstall String: "C:\Program Files\VideoLAN\VLC\uninstall.exe"
|
||||
**********
|
||||
Step 2: -list "vlc" -u "C:\Program Files\VideoLAN\VLC\uninstall.exe"
|
||||
Step 3: Will get result back stating if the application has been uninstalled or not.
|
||||
.EXAMPLE
|
||||
For a more complex uninstall of for example the Bentley CONNECTION Client with extra arguments.
|
||||
Step 1: -list "CONNECTION Client"
|
||||
Step 1 result:
|
||||
2 results
|
||||
**********
|
||||
Name: CONNECTION Client
|
||||
Version: 11.0.3.14
|
||||
Silent Uninstall String: "C:\ProgramData\Package Cache\{54c12e19-d8a1-4c26-80cd-6af08f602d4f}\Setup_CONNECTIONClientx64_11.00.03.14.exe" /uninstall /quiet
|
||||
**********
|
||||
Name: CONNECTION Client
|
||||
Version: 11.00.03.14
|
||||
Uninstall String: MsiExec.exe /X{BF2011BD-2485-4CBA-BBFB-93205438C75B}
|
||||
**********
|
||||
Step 2: -list "CONNECTION Client" -u "C:\ProgramData\Package Cache\{54c12e19-d8a1-4c26-80cd-6af08f602d4f}\Setup_CONNECTIONClientx64_11.00.03.14.exe" -args "/uninstall /quiet"
|
||||
Step 3: Will get result back stating if the application has been uninstalled or not.
|
||||
.NOTES
|
||||
See https://github.com/subzdev/uninstall_software/blob/main/uninstall_software.ps1 . If you have extra additions please feel free to contribute and create PR
|
||||
v1.0 - 8/18/2021 Initial release
|
||||
#>
|
||||
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[switch]$list,
|
||||
[string]$find,
|
||||
[string]$u,
|
||||
[string]$args
|
||||
)
|
||||
|
||||
$Paths = @("HKLM:\SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Uninstall\*", "HKLM:\SOFTWARE\\Wow6432node\\Microsoft\\Windows\\CurrentVersion\\Uninstall\*", "HKU:\*\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\*")
|
||||
|
||||
$null = New-PSDrive -Name HKU -PSProvider Registry -Root Registry::HKEY_USERS
|
||||
|
||||
If ($list -And !($find) -And !($u) -And !($args)) {
|
||||
|
||||
$ResultCount = (Get-ItemProperty $Paths | Where-Object { $_.UninstallString -notlike "" } | Measure-Object).Count
|
||||
Write-Output "$($ResultCount) results `r"
|
||||
Write-Output "********** `n"
|
||||
|
||||
foreach ($app in Get-ItemProperty $Paths | Where-Object { $_.UninstallString -notlike "" } | Sort-Object DisplayName) {
|
||||
|
||||
if ($app.UninstallString) {
|
||||
$UninstallString = if ($app.QuietUninstallString) { "Silent Uninstall String: $($app.QuietUninstallString)" } else { "Uninstall String: $($app.UninstallString)" }
|
||||
Write-Output "Name: $($app.DisplayName)"
|
||||
Write-Output "Version: $($app.DisplayVersion)"
|
||||
Write-Output $UninstallString
|
||||
Write-Output "`r"
|
||||
Write-Output "**********"
|
||||
Write-Output "`r"
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
If ($list -And $find -And !($u)) {
|
||||
|
||||
$FindResults = (Get-ItemProperty $Paths | Where-object { $_.Displayname -match [regex]::Escape($find) } | Measure-Object).Count
|
||||
Write-Output "`r"
|
||||
Write-Output "$($FindResults) results `r"
|
||||
Write-Output "********** `n"
|
||||
foreach ($app in Get-ItemProperty $Paths | Where-Object { $_.Displayname -match [regex]::Escape($find) } | Sort-Object DisplayName) {
|
||||
|
||||
if ($app.UninstallString) {
|
||||
$UninstallString = if ($app.QuietUninstallString) { "Silent Uninstall String: $($app.QuietUninstallString)" } else { "Uninstall String: $($app.UninstallString)" }
|
||||
Write-Output "Name: $($app.DisplayName)"
|
||||
Write-Output "Version: $($app.DisplayVersion)"
|
||||
Write-Output $UninstallString
|
||||
Write-Output "`r"
|
||||
Write-Output "**********"
|
||||
Write-Output "`r"
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
##################################
|
||||
#uninstall code 32-bit and 64-bit
|
||||
#################################
|
||||
Function WithArgs ($u, $exeargs) {
|
||||
Start-Process -Filepath "$u" -ArgumentList $exeargs -Wait
|
||||
$UninstallTest = (Get-ItemProperty $Paths | Where-object { $_.UninstallString -match [regex]::Escape($u) }).DisplayName
|
||||
If ($UninstallTest) {
|
||||
|
||||
Write-Output "$($AppName) has not been uninstalled"
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Output "$($AppName) has been uninstalled"
|
||||
}
|
||||
}
|
||||
|
||||
$AppName = (Get-ItemProperty $Paths | Where-object { $_.UninstallString -match [regex]::Escape($u) }).DisplayName
|
||||
|
||||
If ($list -And $find -And $u -Or $u -And !($list)) {
|
||||
|
||||
If ($u -Match [regex]::Escape("MsiExec")) {
|
||||
|
||||
$MsiArguments = $u -Replace "MsiExec.exe /I", "/X" -Replace "MsiExec.exe ", ""
|
||||
Start-Process -FilePath msiexec.exe -ArgumentList "$MsiArguments /quiet /norestart" -Wait
|
||||
$UninstallTest = (Get-ItemProperty $Paths | Where-object { $_.UninstallString -match [regex]::Escape($u) }).DisplayName
|
||||
If ($UninstallTest) {
|
||||
|
||||
Write-Output "$($AppName) has not been uninstalled"
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Output "$($AppName) has been uninstalled"
|
||||
|
||||
}
|
||||
}
|
||||
else {
|
||||
If (Test-Path -Path "$u" -PathType Leaf) {
|
||||
If ($args) {
|
||||
|
||||
$exeargs = $args + ' ' + "/S /SILENT /VERYSILENT /NORESTART"
|
||||
WithArgs $u $exeargs
|
||||
}
|
||||
else {
|
||||
|
||||
$exeargs = "/S /SILENT /VERYSILENT /NORESTART"
|
||||
WithArgs $u $exeargs
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Output "The path '$($u)' does not exist."
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
If ($list -And $u) {
|
||||
|
||||
If ($u -Match [regex]::Escape("MsiExec")) {
|
||||
|
||||
$MsiArguments = $u -Replace "MsiExec.exe /I", "/X" -Replace "MsiExec.exe ", ""
|
||||
Start-Process -FilePath msiexec.exe -ArgumentList "$MsiArguments /quiet /norestart" -Wait
|
||||
$UninstallTest = (Get-ItemProperty $Paths | Where-object { $_.UninstallString -match [regex]::Escape($u) }).DisplayName
|
||||
If ($UninstallTest) {
|
||||
|
||||
Write-Output "$($AppName) has not been uninstalled"
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Output "$($AppName) has been uninstalled"
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
If (Test-Path -Path "$u" -PathType Leaf) {
|
||||
If ($args) {
|
||||
|
||||
$exeargs = $args + ' ' + "/S /SILENT /VERYSILENT /NORESTART"
|
||||
WithArgs $u $exeargs
|
||||
}
|
||||
else {
|
||||
|
||||
$exeargs = "/S /SILENT /VERYSILENT /NORESTART"
|
||||
WithArgs $u $exeargs
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
else {
|
||||
|
||||
Write-Output "The path '$($u)' does not exist."
|
||||
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue