Skip to content

Commit

Permalink
Merge pull request #15 from umn-microsoft-automation/1.0.12
Browse files Browse the repository at this point in the history
Add configurable timeout for Get-UsersIDM
  • Loading branch information
FISHMANPET authored Jun 18, 2020
2 parents bc583e8 + 77ba999 commit 02fa9b5
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 8 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# UMN-Common

## 1.0.12 - 6/18/2020
Make Timeout for Get-UsersIDM configurable

## 1.0.11 - 12/10/2019
Fixed bug in Send-SplunkHEC when eventData was a PSCustomObject.
Changed code to make copy of metadata hashtable rather than modifying in place
Expand Down
6 changes: 2 additions & 4 deletions UMN-Common.psd1
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
RootModule = 'UMN-Common.psm1'

# Version number of this module.
ModuleVersion = '1.0.11'
ModuleVersion = '1.0.12'

# ID used to uniquely identify this module
GUID = '4a7ba823-deb0-4b4d-9f81-396b20c8784b'
Expand Down Expand Up @@ -122,9 +122,7 @@ PrivateData = @{

# ReleaseNotes of this module
ReleaseNotes = @"
Fixed bug in Send-SplunkHEC when eventData was a PSCustomObject.
Changed code to make copy of metadata hashtable rather than modifying in place
Renamed Host parameter in Send-SplunkHEC to EventHost (and added alias for backwards compatiblity)
Make Timeout for Get-UsersIDM configurable
"@

} # End of PSData hashtable
Expand Down
18 changes: 14 additions & 4 deletions UMN-Common.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -330,8 +330,16 @@ function Get-RandomString {
Fetch list of users from IDM
.DESCRIPTION
Fetch list of users from IDM
.PARAMETER ldapServer
Name of LDAP server to connect to
.PARAMETER ldapSearchString
LDAP query to execute
.PARAMETER searchDN
DN to execute search against
.PARAMETER TimeoutMinutes
Timeout for the query, in minutes, defaults to 30. If the query exceeds this time it will throw an exception
.EXAMPLE
$users = Get-UsersIDM -ldapCredential $ldapCredential -ldapServer $ldapServer -ldapSearchString "(Role=*.cur*)"
$users = Get-UsersIDM -ldapCredential $ldapCredential -ldapServer $ldapServer -ldapSearchString "(Role=*.cur*)" -TimeoutMinutes 60
.EXAMPLE
$users = Get-UsersIDM -ldapCredential $ldapCredential -ldapServer $ldapServer -ldapSearchString "(&(Role=*.staff.*)(cn=mrEd))"
#>
Expand All @@ -347,7 +355,9 @@ function Get-RandomString {
[Parameter(Mandatory)]
[string]$ldapSearchString,

[string]$searchDN
[string]$searchDN,

[int]$TimeoutMinutes = 30
)
#Load the assemblies needed for ldap lookups
$null = [System.Reflection.Assembly]::LoadWithPartialName("System.DirectoryServices.Protocols")
Expand All @@ -369,8 +379,8 @@ function Get-RandomString {
$ldapSearch.Scope = "Subtree"
$ldapSearch.DistinguishedName = $searchDN

#execute query for Students...30 minute timeout...generally takes about 12 minutes
$ldapResponse = $ldapConnection.SendRequest($ldapSearch, (New-Object System.TimeSpan(0,30,0))) -as [System.DirectoryServices.Protocols.SearchResponse]
#execute query for Students...default 30 minute timeout...generally takes about 12 minutes
$ldapResponse = $ldapConnection.SendRequest($ldapSearch, (New-Object System.TimeSpan(0,$TimeoutMinutes,0))) -as [System.DirectoryServices.Protocols.SearchResponse]
$null = $ldapConnection.Dispose()
return ($ldapResponse)
}
Expand Down

0 comments on commit 02fa9b5

Please sign in to comment.