PowerShell — Automated GigaFiber Availability Check

A few months back I was informed Gigafiber was coming to my neighborhood. I was, of course, very happy to hear this and wanted to know as soon as it became available. So, I wrote a short script to check for availability and notify me via Telegram when it became available. Now, on the off chance someone out there is looking for something similar, I’m posting it here.

In order to keep this short, I assume you have at least a very basic knowledge of PowerShell. You should still be able to follow along if you do not, but it may require a little googling on the side.

To start, the script.

PowerShell Script

Take the above and copy/paste it into a text editor (or ISE).

In order to ensure your address matches what ATT has, I’d first visit the availability lookup page (here) to see how it formats your street address.

Next fill out the variables zip, street address, and (if you have one), unit number.

After doing so, execute the script. If you’re using ISE you can just hit F5, if you’re using a text editor save the file with the extension .ps1, then open PowerShell and type $result = pathtoscript.ps1 and hit enter.

If it took a while to execute and you got this output, “Bad response returned 15 times, stopping.”, your address information likely didn’t match something ATT was able to look up. I suggest visiting the availability lookup page to see how ATT formats your street address.

In the same PowerShell window you already have open, type $response.CkavDataBean.UnifiedAddressBean.UserQualifiedHomeAddress. This is ATT's version of your address. If it has what looks to be your address, you should be good to proceed. If it does not, revisit the previous steps.

Now that we know your address variables are set correctly go ahead and enter your Telegram variables.
Note: You can see my guide on setting up a Telegram bot (here).

If you’d like to test and ensure Telegram is working correctly, change line 30 to if ($true). This will cause that block to always execute. Make sure to change it back when you're done.

Finally, you’ll want to set this up to run at a set interval. If you’re on Windows you can use Task Scheduler.

Use Local Service for the run as user.

For the trigger I would recommend setting it up to run at startup, every 15 minutes, indefinitely.

For the action, Start a program, powershell.exe, for arguments

-ExecutionPolicy Bypass -NoProfile -File "pathtoscript.ps1".

Then save the task and manually execute it, it should continue to run every X minutes until you shut down. Once you boot back up it should automatically start running again.

Originally published at blog.taylorsmith.xyz on April 30, 2018.