Jump to content

Recommended Posts

Posted

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"

 

Posted

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"
 

Posted

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"

 

 

  • 1 year later...
Posted

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

Posted
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. 

  • 1 year later...
Posted

Hey, I have tried to use this powershell script and coming up with the below if you can help?

(not running it via pulseway)

cd : Cannot find drive. A drive with the name '"C' does not exist.
At C:\WINDOWS\AdminArsenal\PDQDeployRunner\service-1\exec\user.ps1:13 char:1
+ cd $path
+ ~~~~~~~~
    + CategoryInfo          : ObjectNotFound: ("C:String) [Set-Location], DriveNotFoundException
    + FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.SetLocationCommand
 
ScriptHalted
At C:\WINDOWS\AdminArsenal\PDQDeployRunner\service-1\exec\Error Handling Wrapper.ps1:58 char:2
+     Throw $_.Exception.ErrorRecord
+     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : OperationStopped: (:) [], RuntimeException
    + FullyQualifiedErrorId : ScriptHalted
 
 

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
×
×
  • Create New...