I'm going to write that using PowerShell, since you used bash scripting for yours (y)