title: Get current computer's distinguished name in powershell without using the ActiveDirectory module
body: <p>I have a script that I need to find the full Distinguished name (<code>CN=MyComputer, OU=Computers, DC=vw, DC=local</code>) of the computer it is running on, however I can not guarantee that the <code>ActiveDirectory</code> module will be available on all computers that this script will be run on. Is there a way to get the current computer's full Distinguished name without using <code>Get-ADComputer $Env:COMPUTERNAME</code>?</p>
  
  <hr>
  
  <p>Just in case this is a XY problem, what I am trying to do is move the computer to a specific OU, but I need a way to get the ASDI entry for the computer I am running on.</p>
  
  <pre><code>[ADSI]$computer = ("LDAP://" + $localDN)
  if($Production)
  {
      [ADSI]$destination = 'LDAP://ou=Production,ou=Computers,ou=VetWeb,dc=vw,dc=local'
      $computer.MoveTo($destination);
  }
  else
  {
      [ADSI]$destination = 'LDAP://ou=Test,ou=Computers,ou=VetWeb,dc=vw,dc=local'
      $computer.MoveTo($destination);
  }
  </code></pre>