Remove toolbars on remote computers

This is my first time submitting a script, so if I mess something up please go easy on me. I'm not the utmost authority on Powershell. :)
This script gets rid of toolbars on every computer in the active directory.
My script is personalized for my environment, so I just put together the main pieces and put some comments in to help.
NOTE: This is just an example. You might want to customize this script for your environment and be sure you understand what you are doing before you execute on a domain.

Source Code

This script has not been checked by Spiceworks. Please understand the risks before using it.

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

##This script requires that you are a network administrator and have the active directory module installed on your computer.
#gets the list of computers on the domain. An array of computer names can do the same thing if you know which computers to check.
$comps = Get-ADComputer -Filter * #NOTE: This gets every computer on the domain, might want to limit or create a list of computer.
foreach($i in $comps){
#loop through the computers and check if the computer has a toolbar installed
#then uninstall the program if it exists.
$ToolBars = Get-WmiObject -Class Win32_Product -ComputerName $i.Name | Where {$_.name -like "*toolbar*"} #You can change "*toolbar*" to "yahoo toolbar" or whatever"...or whatever program for that matter.
If($ToolBars){#This statement just say "If $toolbars found any programs then continue."
Foreach($x in $ToolBars){
#loops through the toolbars to uninstall each one.
$ProgName = $x.Name
$RemoveProgram = "Name='" + $ProgName + "'" #Concatenates the name for the filter.
(Get-WmiObject -Class Win32_Product -ComputerName $i.Name -Filter $RemoveProgram).Uninstall()
#And just for fun we're going to let the user know that the program was uninstalled - Again must be a network admin
$msg = "The following program was removed by the network administrator: " + $x.name
Invoke-WmiMethod -Path Win32_Process -Name Create -ArgumentList "msg * $msg" -ComputerName . #$i.Name
#The above sends a popup message to the computer. I think it only stays on the screen for 60 seconds or something.
}
}
}
#Other fun snippets of code:
#This one kills a process on a remote computer
#(Get-WmiObject Win32_Process -ComputerName COMPUTER | ?{ $_.ProcessName -match "ProcessName" }).Terminate()
#Another helpful tool is PsExec..look it up, it's free.
#Hope this helps!