title: Powershell Error when run on a different machine
body: <p>I wrote a script to take an AD user, disable the user, remove the user from group memberships and move the user to an OU.  I originally wrote this on our Windows 2008 R2 DC (I know, bad idea) and I wanted to run the script locally on my Win 7 SP1 machine.  It has the AD role installed as stated in this article (<a href="http://blogs.msdn.com/b/rkramesh/archive/2012/01/17/how-to-add-active-directory-module-in-powershell-in-windows-7.aspx" rel="nofollow">http://blogs.msdn.com/b/rkramesh/archive/2012/01/17/how-to-add-active-directory-module-in-powershell-in-windows-7.aspx</a>)</p>
  
  <p>I ran on both the DC and my Win7 machine $PSVersionTable and they are exactly the same.  I can run ADSIEDIT.msc on the Win 7 machine. The error is occurring when doing an AD user lookup.  See error output below:</p>
  
  <p>Here is my script: <a href="https://github.com/nocode99/powershell/blob/master/UserDisableGroupRemoval.ps1" rel="nofollow">https://github.com/nocode99/powershell/blob/master/UserDisableGroupRemoval.ps1</a></p>
  
  <pre><code>Property 'filter' cannot be found on this object; make sure it exists and is settable.
  At C:\Admin\test.ps1:23 char:12
  +     $ADsearch. &lt;&lt;&lt;&lt; filter = "(&amp;(objectClass=user)(sAMAccountName=$user))"
      + CategoryInfo          : InvalidOperation: (filter:String) [], RuntimeException
      + FullyQualifiedErrorId : PropertyNotFound
  
  You cannot call a method on a null-valued expression.
  At C:\Admin\test.ps1:24 char:32
  +     $ADfind = $ADsearch.findOne &lt;&lt;&lt;&lt; ()
      + CategoryInfo          : InvalidOperation: (findOne:String) [], RuntimeException
      + FullyQualifiedErrorId : InvokeMethodOnNull
  </code></pre>
  
  <p>Any ideas?  The ActiveDirectory module imports with no issues and I want my users to run this locally on their machine rather than the DC.</p>