HI Team, \nHow can i list all ou’s under the o=world of ldap server. \nhere is the script that i used. \nany help is much appreciated. Thank oyu<\/p>\n
Clear-Host\n#Install-Module -Name S.DS.P -RequiredVersion 1.8.2\nAdd-Type -AssemblyName System.DirectoryServices.Protocols\n# Load the required modules.\nImport-Module S.DS.P\n\n$userName = \"uid=test,ou=people,ou=test,o=world\"\n$password =\"test\" \n$userPass = $userName + ':' + $password\n\n\n$hostName = \"test.com\"\n$port = 636\n$filter = \"uid\"\n$baseDN = \"o=world\"\n$searchScope = \"Subtree\"\n\n \n\n# Establish a connection to the directory and authenticate.\n$directoryIdentifier = New-Object System.DirectoryServices.Protocols.LdapDirectoryIdentifier($hostName, $Port)\n$conn = New-Object System.DirectoryServices.Protocols.LdapConnection($directoryIdentifier)\n$conn.SessionOptions.SecureSocketLayer=$true\n$conn.AuthType = \"Basic\"\n$cred = New-Object System.Net.NetworkCredential($userName, $password)\n$conn.Credential = $cred\n$conn.Bind()\n\n<\/code><\/pre>","upvoteCount":0,"answerCount":4,"datePublished":"2024-06-03T00:41:44.683Z","author":{"@type":"Person","name":"marlon3","url":"https://community.spiceworks.com/u/marlon3"},"suggestedAnswer":[{"@type":"Answer","text":"
HI Team, \nHow can i list all ou’s under the o=world of ldap server. \nhere is the script that i used. \nany help is much appreciated. Thank oyu<\/p>\n
Clear-Host\n#Install-Module -Name S.DS.P -RequiredVersion 1.8.2\nAdd-Type -AssemblyName System.DirectoryServices.Protocols\n# Load the required modules.\nImport-Module S.DS.P\n\n$userName = \"uid=test,ou=people,ou=test,o=world\"\n$password =\"test\" \n$userPass = $userName + ':' + $password\n\n\n$hostName = \"test.com\"\n$port = 636\n$filter = \"uid\"\n$baseDN = \"o=world\"\n$searchScope = \"Subtree\"\n\n \n\n# Establish a connection to the directory and authenticate.\n$directoryIdentifier = New-Object System.DirectoryServices.Protocols.LdapDirectoryIdentifier($hostName, $Port)\n$conn = New-Object System.DirectoryServices.Protocols.LdapConnection($directoryIdentifier)\n$conn.SessionOptions.SecureSocketLayer=$true\n$conn.AuthType = \"Basic\"\n$cred = New-Object System.Net.NetworkCredential($userName, $password)\n$conn.Credential = $cred\n$conn.Bind()\n\n<\/code><\/pre>","upvoteCount":0,"datePublished":"2024-06-03T00:41:44.756Z","url":"https://community.spiceworks.com/t/how-list-all-ou-and-content/1081950/1","author":{"@type":"Person","name":"marlon3","url":"https://community.spiceworks.com/u/marlon3"}},{"@type":"Answer","text":"\n\n
<\/div>\n
Amberdawn:<\/div>\n
\n
S.DS.P<\/code><\/p>\n<\/blockquote>\n<\/aside>\nIs this Active Directory LDAP or a third party LDAP server?<\/p>","upvoteCount":0,"datePublished":"2024-06-04T00:57:44.995Z","url":"https://community.spiceworks.com/t/how-list-all-ou-and-content/1081950/2","author":{"@type":"Person","name":"PatrickFarrell","url":"https://community.spiceworks.com/u/PatrickFarrell"}},{"@type":"Answer","text":"\n\n
<\/div>\n
Amberdawn:<\/div>\n
\nHI Team, \nHow can i list all ou’s under the o=world of ldap server. \nhere is the script that i used. \nany help is much appreciated. Thank oyu<\/p>\n
Clear-Host\n#Install-Module -Name S.DS.P -RequiredVersion 1.8.2\nAdd-Type -AssemblyName System.DirectoryServices.Protocols\n# Load the required modules.\nImport-Module S.DS.P\n\n$userName = \"uid=test,ou=people,ou=test,o=world\"\n$password =\"test\" \n$userPass = $userName + ':' + $password\n\n\n$hostName = \"test.com\"\n$port = 636\n$filter = \"uid\"\n$baseDN = \"o=world\"\n$searchScope = \"Subtree\"\n\n \n\n# Establish a connection to the directory and authenticate.\n$directoryIdentifier = New-Object System.DirectoryServices.Protocols.LdapDirectoryIdentifier($hostName, $Port)\n$conn = New-Object System.DirectoryServices.Protocols.LdapConnection($directoryIdentifier)\n$conn.SessionOptions.SecureSocketLayer=$true\n$conn.AuthType = \"Basic\"\n$cred = New-Object System.Net.NetworkCredential($userName, $password)\n$conn.Credential = $cred\n$conn.Bind()\n\n<\/code><\/pre>\n<\/blockquote>\n<\/aside>\nWhy not just the query at Domain Users & Computers, then export the list ?<\/p>","upvoteCount":0,"datePublished":"2024-06-04T01:52:12.462Z","url":"https://community.spiceworks.com/t/how-list-all-ou-and-content/1081950/3","author":{"@type":"Person","name":"adrian_ych","url":"https://community.spiceworks.com/u/adrian_ych"}},{"@type":"Answer","text":"
its sa ldap server<\/p>","upvoteCount":0,"datePublished":"2024-06-05T08:00:11.667Z","url":"https://community.spiceworks.com/t/how-list-all-ou-and-content/1081950/4","author":{"@type":"Person","name":"marlon3","url":"https://community.spiceworks.com/u/marlon3"}}]}}
marlon3
(Amberdawn)
June 3, 2024, 12:41am
1
HI Team,
How can i list all ou’s under the o=world of ldap server.
here is the script that i used.
any help is much appreciated. Thank oyu
Clear-Host
#Install-Module -Name S.DS.P -RequiredVersion 1.8.2
Add-Type -AssemblyName System.DirectoryServices.Protocols
# Load the required modules.
Import-Module S.DS.P
$userName = "uid=test,ou=people,ou=test,o=world"
$password ="test"
$userPass = $userName + ':' + $password
$hostName = "test.com"
$port = 636
$filter = "uid"
$baseDN = "o=world"
$searchScope = "Subtree"
# Establish a connection to the directory and authenticate.
$directoryIdentifier = New-Object System.DirectoryServices.Protocols.LdapDirectoryIdentifier($hostName, $Port)
$conn = New-Object System.DirectoryServices.Protocols.LdapConnection($directoryIdentifier)
$conn.SessionOptions.SecureSocketLayer=$true
$conn.AuthType = "Basic"
$cred = New-Object System.Net.NetworkCredential($userName, $password)
$conn.Credential = $cred
$conn.Bind()
Amberdawn:
S.DS.P
Is this Active Directory LDAP or a third party LDAP server?
Amberdawn:
HI Team,
How can i list all ou’s under the o=world of ldap server.
here is the script that i used.
any help is much appreciated. Thank oyu
Clear-Host
#Install-Module -Name S.DS.P -RequiredVersion 1.8.2
Add-Type -AssemblyName System.DirectoryServices.Protocols
# Load the required modules.
Import-Module S.DS.P
$userName = "uid=test,ou=people,ou=test,o=world"
$password ="test"
$userPass = $userName + ':' + $password
$hostName = "test.com"
$port = 636
$filter = "uid"
$baseDN = "o=world"
$searchScope = "Subtree"
# Establish a connection to the directory and authenticate.
$directoryIdentifier = New-Object System.DirectoryServices.Protocols.LdapDirectoryIdentifier($hostName, $Port)
$conn = New-Object System.DirectoryServices.Protocols.LdapConnection($directoryIdentifier)
$conn.SessionOptions.SecureSocketLayer=$true
$conn.AuthType = "Basic"
$cred = New-Object System.Net.NetworkCredential($userName, $password)
$conn.Credential = $cred
$conn.Bind()
Why not just the query at Domain Users & Computers, then export the list ?
marlon3
(Amberdawn)
June 5, 2024, 8:00am
4