GeoJSON and PowerShell

I’m working a lot with GeoServer at the minute and needed to get a start and end date for data available in a layer, I don’t have direct access to the backend so thought I’d have a go at using PowerShell to get what I need. PowerShell 3.0 onward has ConvertFrom-Json and Invoke-WebRequest so it turned out to be rather simple;

$array = @()
$json = Invoke-WebRequest -Uri "" | ConvertFrom-Json
$json.features | ForEach-Object { $array += $ }
$array = $array | Sort-Object
Write-Host "Start: " + $array[0] + ", End: " + $array[$array.Length - 1]

This code creates an empty array, invokes a webrequest to get the JSON from the specified layer, pushes the time property from each feature into the empty array then sorts it. Outputting the first and last element in the array gives start and end.

No doubt there is a max/min function I could have used that I’m not aware of so feel free to mention it in the comments if so. It all turned out to be surprisingly easy and I should be writing a similar block of code in JavaScript soon so will post it as comparison.

Connecting to Office365 Using PowerShell

My first post on the topic of Office365 regards a simple task, connecting to the Office365 portal using PowerShell.  First of all the assumptions;  You have an Office365 account and you have PowerShell installed.

Follow the instructions at the this page and install both the single sign-on add in and the PowerShell command-lets.  After that you can connect to your account by importing the MSOnline module or opening PowerShell with the module imported already from the start menu then following these steps;

Import-Module MSOnline

This will give you access to script against your account rather than the services specifically, you will be able to query and create accounts that are service wide.  For Exchange specific commands there is a different method required, the details of which can be found at the following page;

Install and Configure PowerShell
Connect to Office365 Exchange Services