< Back
Get-LdapObject
Post
NAME Get-LdapObject
SYNOPSIS
Returns one or more objects from an LDAP server.
SYNTAX
Get-LdapObject [-AttributeFormat {String | ByteArray}] -Identity <String> -LdapConnection <LdapConnection>
[-Property <String[]>] [-Raw] [-TimeoutSeconds <UInt32>] [<CommonParameters>]
Get-LdapObject [-AttributeFormat {String | ByteArray}] -LdapConnection <LdapConnection> -LdapFilter <String>
[-Property <String[]>] [-Raw] [-Scope {Base | OneLevel | Subtree}] -SearchBase <String> [-TimeoutSeconds <UInt32>]
[<CommonParameters>]
DESCRIPTION
This function returns objects from an LDAP server. It can either return a specific object via its distinguished
name, or return several objects based on an LDAP query.
The required LdapConnection parameter can be obtained via the Get-LdapConnection function.
PARAMETERS
-AttributeFormat <String>
Whether to return attributes as strings or as byte arrays.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Identity <String>
Full distinguished name of the item to return from the LDAP server.
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-LdapConnection <LdapConnection>
An LdapConnection object created using the Get-LdapConnection function which provides details on the server to
query.
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-LdapFilter <String>
An LDAP filter to be used to query the server. For information on LDAP filters, see
https://confluence.atlassian.com/kb/how ... 96933.html
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Property <String[]>
Limit the properties to return on queried results. This can significantly improve processing time. If not
specified, the server will return all properties.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Raw [<SwitchParameter>]
Do not attempt to clean up the provided output objects. This will significantly affect the format of the
output object, but can be useful for troubleshooting if the function is returning unexpected output.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Scope <SearchScope>
Search scope for the LDAP search. Specify whether to only search the provided search base, search one level
into sub-containers, or search the entire tree from the provided search base.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-SearchBase <String>
Base container to use for a search.
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-TimeoutSeconds <UInt32>
{{ Fill TimeoutSeconds Description }}
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
None
OUTPUTS
System.Object
NOTES
-------------------------- Example 1 --------------------------
PS C:\\> $connection = Get-LdapConnection -Server 'example.local' -Port 389
PS C:\\> Get-LdapObject -LdapConnection $connection -Identity 'cn=User,ou=example,dc=local'
This example returns a specific object from the LDAP server by its distinguished name.
-------------------------- Example 2 --------------------------
PS C:\\> $connection = Get-LdapConnection -Server 'example.local' -Port 389
PS C:\\> Get-LdapObject -LdapConnection $connection -LdapFilter '(cn=User)' -SearchBase 'ou=example,dc=local'
This example queries the LDAP server for any objects matching the provided LDAP filter within the provided search
base.
RELATED LINKS
Get-LdapConnection
SYNOPSIS
Returns one or more objects from an LDAP server.
SYNTAX
Get-LdapObject [-AttributeFormat {String | ByteArray}] -Identity <String> -LdapConnection <LdapConnection>
[-Property <String[]>] [-Raw] [-TimeoutSeconds <UInt32>] [<CommonParameters>]
Get-LdapObject [-AttributeFormat {String | ByteArray}] -LdapConnection <LdapConnection> -LdapFilter <String>
[-Property <String[]>] [-Raw] [-Scope {Base | OneLevel | Subtree}] -SearchBase <String> [-TimeoutSeconds <UInt32>]
[<CommonParameters>]
DESCRIPTION
This function returns objects from an LDAP server. It can either return a specific object via its distinguished
name, or return several objects based on an LDAP query.
The required LdapConnection parameter can be obtained via the Get-LdapConnection function.
PARAMETERS
-AttributeFormat <String>
Whether to return attributes as strings or as byte arrays.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Identity <String>
Full distinguished name of the item to return from the LDAP server.
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-LdapConnection <LdapConnection>
An LdapConnection object created using the Get-LdapConnection function which provides details on the server to
query.
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-LdapFilter <String>
An LDAP filter to be used to query the server. For information on LDAP filters, see
https://confluence.atlassian.com/kb/how ... 96933.html
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Property <String[]>
Limit the properties to return on queried results. This can significantly improve processing time. If not
specified, the server will return all properties.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-Raw [<SwitchParameter>]
Do not attempt to clean up the provided output objects. This will significantly affect the format of the
output object, but can be useful for troubleshooting if the function is returning unexpected output.
Required? false
Position? named
Default value False
Accept pipeline input? False
Accept wildcard characters? false
-Scope <SearchScope>
Search scope for the LDAP search. Specify whether to only search the provided search base, search one level
into sub-containers, or search the entire tree from the provided search base.
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-SearchBase <String>
Base container to use for a search.
Required? true
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
-TimeoutSeconds <UInt32>
{{ Fill TimeoutSeconds Description }}
Required? false
Position? named
Default value None
Accept pipeline input? False
Accept wildcard characters? false
<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer, PipelineVariable, and OutVariable. For more information, see
about_CommonParameters (https:/go.microsoft.com/fwlink/?LinkID=113216).
INPUTS
None
OUTPUTS
System.Object
NOTES
-------------------------- Example 1 --------------------------
PS C:\\> $connection = Get-LdapConnection -Server 'example.local' -Port 389
PS C:\\> Get-LdapObject -LdapConnection $connection -Identity 'cn=User,ou=example,dc=local'
This example returns a specific object from the LDAP server by its distinguished name.
-------------------------- Example 2 --------------------------
PS C:\\> $connection = Get-LdapConnection -Server 'example.local' -Port 389
PS C:\\> Get-LdapObject -LdapConnection $connection -LdapFilter '(cn=User)' -SearchBase 'ou=example,dc=local'
This example queries the LDAP server for any objects matching the provided LDAP filter within the provided search
base.
RELATED LINKS
Get-LdapConnection