We use cookies to make your experience better. To comply with the new e-Privacy directive, we need to ask for your consent to set the cookies. Learn more.
Exploring the Aviosys IP Power 9850 CGI interface using Powershell
The IP Power 9850 is a networked power switch manufactured by Aviosys. The IP Power 9850 is able to control up to four UK 3 pin sockets or EU type sockets. The unit sports a web based interface giving fine control over the power sockets or you can automate the process using the CGI based interface with your own scripts or automation software.
Powershell is a portable scripting language created by Microsoft that runs on Microsoft Windows and various other operating systems like macOS and Linux. Powershell is particularly useful when trying to automate repetitive tasks like re-starting a router when connectivity to the internet is lost.
For the purposes of this article I will be using a IP Power 9850UK as well as Powershell version 5.1 installed on Windows 10.
Getting the firmware version
You can read the firmware version number from your IP Power 9850 with the following Powershell command:
Invoke-WebRequest is quite a useful Powershell cmdlet because it is able to make HTTP requests to web services and return to you the result.
Firmware version data
Property | Description | Example Data |
---|---|---|
StatusCode | HTTP status code. | 200 |
StatusDescription | Description of the StatusCode | OK |
Content | Contents of the version request returned back from the power switch. |
Version=v1.04_335 |
RawContent | Raw content of the returned back from the power switch. |
HTTP/1.1 200 OK Pragma: no-cache Content-Length: 65 Content-Type: text/plain Date: Fri, 28 Sep 2018 21:03:18 GMT Server: lighttpd/1.4.48 Version=v1.04_335 <!--CGI-D... |
Headers | Raw header information. |
{[Pragma, no-cache], [Content-Length, 65], [Content-Type, text/plain], [Date, Fri, 28 Sep 2018 21:03:18 GMT]...} |
Reading the current socket state
You can read the current state of the power sockets from your IP Power 9850 with the following Powershell command:
Power socket data
Property | Description | Example Data |
---|---|---|
StatusCode | HTTP status code. | 200 |
StatusDescription | Description of the StatusCode | OK |
Content | Contents of the version request returned back from the power switch. |
p61=0, p62=0, p63=0, p64=0 |
RawContent | Raw content of the returned back from the power switch. |
HTTP/1.1 200 OK Pragma: no-cache Content-Length: 74 Content-Type: text/plain Date: Fri, 28 Sep 2018 23:04:12 GMT Server: lighttpd/1.4.48 p61=0, p62=0, p63=0, p64=0 Version=v1.04_335 <!--CGI-D... |
Headers | Raw header information. |
{[Pragma, no-cache], [Content-Length, 74], [Content-Type, text/plain], [Date, Fri, 28 Sep 2018 23:04:12 GMT]...} |
Powering a socket
You can switch on one of the power sockets using the following command:
The power sockets are represented by the number 61 through to 64. Setting the socket to 0 switches it off and setting the socket to 1 switches it on. You don't need to include all of the sockets if you are not changing their state. Just include the sockets you wish to change or you can include all of them, just make sure to set the socket into the correct state.
Power socket data
Property | Description | Example Data |
---|---|---|
StatusCode | HTTP status code. | 200 |
StatusDescription | Description of the StatusCode | OK |
Content | Contents of the version request returned back from the power switch. |
p61=1,p62=0,p63=0,p64=0 |
RawContent | Raw content of the returned back from the power switch. |
HTTP/1.1 200 OK Pragma: no-cache Content-Length: 71 Content-Type: text/plain Date: Mon, 01 Oct 2018 20:52:29 GMT Server: lighttpd/1.4.48 p61=1,p62=0,p63=0,p64=0 <!-... Version=v1.04_335 <!--CGI-D... |
Headers | Raw header information. |
{[Pragma, no-cache], [Content-Length, 65], [Content-Type, text/plain], [Date, Fri, 28 Sep 2018 21:03:18 GMT]...} |