This sample script shows how to add information about selected sites and subnets in ActiveEfficiency. This information can then be retrieved by Nomad 2012 at a later stage when implementing the Single-Site Download and 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
On this page:

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 or you are running the script remotely, then the script must be modified by changing the $url variable to the correct URL.

The example script

The sample script provides the following two functions:-

function DeleteAllLocations()
Description: Deletes all rows from the Active Efficiency locations table
Params: none
Return: $result(empty)

function AddLocation()
Description: Adds a new entry into the Active Efficiency locations table
Params: site  - [string] containing the site name
             subnet - [string] containing the ipv4subnet in CIDR notation
Return: $result - newly created location object of the form #     {"Id":"efa19226-266f-4bd0-8a9d-94fa5ac1b773","Site":"HOMER.SIMPSON.Springfield","Subnet":"192.148.226.0/24"}

The following download link provides the Custom sample script: ExampleSitesAndSubnets.ps1

Running the script

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

.\ExampleSitesandSubnets.ps1.

How it works

  1. The Script clears all current sites and subnet information stored in the ActiveEfficiency database.
  2. The Script then adds the following 3 sites and subnets in the ActiveEfficiency database.
    "HOMER.SIMPSON.Springfield" "192.148.226.0/24"
    "HOMER.SIMPSON.Springfield" "192.148.228.0/24"
    "MARGE.SIMPSON.Springfield" "192.168.227.0/24"