Contents
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
- The Script clears all current sites and subnet information stored in the ActiveEfficiency database.
- 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"