I was getting rather fed up with using National Rails IOS App to get the latest train times as it kept crashing on me so i wrote a small PowerShell function that will do the work for me ūüôā

This uses the 3 character code for Manchester Piccadilly and Macclesfield and then creates a new instance of Internet explorer with the results – I did look to make use of Invoke-WebRequest but felt that this was the “quicker and dirtier” solution

function Get-NextTrain {

¬†¬†¬†¬†$from = “MAN”

¬†¬†¬†¬†$to = “MAC”

    $date = Get-date -Format ddMMyy

    $time = Get-date -Format HHmm

¬†¬†¬†¬†$url = “$from/$to/$date/$time/dep/”

   start iexplore $url


I am currently trying to create another that will accept a Full Station name input and then switch it to the short 3 character code for each Station name. Hopefully by the end of the week ūüôā


I’ve been really looking at enhancing some of my own personal security models as of late and for accounts that i have¬†for internal only¬†but¬†typically can only be accessed with a web interface so I couldn’t make use of exported credential Passwords as I would prefer to.

So to get round this issue I built this nice little function, which takes a String input from you and a type definition Integer to determine whether you are passing the plaintext version and wanting the Hashed version of the Password returning or whether you want to get the plaintext version of a previously hashed password.

function Get-Password


   param (

¬†¬†¬†¬†[Parameter(Mandatory=$true,HelpMessage=“Please Provide Password.”)][String]$Password,

¬†¬†¬†¬†[Parameter(Mandatory=$true,HelpMessage=“1 = hashed 2 = unhashed.”)][INT]$Type


¬†¬†¬†¬†If ($Type -eq “2”)


        $pwd = [System.Text.Encoding]::UTF8.GetBytes($Password)

        $Global:Hpwd = [system.convert]::ToBase64String($pwd)

        Write-Host Your Hashed password is $hpwd




        $global:uhpwd = [System.Text.Encoding]::UTF8.GetString([System.Convert]::FromBase64String($Password))

        Write-Host Your unhashed password is $uhpwd



What this will do is turn your normal phrase into as base64 encoded string – Although this only really adds a small further layer of security it could be used to simplify your password management – think of this as a level of Security by Obscurity

I know that it has simplified mine considerably.

So as an example to this Function you would run it as below specifying that the type is 2 as this will convert the password into a base64 encoded string

Get-Password -Password NaffPassword -Type 2

And it would output the following

Your hashed password is TmFmZlBhc3N3b3Jk

You can then also see that this stores this in a Global Variable which we can see is defined as $Hpwd

So as this is stored in a Variable this can then be fed either to the same function again or can be used within other script areas.

So for example you could then run the function as following using the type as 1 to return the unhashed Password

Get-Password -Password $Hpwd -Type 1

And the result would be

Your unhashed password is NaffPassword

Hopefully you may find this little Function useful or even have some suggestions on how this could be improved further.

The ability to add in the Scripts is thanks to this Brilliant PowerShell ISE Addon CopyToHtml created by Gary LaPointe which you can find at


Conquering Posting to Facebook and Twitter via Powershell


‚ÄčWell this weekend has seen me look at whether it would be quite difficult to post to both Facebook and Twitter via PowerShell.

In short the answer is not really.

I have had very little exposure to Oauth in recent years and luckily for someone like me (little in practical experience but a base understanding of how it works) this has been relatively simple to get my head round

Now before I go into further detail i must give credit to the people that originally posted any adapted scripts – mainly Oauth Keys

So for FaceBook – Credit goes to John Newman and you can find his work at

For Twitter – Credit goes to this Powershell Workflow that was posted by Peter van der Woude on Technet Galleries –

Getting the Facebook one working was a tad more difficult than twitter – however this is due to how FaceBook manages “apps” more than anything else.


So Eventually it came down to having a New-FBFeed and a Send-Tweet function but what about when I wanted to Post the same thing to Both?


So i wrote a simple Function that calls both Send-Tweet and New-FBPost which i will post below



param (







And its as Simple as that.


Published: 08/02/2015 22:37