Skip to content

Instantly share code, notes, and snippets.

@tomorgan
Created March 1, 2013 14:18
Show Gist options
  • Save tomorgan/5064937 to your computer and use it in GitHub Desktop.
Save tomorgan/5064937 to your computer and use it in GitHub Desktop.
Powershell LDAP Request to get AD objects including Lync SIP Address and Home Server. Good if you can't use Import-Module ActiveDirectory
$Request = New-Object System.DirectoryServices.Protocols.SearchRequest
$Request.DistinguishedName = $RootContainer
$Request.Filter = $SearchFilter
$Request.Scope = "Subtree"
$Request.Attributes.Add("distinguishedName") | Out-Null
$Request.Attributes.Add("objectclass") | Out-Null
$Request.Attributes.Add("mail") | Out-Null
$Request.Attributes.Add("objectguid") | Out-Null
$Request.Attributes.Add("msrtcsip-primaryhomeserver") | Out-Null
$Request.Attributes.Add("msrtcsip-primaryuseraddress") | Out-Null
$Response = $LDAPConnection.SendRequest($Request)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment