Re: Script to check apps installed and remove unwanted apps

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Al Dunbar [MS-MVP] (alan-no-drub-spam_at_hotmail.com)
Date: 01/13/05


Date: Wed, 12 Jan 2005 21:42:15 -0700


"Torgeir Bakken (MVP)" <Torgeir.Bakken-spam@hydro.com> wrote in message
news:OcvQwoO%23EHA.1564@TK2MSFTNGP09.phx.gbl...
> andy_p wrote:
>
> > I am trying to write a script that will remove Spyware applications
installed
> > on a user's workstation. So I am trying to write something that loops
> > through installed applications and removes the ones that come from a
list.
> > Anyone have an idea on how to do this?
> Hi
>
> To enumerate the Add/Remove Programs list:

Interesting. Do you find that all Spyware and other nuisance "applications"
actually "install" themselves the way well-behaved applications are supposed
to do?

/Al

> '--------------------8<----------------------
> sComputer = "." ' use . for local computer
> sAppsList = InstalledApplications(sComputer)
>
> For Each sAppName In Split(sAppsList, vbCrLf)
> If sAppName <> "" Then
> WScript.Echo sAppName
> End If
> Next
>
> Function InstalledApplications(node)
> Const HKLM = &H80000002 'HKEY_LOCAL_MACHINE
> Set oRegistry = _
> GetObject("winmgmts:{impersonationLevel=impersonate}!\\" _
> & node & "/root/default:StdRegProv")
> sBaseKey = _
> "SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\"
> iRC = oRegistry.EnumKey(HKLM, sBaseKey, arSubKeys)
> For Each sKey In arSubKeys
> iRC = oRegistry.GetStringValue( _
> HKLM, sBaseKey & sKey, "DisplayName", sValue)
> If iRC <> 0 Then
> oRegistry.GetStringValue _
> HKLM, sBaseKey & sKey, "QuietDisplayName", sValue
> End If
> If sValue <> "" Then
> InstalledApplications = _
> InstalledApplications & sValue & vbCrLf
> End If
> Next
> End Function
> '--------------------8<----------------------
>
>
> --
> torgeir, Microsoft MVP Scripting and WMI, Porsgrunn Norway
> Administration scripting examples and an ONLINE version of
> the 1328 page Scripting Guide:
> http://www.microsoft.com/technet/scriptcenter/default.mspx



Relevant Pages

  • Re: .net framework 2.0 with 1.1???
    ... ..Net Framework 2.0 does not need v1.1, but you might have applications ... installed that needs v1.1. ... torgeir, Microsoft MVP Scripting, Porsgrunn Norway ...
    (microsoft.public.windowsupdate)
  • Re: Browers wont run
    ... You may need to get the applications on another machine and install them ... May also want to try and install/use Firefox Internet Browser. ... Microsoft has these suggestions for Protecting your computer from the ...
    (microsoft.public.windowsxp.help_and_support)
  • Re: FileSpy
    ... Microsoft has these suggestions for Protecting your computer from the ... applications you can use to protect yourself. ... using Windows XP "prettifications". ... install a third-party application and configure/maintain it. ...
    (microsoft.public.security)
  • Re: Errors with Windows XP
    ... Microsoft has these suggestions for Protecting your computer from the ... More full function applications for CD/DVD burning would be: ... using Windows XP "prettifications". ... install a third-party application and configure/maintain it. ...
    (microsoft.public.windowsxp.basics)
  • Re: When I am installing software on my system it takes forever.
    ... Microsoft has these suggestions for Protecting your computer from the ... More full function applications for CD/DVD burning would be: ... using Windows XP "prettifications". ... install a third-party application and configure/maintain it. ...
    (microsoft.public.windowsxp.perform_maintain)