eDecisions Posted July 26, 2020 Share Posted July 26, 2020 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 More sharing options...
eDecisions Posted July 26, 2020 Author Share Posted July 26, 2020 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" _mike 1 Link to comment Share on other sites More sharing options...
eDecisions Posted July 29, 2020 Author Share Posted July 29, 2020 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 More sharing options...
santiagoma Posted October 5, 2021 Share Posted October 5, 2021 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 Link to comment Share on other sites More sharing options...
Mark G38 Posted October 10, 2021 Share Posted October 10, 2021 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 More sharing options...
adamj84 Posted November 22, 2022 Share Posted November 22, 2022 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now