Everything is possible in PowerCLI
For a simple simulation of affinity/anti-affinity rules, you should do all start/stop of VMs through a script.
In that script you can test on which ESXi a VM can be started, talking into account the rules you would have in a file somewhere.
A tentative start VM logic
- read all rules
- get the VM that needs to be started
- is there a rule that includes this VM
- affinity: check where the affine VM(s) are running -> that will be the target ESXi
- anti-affinity
- get all available ESXi hosts
- remove the ESXi that have VMs from the anti-affinity rule running
- select an ESXi host from the remaining ones
That should be quite simple to code in PowerCLI.
But remember that this is a very crude simulation fo what HA offers.