First: this is about "PowerShell", which is a Windows product and has nothing to do with Unix, therefore: wrong forum.
Second: this is homework, copied from some text book. I suggest you learn for yourself because we have already proved to have learned out part. I assume you are "olly72" from
this thread from Microsofts Technet site, yes?
Thread closed, infractions follow.
bakunin