Import-Module ActiveDirectory
$mass = Get-Adcomputer -filter "Enabled -eq 'TRUE'" -SearchBase "OU=computers,OU=OU-name-1,DC=DC-name-1,DC=ru" | select name
$mass | { if(Test-Connection -CN $_.name -Count 1 -BufferSize 16 -Quiet) {(gwmi win32_product -filter "Name = 'Java(TM) 6 Update 38'" -namespace root/cimv2 -ComputerName $_.name).uninstall() }