Share via

using LDAPS query in powershell

shashidhar joliholi 291 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

2 answers

Sort by: Most helpful
  1. Gary Reynolds 9,626 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.

    Was this answer helpful?

    0 comments No comments

  2. SChalakov 10,781 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

    Was this answer helpful?


Your answer

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