Re: Script to check apps installed and remove unwanted apps
From: Al Dunbar [MS-MVP] (alan-no-drub-spam_at_hotmail.com)
Date: 01/13/05
- Next message: Corné Bogaarts: "Re: Read from 1 text file output to another"
- Previous message: stev379: "Read from 1 text file output to another"
- In reply to: Torgeir Bakken \(MVP\): "Re: Script to check apps installed and remove unwanted apps"
- Next in thread: Torgeir Bakken \(MVP\): "Re: Script to check apps installed and remove unwanted apps"
- Reply: Torgeir Bakken \(MVP\): "Re: Script to check apps installed and remove unwanted apps"
- Messages sorted by: [ date ] [ thread ]
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
- Next message: Corné Bogaarts: "Re: Read from 1 text file output to another"
- Previous message: stev379: "Read from 1 text file output to another"
- In reply to: Torgeir Bakken \(MVP\): "Re: Script to check apps installed and remove unwanted apps"
- Next in thread: Torgeir Bakken \(MVP\): "Re: Script to check apps installed and remove unwanted apps"
- Reply: Torgeir Bakken \(MVP\): "Re: Script to check apps installed and remove unwanted apps"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|