...
Download the script
onto your domain controllerView file name ADscript_version-R-12.ps1 Open the file in an editor like VS Studio, and define what Organizational Units Zilla Will Pull Accounts from. You will do this by editing the below variable:
$DNs = @("DC=yourdomain,DC=com")
- this variable is used to define what Organizational Units Zilla Will Pull Accounts from. For example, if my OU is zillasecurity.com, then this line would look like this:$DNs = @("DC=zillasecurity,DC=com")
. You can add multiple OUs by comma separating each OU’s domain name. For example, if I had 2 OUs zillasecurity.com and zsec.io, this parameter would look like this:$DNs = @("DC=zsec,DC=io"), @("DC=zillasecurity,DC=com)
There are several parameters affiliated with pushing the generated export to an sFTP server:
$isSftpEnabled = $false
- this determines whether the CSV gets sent to an sFTP server. By default, this is turned off, and you will need to set this to$true
to automate Active Directory.$sftpHost = "sftp.zillasecurity.com"
- this is the hostname of the sFTP server we are sending the CSV to. If you are sending it to an sFTP server hosted by Zilla, then the default value (sftp.zillasecurity.com) can be left. If you are hosting this on your own sFTP server, then change the value to the hostname on your server.$sftpUsername = "<your domain.com>"
- this is the username of the service account that will need to be created on your sFTP server. If you are using Zilla, the value for this will be the domain that is affiliated with your tenant. You can view this inside of Zilla by logging in as an admin, going to the settings on the left hand side panel, and looking at the first domain inside of your internal domains$applicationId = "<application-id>"
- the application ID can be found by navigating to your active directory application inside of Zilla:and copying the string that appears inside of the URL:
$sftpPrivateKeyPath = "<location of your private key>"
- this is the full filepath and filename where you have stored your SSH Private Key. For example if you stored the private key called private-key.pem in the filepath /Users/mpalella/Desktop, then the value for this parameter will be/Users/mpalella/Desktop/private-key.pem
$Csvfile = "$path\directory.csv"
- you can use this setting to change the name of the CSV file that is generated. You can leave this as is
Once the script is configured, use task scheduler to automate the running of the above script using the service account you’ve created in the Creating a Service Account step. This guide goes through how to accomplish this.
...