Try something like this (it assumes all VMs have the VMware Tools installed).
$script = 'openssl version -v'
$user = 'root'
$pswd = 'password'
Get-VM | where {$_.GuestId -match "rhel|sles"} |
Select Name,@{N='OpenSSL';E={
Invoke-VMScript -VM $_ -ScriptType Bash -ScriptText $script -GuestUser $user -GuestPassword $pswd
}}