Method: Rex::Powershell::PshMethods.uninstall

Defined in:
lib/rex/powershell/psh_methods.rb

.uninstall(app, fuzzy = true) ⇒ String

Uninstall app, or anything named like app

Parameters:

  • app (String)

    Name of application

  • fuzzy (Boolean) (defaults to: true)

    Whether to apply a fuzzy match (-like) to the application name

Returns:

  • (String)

    Powershell code to uninstall an application



30
31
32
33
# File 'lib/rex/powershell/psh_methods.rb', line 30

def self.uninstall(app, fuzzy = true)
  match = fuzzy ? '-like' : '-eq'
  %Q^$app = Get-WmiObject -Class Win32_Product | Where-Object { $_.Name #{match} "#{app}" }; $app.Uninstall()^
end