Article: AN0001776Updated: 19.09.2020
This function returns a list of users from LDAP (Microsoft Active Directory) according to configuration. There are all the properties returned, both the standard ones and those defined by the Active Directory administrator. The number of columns in the output file can therefore vary.
Main prerequisites for use
Prerequisite |
Description |
Module Active Directory PowerShell Microsoft
|
In order to read information about users from LDAP it is necessary to install Powershell module for Active Directory. |
Remote Differential Compression |
In order to read information about users from LDAP it is necessary to enable this function of the Windows system on server executing this functionality. |
AD DS and AD LDS Tools |
In order to read information about users from LDAP it is necessary to enable this function of the Windows system on server executing this functionality. |
Powershell v3 |
Microsoft Powershell version 3 or higher. |
Description
Function creates a text file containing information about users according to configuration. The file contains e.g. following information (total number of properties exceeds 100).
Column header |
Description |
Login |
User login. E.g. altman |
LoginWithDomain |
User login including domain. E.g. OBJECTGEARS\altman |
DisplayName |
User displayed name. |
Name |
User first name. |
Surname |
User surname. |
EmailAddress |
User email. |
Enabled |
Information, wheather the user account is enabled or disabled in Windows system. |
Phone |
User phone number. |
Fax |
User fax number. |
SID |
User SID. |
Description |
User description. |
Office |
Placement of the user (office). |
PasswordExpired |
Information whether password expired for the user. |
Parameters
Include hereinafter stated parameters in the file og_configuration.ps1 (generic parameters shared with other functions) or in the file OG_PC-Start.config (specific parameters of this function). Parameter configuration is described in the documentation of the programme Piklo.
Parameter |
Description |
Example |
[string]$LogFile |
Path to the file, in which log of the function shall be stored. |
[string]$LogFile = "\\servername\OGoutput\AD-Users\LogFile.txt" |
[string]$OutFile |
Path to the file, in which output of the function shall be stored. |
[string]$LogFile = "\\servername\OGoutput\AD-Users\OutFile.txt"
|
[string]$OutFileEncoding |
Coding of the output file. Possible options are "UTF8", "Unicode" and "DEFAULT". The value "DEFAULT" makes the file being created in the ANSI encoding. |
[string]$OutFileEncoding = "UTF8"
|
[string]$Delimiter |
Value separator in the records. Possible values are: "t" - tab, ";" - semicolon a "," - comma. |
[string]$Delimiter = "t"
|
[string]$HeaderOutFile |
Defines, wheather the output file shall include header with column names ("1") or not ("0").
|
[string]$HeaderOutFile = "1"
|
[string]$SkipNullEmailorDisplayName |
Defines, wheather the output file shall include only users that have DisplayName and Email filled in ("True") or all the user records ("False"). |
[string]$SkipNullEmailorDisplayName = "True"
|
[string]$SearchBase |
Defines tree/s for "user" search in Active Directory.
[ "" | "DC=Domain,DC=cz" ] - domain root will be used
[ "OU=XYZ,DC=Domain,DC=cz" ] define OU of the domain will be used
[ "OU=XYZ,DC=Domain,DC=cz;OU=123,DC=Domain,DC=cz" ] multiple domain OUs will be used (use semicolon as separator) |
[string]$SearchBase = "" |
If you want to use the output file for user import into ObjectGears, set parameter SkipNullEmailorDisplayName to the value "True".
Call
The function is called by means of the programme Piklo, that is part of ObjectGears package, from ObjectGears script. Result of the call has to be assigned to a variable, with which the script can further work.
a = OG.Process.RunPiklo('OG_AD-User','-type C')