Active Directory export script for Gathid  
Version 3.0.0
====================================================================================================================
Get-ADLdif.ps1 parameters:

-domainControllerName       Specifies the domain controller that performs the import or 
                            export operation. By default, ldifde.exe runs on the domain controller 
                            on which ldifde.exe is installed.
                            This is a mandatory parameter.

-domainServerPort           Specifies a Lightweight Directory Access Protocol (LDAP) port number. 
                            The default LDAP port number is 636 (secure LDAP). If your domain controller uses
                            default LDAP specifies port 389. 
                            The global catalogue port number is 3268.
                            This is an optional parameter.

-domainAccountUsername      Sets the command to run using the distinguished name (<UserDistinguishedName>).  
                            By default, the command uses the credentials of the user who is currently logged 
                            on to the system.
                            This is an optional parameter. In not provided use current user.

-domainAccountPassword      and password (<Password>) that you supply. By default, the command uses the 
                            credentials of the user who is currently logged on to the system.
                            This is an optional parameter.

-domainAccountServer        Sets the command to run using the supplied <UserName> <Domain> <Password>. 
                            By default, the command will run using the credentials of the user currently 
                            logged on to the network.
                            This is an optional parameter.

-file                       Identifies the export file name. 
                            This is an optional parameter. If not provided default file path is '.\ADUsers.ldif'

-uploadUsername             User name for Access Analytics Upload portal for automatic upload.
                            This is an optional parameter. If not provided, the script will not upload file to Gathid data portal.

-uploadPassword             Password for Access Analytics Upload portal for automatic upload.
                            This is an optional parameter.

-CreatePasswordFile         Create encrypted upload password file.
                            This is an optional parameter.

-passwordFile               Encrypted file containing upload password.
                            This is an optional parameter.

-auxAttibutesList           List of Active Directory attributes to add to the list besides default attributes.
                            Comma-separated list, without spaces between
                            A list of default attributes is given at the end of the readme.txt file.
                            This is an optional parameter.


REQUIREMENT:
Utility ldifde.exe must be in the path. The Microsoft Utility is part of Windows server role AD DLS. See: https://learn.microsoft.com/en-us/previous-versions/windows/desktop/adam/what-is-active-directory-lightweight-directory-services

=====================================================================================================================
Usage Option 1: 
===============
Export LDIF and Upload using username and password

.\Get-ADLdif.ps1  -domainControllerName <domain_controller> -uploadUsername <upload_user_name> -uploadPassword <upload_password>

Usage Option 2: 
===============
Export LDIF and Upload using username and password stored in encrypted filename

Create password file (only first time):
.\Get-ADLdif.ps1 -CreatePasswordFile -passwordFile <upload_password_filename>

Extract and Upload
.\Get-ADLdif.ps1  -domainControllerName <domain_controller> -uploadUsername <upload_user_name> -passwordFile <upload_password_filename>

Usage Option 3: 
===============
Export only LDIF 

.\Get-ADLdif.ps1  -domainControllerName <domain_controller>

Usage Option 4: 
===============
Export only LDIF, ommiting attributes minPwdAge and maxPwdAge

.\Get-ADLdif.ps1  -domainControllerName <domain_controller> -auxAttibutesList 'manager,codepage'

=====================================================================================================================
List of default attributes in export:
accountExpires,badPasswordTime,badPwdCount,c,cn,co,company,countryCode,department,description,directReports,displayName,distinguishedName,
dn,employeeID,givenName,groupType,l,lastLogon,lastLogonTimestamp,lockoutTime,logonCount,mail,manager,memberOf,name,objectCategory,objectClass,
objectGUID,objectSid,primaryGroupID,pwdLastSet,sAMAccountName,sAMAccountType,sn,st,status,telephoneNumber,title,userAccountControl,
userAccountControlFlags,userPrincipalName,whenChanged,whenCreated,wWWHomePage
