I went where EEAA was heading and just ended up with a simple PowerCLI provided from here.
and set the "-ge" equal to 1 since the datastore in question should only house the one VM it is intended for.
I have that set to run on our administrative server twice a day.
It doesn't really answer the question itself of when a VM moves to a particular non-SDRS datastore, but it is a workaround that gets me close enough to knowing. Plus it only emails me when the potential that it has happened occurs. And if the admins mess up and then move the VM back before the script runs that's ok.
Code here for posterity:
#
# PowerCLI script to send e-mail if the number of virtual machines per datastore exceeds 48
# Version 1.0
# Magnus Andersson, Real Time Services AB
#
#
Add-PSSnapin VMware.VimAutomation.Core -ErrorAction SilentlyContinue
#
#
# Get login password
$pwd = Get-Content d:vspherescriptspowerclicred | ConvertTo-SecureString
$cred = New-Object System.Management.Automation.PsCredential “homedomainpowercli“, $pwd
#
#
# Connect to vCenter Server
connect-viserver vc-demo01.home.test
#
#
$sendTo = “magnus@home.test“
$ds = get-datastore
foreach ($datastore in $ds){
$num = Get-Datastore $datastore | Select @{N=”TotalVMs”;E={@($_ | Get-VM ).Count}}
if ($num.TotalVMs -ge 48) {
send-mailmessage -to $sendTo -from vc-demo01@home.test -Subject “Number of VMs per datastore $datastore is” -smtpserver smtp.home.test -body $num.TotalVms
}
else
{
}
}
#