using LDAPS query in powershell

shashidhar joliholi 281 Reputation points
2022-03-10T11:38:46.893+00:00

Hi Team,

We are using following powershell cmdlets to get user info.

$AccountName = "Shashidhar.Joliholi"
$Query = "(&(objectClass=user)(objectCategory=person)(samAccountName=$AccountName))"
$UserInfo = Get-ADUser -LDAPFilter $Query

We are planning to block LDAP and go with LDAPS in DCs. does it impact above powershell script. if yes, what modification need to be done on the powershell cmdlets to use LDAPS to get $UserInfo.

can i use $UserInfo = Get-ADUser -LDAPFilter $Query -server dc.domain.com:636 ?

Need your help!

Thanks,
Shashidhar Joliholi

Windows for business Windows Client for IT Pros Directory services Active Directory
Windows for business Windows Server User experience PowerShell
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. SChalakov 10,576 Reputation points MVP Volunteer Moderator
    2022-03-10T11:57:32.66+00:00

    Hi @shashidhar joliholi ,

    No matter if you are using LDAP or LDAPS the query will always remain the same. The only difference is that the LDAP communication gets encrypted when using LDAPS.
    You don't need to change anything regarding the query.

    Hope I was able to answer your question.

    ----------

    (If the reply was helpful please don't forget to upvote and/or accept as answer, thank you)

    Regards
    Stoyan Chalakov


  2. Gary Reynolds 9,621 Reputation points
    2022-03-11T04:07:23.873+00:00

    Out of interest how are you planning to block the use of LDAP and what changes are you planning to make so clients only connect on LDAPS/636?

    Gary.

    0 comments No comments

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.