Jump to content

Uninstall NINJARMM Agent


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 post
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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...