Nessus Agent Uninstall Stuck on Running

Hello,

i am trying to uninstall Nessus Agent from multiple machines and task is running fine and i can see it deletes the reg and the agent itself but status of the task stuck on running . here is the line i am using.

waithidden msiexec.exe /X { name of keys whose( (exists values “DisplayName” whose(it as string as lowercase starts with “Nessus Agent (x64)” as lowercase) of it) AND (exists values whose(it as string as lowercase starts with “msiexec”) of it) ) of keys “HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall” of ( x64 registries; x32 registries ) } /qn

I also did try to use the ;

waithidden MsiExec.exe /X"{{cbb738f6-cbe4-4856-a09a-c8dceb55453f}"/qn

But same issue, task status is stuck on running .

Could anybody have an idea?

If you are 100% sure the command itself works (tried it manually via cmd on a box that is having a problem through BigFix and it completes fine without any additional prompts or anything) then you need to check off different things but you need to make sure it does first - I’ve seen certain software require passwords to uninstall or other parameters. Once you are sure of the command itself you need to go down the list - for example, are you accounting for the syswow32 redirection? By default, the above is running the 32bit version of msiexec.exe (C:\Windows\SysWOW64\msiexec.exe) not the x64 version (C:\Windows\System32\msiexec.exe) but your relevance is trying pointing to both x64 and x32 registries/software. Another issue I’ve seen is certain commands actually in the background interact with the login session and use some user variables where through BigFix it most-likely is running as SYSTEM and those do not exist - it’s a bit harder to verify that but there are certain ways to test manual executions of commands to be ran as SYSTEM (google it, you’d fine examples). I doubt it’s the latter since it’s msiexec but worth a try if you’ve ruled the others already.

I’d recommend using the wow redirect at the start of the fixlet as @ageorgiev has suggested

action uses wow64 redirection false

https://developer.bigfix.com/action-script/reference/execution/action-uses-wow64-redirection.html

This didn’t work same issue .

What happened when you ran msiexec manually? Any pop-up windows you had to confirm or acknowledge?

It seems like that is the issue . a pop up window coming and asking if i want to delete all related files on this sytem …
So how can i make scripts to go ahead and click yes ? do i have to create a batch file for this or can BF action script can d that ?

To silently uninstall Nessus Agent on Windows from msiexec:

Open PowerShell as an administrator.

Run the following command:

Get-WmiObject Win32_Product |Format-Table IdentifyingNumber, Name

Find and copy the identifying number for the agent installation to a text editor of your choice.

Run msiexec with the identifying number to remove the agent.

msiexec.exe /x “{xxxxx-xxx…}” /qn

Run the command in step 2 to determine whether the agent is still installed.

https://docs.tenable.com/nessus/Content/RemoveNessusAgentWindows.htm

1 Like

I saw this guide too but the problem is we disabled power shell in machines and I have to uninstall Nessus from
Large amount of machines . So this is not an option . Do you know if there is any way to force pop up to cont via bf action script ? I have tried “/qn” even locally thru command window and still Pop up coming .

The problem is that Nessus has an action in their MSI that does not suppress the message on silent uninstall…you’ll need to check with them on whether there is a custom MSI property you can set on the command line to suppress the message.

It may be crucial, in that link from @FatScottishGuy, to remove the agent from the Nessus server first?

Having looked at our uninstall fixlet, it seems I found this troublesome:

// unlink agent
if {exists file "nessuscli.exe" of folder "Nessus Agent" of folder "Tenable" of (program files x64 folder; program files x32 folder) }
	wait "{pathname of file "nessuscli.exe" of folder "Nessus Agent" of folder "Tenable" of (program files x64 folder; program files x32 folder)}" agent unlink
endif
// stop service
if {exists running service whose(display name of it as lowercase contains "tenable nessus agent") }
	wait sc stop "{service name of service whose(display name of it as lowercase contains "tenable nessus agent")}"
	pause while {exists running service whose(display name of it as lowercase contains "tenable nessus agent") }
endif
// delete service
if {exists service whose(display name of it as lowercase contains "tenable nessus agent") }
	wait sc delete "{service name of service whose(display name of it as lowercase contains "tenable nessus agent")}"
	pause while {exists service whose(display name of it as lowercase contains "tenable nessus agent") }
endif
// uninstall msi
if {exist keys whose( (exists values "DisplayName" whose(it as string as lowercase starts with "Nessus Agent" as lowercase) of it) AND (exists values whose(it as string as lowercase starts with "msiexec") of it) ) of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of ( x64 registries; x32 registries ) }
	parameter "theDisplayName" = "Nessus Agent"
	waithidden msiexec.exe /X { name of keys whose( (exists values "DisplayName" whose(it as string as lowercase starts with (parameter "theDisplayName") as lowercase) of it) AND (exists values whose(it as string as lowercase starts with "msiexec") of it) ) of keys "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall" of ( x64 registries; x32 registries ) } /qn /norestart
endif

Looks like I could use some cleanup as well. :thinking:

Hello everybody,

SO we ended up creating our own uninstaller for Nessus and pulling apart the entire reg. so i am running to an issue to delete a reg folder and its subfolders. i am fairly nw to bf action scripts but i have this so far . apparently i need to create a del.reg to do this . action completes but it is not deleting Tenable key and subfolders.

trying to delete Tenable and its subfolders.
HKEY_LOCAL_MACHINE\SOFTWARE\Tenable

action uses wow64 redirection false

delete __appendfile
delete regdel.reg
appendfile REGEDIT4
appendfile -HKEY_LOCAL_MACHINE\SOFTWARE{{Tenable}
move __appendfile regdel.reg
wait regedit /s regdel.reg

can you guys help ?

On a phone now, so I can’t paste an example, but:

The key name needs to be in square brackets
The hive name needs to be in full, not the short version.

Use regedit and save the key to a file to see the format

When you get a chance , could you please paste an example ?

Thank you

I’m not a fan of building .reg files if I don’t have to, so I don’t have an example that I can share.

My preferred method is to use regkeydelete or regkeydelete64.

See https://developer.bigfix.com/action-script/reference/registry/regkeydelete64.html

1 Like