Jump to content

Uninstall NINJARMM Agent


eDecisions
 Share

Recommended Posts

I don't think its possible to have more than one NINJARMM Agent installed, however if there are this script will likely fail, but for a clean ninja install will locate the correct uninstall path and uninstall the ninja agent.

 

$UninstallString = (Get-ItemProperty HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\NinjaRMMAgent*).UninstallString

Start-Process -FilePath "$UninstallString" -ArgumentList "--mode unattended"

 

Link to comment
Share on other sites

Revised script, the (x86) was causing issues, this seems to have fixed

 

$UninstallString = (Get-ItemProperty HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\NinjaRMMAgent*).UninstallString


$path = $UninstallString -replace "uninstall.exe", ""

cd $path

Start-Process -FilePath .\uninstall.exe -ArgumentList "--mode","unattended"
 

Link to comment
Share on other sites

Darn, the MSI and agent both need to be removed, I wrote this to finish it up, but if anyone has a better way or can assist with a loop to pull both keys in one pass, I'm just tired. and this worked and all are removed from 500 stations with this one so I don't need it any more. I'd sense used the Get-ChildItem to uninstall several other programs, but I know it will pull more than one path so I'd love to re-write this to loop thru all the possible msi and exe and hit them both in a few lines rather than this, but it works as is, any input from someone more knowledgeableble than me please, I'm not proud.

 

$UninstallString = (Get-ItemProperty HKLM:\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Uninstall\NinjaRMMAgent*).UninstallString

sleep -seconds 2

if (!$UninstallString) { exit }

sleep -seconds 2

$path = $UninstallString -replace "uninstall.exe", ""

sleep -seconds 5

cd $path

sleep -seconds 5

Start-Process -FilePath .\uninstall.exe -ArgumentList "--mode","unattended"

sleep -seconds 40

$Uninstall2 = Get-ChildItem -Path HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall, HKLM:\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall | Get-ItemProperty | Where-Object {$_.DisplayName -match "NinjaRMMAgent" } | Select-Object -Property UninstallString | foreach { $_.UninstallString }

sleep -seconds 220

$Uninstall3 = $Uninstall2 -Replace "MsiExec.exe " , ""

sleep -seconds 5

Start-Process -FilePath MSIExec.exe -ArgumentList $Uninstall3,"/quiet","/passive"

 

 

Link to comment
Share on other sites

  • 1 year later...
On 10/5/2021 at 1:52 AM, santiagoma said:

Hi guys, I need to run a script to remove ninja rmm on 20 machines locate on different sites. Can someone advice how I can do that running an script using powershell. Thanks

Does the info provided above not help you? If not, shoot me a PM, I'll help you out. 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...