title: powershell ver 2.0 search AD failure
body: <p>I have raised a similar issue on Stackoverflow, however not been able to resolve.
  The issue has been that we have mixed workstations using powershell version 5.x(win10) and 2.x(win7), I have had to make my powershell script backwards compatible with 2.x, this brings errors as shown below.
  I cannot use Get-aduser as its not an option on powershell 2.x, I cannot install the module as this would make things to complex.</p>
  
  <pre><code>$Username = "xxx-xxxx"
  $LdapFilter = "(&amp;(objectClass=user)(objectCategory=person)(sAMAccountName=$username))"
  $User = (((New-Object System.DirectoryServices.DirectorySearcher($Null, $LdapFilter)).FindOne()).GetDirectoryEntry())
  $ext1 = $User.get("extensionAttribute1")
  write-host `$ext1: $ext1
  </code></pre>
  
  <p>error message:</p>
  
  <pre><code>FindOne : Exception calling "FindOne" with "0" argument(s): "Configuration system failed to initialize"
  At C:\gavin\AD_search.ps1:5 char:94
  + $User = (((New-Object System.DirectoryServices.DirectorySearcher($Null, $LdapFilter)).FindOne &lt;&lt;&lt;&lt; ()).GetDirectoryEn
  try())
      + CategoryInfo          : NotSpecified: (:) [], MethodInvocationException
      + FullyQualifiedErrorId : DotNetMethodException
  
  get : You cannot call a method on a null-valued expression.
  At C:\gavin\AD_search.ps1:6 char:18
  + $ext1 = $User.get &lt;&lt;&lt;&lt; ("extensionAttribute1")
      + CategoryInfo          : InvalidOperation: (get:String) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
  </code></pre>