1 Reply Latest reply on Jun 3, 2019 4:54 AM by Phil

    VMware.Hv.EntityNotFound ErrorMessage : Could not find user or group in AD

    Phil Novice

      Hi,

       

      After upgrading to Horizon View 7.7, VMware.Hv.Helper module no longer works.  I'm able to successfully connect to the environment; however, when I run the following cmdlet it errors out:

       

      PS C:\>  Connect-HVServer -Server $(hostname) -Domain example.com

      PS C:\>  Get-HVMachine

      Exception calling "QueryService_Query" with "2" argument(s): "ExceptionType : VMware.Hv.EntityNotFound

      ErrorMessage : Could not find user or group in AD

      Id : VMware.Hv.UserOrGroupId"

      At C:\Program Files\WindowsPowerShell\Modules\VMware.Hv.Helper\VMware.HV.Helper.psm1:6759 char:5

      +     $queryResults = $query_service_helper.QueryService_Query($service ...

      +     ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

          + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException

          + FullyQualifiedErrorId : VimException

       

       

      I followed Connect-HVServer Could not find user or group in AD but I guest it doesn't really pertain to my issue because I am able to connect using the module.

       

      Thanks,

      P

        • 1. Re: VMware.Hv.EntityNotFound ErrorMessage : Could not find user or group in AD
          Phil Novice

          There were users assigned to machines that were deleted from active directory before the upgrade.  That is why the module was prompting the error message "Could not find user or group in AD".  I created the following script that searched and unassigned deleted active directory users from their machine.  After the clean-up, the module works without an issue.

           

          Import-Module ActiveDirectory

          $server = '127.0.0.1'

          $searhADSI = [adsisearcher]''

          $searhADSI.SearchRoot = "LDAP://$server/dc=vdi,dc=vmware,dc=int"

          $Pools = ([adsi]"LDAP://$server/OU=Server Groups,DC=vdi,DC=vmware,DC=int").psbase.Children

          foreach ($Pool in $Pools) {

              foreach ($Desktop in ([adsi]$Pool).'pae-memberdn') {

                  $Desktop = [adsi]"LDAP://$server/$Desktop"

                  if ($Desktop.'pae-SIDString') {

                      [array]$Desktops += $Desktop | select @{n='Sid';e={$_.'pae-SIDString'.value}},@{n='cn';e={$_.'cn'.value}}

                  }

              }

          }

          $Desktops | % { $_.sid = (Get-ADUser $_.sid).name }

          foreach ($obj in $Desktops | ? sid -like "s-*") {

              $searhADSI.Filter = "(&(cn=$($obj.cn)))"

              $vm = [adsi]$searhADSI.FindAll().path

              $vm.Properties['pae-SIDString'].clear()

              $vm.setinfo()

          }