Skip to content

Instantly share code, notes, and snippets.

Darren Robinson darrenjrobinson

Block or report user

Report or block darrenjrobinson

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View import.ps1
param (
$Username,
$Password,
$OperationType,
[bool] $usepagedimport,
$pagesize,
$Credentials
)
$DebugFilePath = "C:\Program Files\Microsoft Forefront Identity Manager\2010\Synchronization Service\Extensions\OID\Debug\usersImport.txt"
View schema.ps1
# Oracle eBusiness Suite OID LDAP Schema
$obj = New-Object -Type PSCustomObject
$obj | Add-Member -Type NoteProperty -Name "Anchor-orclguid|String" -Value ""
$obj | Add-Member -Type NoteProperty -Name "objectClass|String" -Value "ldapUser"
$obj | Add-Member -Type NoteProperty -Name "company|string" -Value "string"
$obj | Add-Member -Type NoteProperty -Name "middlename|string" -Value "string"
$obj | Add-Member -Type NoteProperty -Name "preferredname|string" -Value "string"
$obj | Add-Member -Type NoteProperty -Name "departmentnumber|string" -Value "string"
$obj | Add-Member -Type NoteProperty -Name "DistinguishedName|string" -Value "string"
$obj | Add-Member -Type NoteProperty -Name "paygroup|string" -Value "string"
View Get ChangeLog.ps1
# 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
@darrenjrobinson
darrenjrobinson / Get OID User.ps1
Last active Jun 12, 2019
PowerShell Connect to Oracle Internet Directory and return object as Text. Associated blogpost https://blog.darrenjrobinson.com/querying-oracle-internet-directory-ldap-with-powershell/
View Get OID User.ps1
# Needs reference to .NET assembly used in the script.
Add-Type -AssemblyName System.DirectoryServices.Protocols
function Get-LdapObject {
[CmdletBinding()]
param(
[Parameter(Mandatory)]
[ValidateNotNull()]
[System.DirectoryServices.Protocols.LdapConnection] $LdapConnection,
[Parameter(ParameterSetName = 'DistinguishedName',
View Connect to OID.ps1
# Needs reference to .NET assembly used in the script.
Add-Type -AssemblyName System.DirectoryServices.Protocols
$username = 'cn=ldapUser'
$pwd = 'S3cur3P@$$W0rd'
$server = "ldap.customer.com.au"
$port = "80001"
$password = $pwd | ConvertTo-SecureString -asPlainText -Force
# Top Level OU under which users are located
$ldapSearchBase = "cn=users,dc=customer,dc=com,dc=au"
# Filter to find the user we are connecting with
@darrenjrobinson
darrenjrobinson / OracleSQLStoredProcedure.ps1
Last active Jun 12, 2019
Execute Oracle SQL DB Stored Procedure using PowerShell and ODAC.NET (so no Oracle Client required). Associated blogpost https://blog.darrenjrobinson.com/using-powershell-to-query-oracle-dbs-without-using-the-oracle-client-oracle-data-provider-for-net/
View OracleSQLStoredProcedure.ps1
# Path to ODAC.NET Installation
Add-Type -Path "c:\ODAC\odp.net\managed\common\Oracle.ManagedDataAccess.dll"
$reader = $false
# SQL DB Username, Password and DataSource Alias (as per tnsnames.ora)
$username = "SQLQueryUserName"
$password = "SQLUserPassword"
# Alias from TNSNames.ora
$datasource = "IDM"
View OracleSQLQuery.ps1
# Path to ODAC.NET Installation
Add-Type -Path "c:\ODAC\odp.net\managed\common\Oracle.ManagedDataAccess.dll"
$reader = $false
# SQL DB Username, Password and DataSource Alias (as per tnsnames.ora)
$username = "SQLQueryUserName"
$password = "SQLUserPassword"
# Alias from TNSNames.ora
$datasource = "IDM"
View Create IdentityNow ServiceNow Integration Configuration.json
{
"attributes": {
"authType": "Basic",
"username": "IdentityNowServiceAccount_in_ServiceNow",
"password": "IdentityNowServiceAccount_Password",
"url": "https://yourServiceNowTenant.service-now.com",
"serviceNowAppName" : "ServiceNow [source-42423]",
"catalogItem": {
"2c9180856a93cecd016a9ed337615c35": "a632c040db25f30033501c0e049619af"
}
View Get and Update IdentityNow Org Config.ps1
# IdentityNow Orgname
$orgName = "yourOrgname"
# IdentityNow Admin User
$adminUSR = [string]"yourOrgAdminID".ToLower()
$adminPWDClear = 'yourOrgAdminPasswrd'
# Generate the password hash
# Requires Get-Hash from PowerShell Community Extensions (PSCX) Module
# https://www.powershellgallery.com/packages/Pscx/3.2.2
@darrenjrobinson
darrenjrobinson / Azure LogAnalytics Report to CSV.ps1
Last active May 21, 2019
Azure Log Analytics Report using KQL via REST API with PowerShell output to CSV. Associated blogpost https://blog.darrenjrobinson.com/?p=39731
View Azure LogAnalytics Report to CSV.ps1
#The resource URI
$resource = "https://westus2.api.loganalytics.io"
#Your Client ID and Client Secret obtained when registering your WebApp
$clientid = "yourAADAppClientID"
$clientSecret = "yourAADAppClientSecret"
#Your Reply URL configured when registering your WebApp
$redirectUri = "https://localhost"
#Scope
$scope = "Data.Read"
Add-Type -AssemblyName System.Web
You can’t perform that action at this time.