Archive for the ‘Scripting’ Category

Programming Test 2: Count backwards from 100 to 1

Saturday, April 11th, 2015

Starting your script with:

for (var i=0 …

Complete the code so that it prints out the numbers 100 to 1.

You have 10 minutes.


Programming Test 1: Fizz Buzz

Saturday, April 11th, 2015

Hopefully I’ve not misinterpreted the challenge here. Count to 100, if the number is divisible by three, output Fizz, if divisible by five, output Buzz.

If its Divisible by 5 and 3, FizzBuzz!


Powershell Script to Email a Disk Usage Report

Sunday, January 19th, 2014

I use a couple of different technologies to store large quantites of data on my “server” at home, namely Storage Pools combined with Data Deduplication on Windows Server 2012 R2. Up to a couple of weeks ago it was working great but I’ve started to notice oddities which couldn’t really be explained…

So I decided to script up a quick report and then schedule it to email me. This is how I did it.


Setting up Powershell Remoting (Server 2012 R2)….

Monday, December 9th, 2013

powershell_icon_thumb2….bit of an experiment this one. I wanted to set up a Windows Server 2012 R2 instance, not hooked up to Active Directory (so just in a workgroup), with a self signed certificate (mainly because I couldn’t be bothered to setup a full certificate chain).


netsh – Amending a Default Gateway on NICs via scripts.

Wednesday, October 31st, 2012

Quick one today.

Wanted to change a servers default gateway in a CMD file. Easiest way to do it is to use NETSH. Its a very powerful tool (All Windows versions after XP) that has many uses from configuring the Windows Firewall to resetting branchcache.

In this instance I wanted to do a simple default Gateway change , so here’s the barebones of it:


FQDN of a Windows Server in Batch / CMD scripting….

Monday, April 30th, 2012

Quick one for you (and there’s probably easier ways of doing this)…only took ten minutes to work it out tho.

I needed to get the Fully Qualified Domain Name of a computer on the network into an environment variable in a batch script.

Here’s the code snippet:


FOR /f "tokens=2,* delims= " %%a in ('IPCONFIG ^/ALL ^| FINDSTR "Primary Dns"') do set tempsuffix=%%b
FOR /f "tokens=1,2 delims=:" %%a in ('echo %tempsuffix%') do set dnssuffix=%%b