Skip to content

Instantly share code, notes, and snippets.

@darrenjrobinson
Last active June 13, 2019 00:32
Show Gist options
  • Save darrenjrobinson/dcb826c6d6d1d048037cc82a412824a3 to your computer and use it in GitHub Desktop.
Save darrenjrobinson/dcb826c6d6d1d048037cc82a412824a3 to your computer and use it in GitHub Desktop.
Oracle Change Log Entries using PowerShell. Associated blogpost https://blog.darrenjrobinson.com/querying-oracle-internet-directory-ldap-with-powershell/
# Uses slightly different query that for general users as ChangeLog is extremely perscriptive on format in Oracle Internet Directory
$changeNumber = "8781760"
$changeResponse = $null
$ldapCredentials = New-Object System.Net.NetworkCredential($username,$password)
$ldapConnection = New-Object System.DirectoryServices.Protocols.LDAPConnection("$($server):$($port)",$ldapCredentials,"Basic")
$changeFilter = "(&(targetdn=*$($ldapSearchBase))(changeNumber>=$($changeNumber)))"
$changeTimeOut = new-timespan -Seconds 30
$changeRequest = New-Object System.DirectoryServices.Protocols.SearchRequest("cn=changelog", $changeFilter, "OneLevel", $null)
$changeResponse = $ldapConnection.SendRequest($changeRequest, $changeTimeOut)
$changeResponse.Entries
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment