Is this issue fixed in 5.1 ?
There is a bug in Apply-VMHostProfile cmdlet that is already filed in our bugtracking system. The fix will be available in a future release.
The issue is caused by using wrong version of the API(4.0) that doesn't have support for active directory operations.