Example Active Directory Single Site script
Sample script that scans the Active Directory (AD) environment for all sites and subnets and stores the information in the Content Distribution locations table. This information can then be retrieved by Nomad at a later stage when implementing the Single Site Download (SSD) or Single Site PBA features.You can view Nomad Sites in the Nomad Sites page.
The Nomad Sites page is primarily designed to show how the network is being used for content distribution in different locations. It focuses on the volume of content downloaded from peers vs over the WAN, rather than the status of specific Content Titles in a given site. You can see what content is available in a given site by looking at the Content tab for that site.
A Nomad Site corresponds to Nomad Single Site Download (SSD) site. Customers that have implemented SSD and upgrade ActiveEfficiency to the Nomad app and Content Distribution will see their defined SSD locations displayed as Nomad Sites in the app.
Any subnets that are not included in a Nomad SSD Site definition will be represented in a site named Unknown. If no SSD sites have been defined, all subnets will be included in the 'Unknown' site
Prerequisites
The PostADSitesandSubnets.ps1 script is available from the Scripts folder in the Content Distribution Tools download zip from https://support.1e.com/.
The script requires:
-
Content Distribution version 8.0 or above.
-
Use PowerShell version 5.0 or above.
-
Run the script on a device joined to the AD domain where the required information resides and have permissions to read device attributes from AD.
Support for Authentication Proxy is deprecated from 1E 24.7 and later. However, you can still use these scripts to generate interactive and non-Interactive tokens:
PostADSitesandSubnets.ps1
ExampleSitesAndSubnets.ps1
- If
-Interactive switch
is specified: The interactive authentication token generation mechanism prompts the user for credentials for their Idp type after entering the PlatformUrl. Once authenticated, the default token is valid for 1 hour, and will not prompt to re-enter their credentials. The script refreshes the existing token for its validity.
- If
-Interactive
switch is not specified: The non-interactive authentication token generation mechanism starts where the user needs to enter details like PlatformUrl, AppId, Principal, and CertThumbprint. Once authenticated, the default token is valid for 1 hour. After the token expires, the script refreshes the existing token for its validity.
Using the example PostADSitesandSubnets script
The sample script:
-
Clears all current sites and subnet information stored in the ContentDistribution database
-
Connects to LDAP://RootDSE and enumerates the subnets for each Site and adds them to the ContentDistribution database.
The example script does not support supernets.
-
You can modify the script to include filters and logic to ignore or add specific Sites or subnets.
-
If you prefer to maintain your own list of Sites and subnets then you should consider using Example Single Site script, or Example Location Discovery Script, instead. These are both available from the Scripts folder in the NomadBranch download zip.
Parameters
The script uses the following parameters:
-
PlatformUrl as a mandatory parameter - you must provide the platform base URL.
-
Tls12 as an optional switch parameter - include this switch if TLS 1.2 is required to connect to the platform.
Refer to Authentication proxy for details about using the Interactive switch.
For example, to run the script on a PowerShell command-line:
.\PostADSitesandSubnets.ps1 -PlatformUrl https://tachyon.1etrn.local:443 -Tls12
How it works
The script clears all current sites and subnet information stored in the ContentDistribution database, it then scans the Active Directory for stored sites and subnets and stores these in ContentDistribution. The AD environment scanned, is for the domain containing the device where you run the script.
In our example, we have two distinct locations (a datacenter and a remote office), with the servers all located in the datacenter and the workstations all located in the remote office. It just so happens that the remote office has two subnets. Active Directory Sites have already been defined to reflect this configuration.
Before running PostADSitesandSubnets.ps1 we only have an unknown Nomad site as you can see in the accompanying picture showing the Nomad Sites page.
The Nomad Sites page is primarily designed to show how the network is being used for content distribution in different locations. It focuses on the volume of content downloaded from peers vs over the WAN, rather than the status of specific Content Titles in a given site. You can see what content is available in a given site by looking at the Content tab for that site.
A Nomad Site corresponds to Nomad Single Site Download (SSD) site. Customers that have implemented SSD and upgrade ActiveEfficiency to the Nomad app and Content Distribution will see their defined SSD locations displayed as Nomad Sites in the app.
Any subnets that are not included in a Nomad SSD Site definition will be represented in a site named Unknown. If no SSD sites have been defined, all subnets will be included in the 'Unknown' site.
In our example we downloaded the script to C:\Temp\nomadbranch.v8.0.4.265\scripts folder, we right-click on PostADSitesandSubnets.ps1 and select Edit to open the file in Windows PowerShell ISE.
We enter https://tachyon.1etrn.local/
as the platform url for our environment and hit return.
Once the script completes we can return to the Nomad app and refresh the page, now we can see our environment's sites and subnets defined on the Nomad Sites page.