This script scans the Active Directory environment for all sites and subnets and stores the information in ActiveEfficiency. This information can then be retrieved by Nomad 2012 at a later stage when implementing the Single-Site Download or Single-Site PBA features.

This example script does not support supernets.

The script uses the ActiveEfficiency Web API.

Pre-requisites for using the example script:

  • ActiveEfficiency Version 1.2 or above must be installed.
  • Powershell Version 2.0 or above
  • The script needs to be run on a machine joined to the Active Directory domain where the required information resides, and have necessary permissions to be able to read device attributes from an Active Directory server.

Configuring the script to communicate with the ActiveEfficiency Web Service Locations resource:

By default the ActiveEfficiency web service Locations resource is located using the following string: 

http://localhost/ActiveEfficiency/Locations 

and this is set as a default in the script. However, if the ActiveEfficiency Web Service URL has been customized, then the script must be modified by changing the $url variable to the correct URL.

The example script

The following download link provides the Active Directory example script: PostADSitesandSubnets.ps1

Running the script

The Script can be run on the powershell command line as:

.\PostADSitesandSubnets.ps1

How it works

  1. The Script clears all current sites and subnet information stored in the ActiveEfficiency database.
  2. The Script then scans the Active Directory for stored sites and subnets and stores these in ActiveEfficiency.

The Active Directory environment scanned is for the domain containing the machine where the script is run from.