>>>>> "Derek" == Derek Murawsky <dmuraw...@gmail.com> writes:

Derek> @Adam, Just busting chops. I like to joke about everything,
Derek> including stereotypical sysadmins (on the windows or nix
Derek> sides). Keeps things light. :)

Derek> Below is a set of scripts, in a PS Module, that I wrote to help
Derek> maintain offshore development accounts in Active Directory. I
Derek> have a CSV template which the offshore team managers fill out
Derek> and send me with their changes. There are many additional
Derek> features/comments that I need to add, but this has already
Derek> saved me a lot of time. I'll probably be open sourcing this in
Derek> the long run, just so others can use it more readily and
Derek> contribute back. 

Derek> import-module activedirectory

Derek> function new-emailaddress{
Derek> [cmdletbinding(SupportsShouldProcess=$True)]
Derek> param (
Derek> [parameter(Mandatory=$true)]
Derek> [string] $FirstName,
Derek> [parameter(Mandatory=$true)]
Derek> [string] $LastName,
Derek> [parameter(Mandatory=$true)]
Derek> [string] $Company
Derek> )
Derek> switch ($Company.ToLower()) {
Derek> infobeans {$retval = $FirstName + "." + $LastName + "@infobeans.com"}
Derek> annet {$retval = $FirstName + "." + $LastName + "@annet.com"}
Derek> mindtree {$retval = $FirstName + "_" + $LastName + "@mindtree.com"}
Derek> default {$retval = $FirstName + "." + $LastName + "@example.com"}
Derek> }
Derek> return $retval
Derek> }

Ok, so is it me, or just bad cut'n'paste?  Do PowerShell scripts ever
use any indentation?  It's a struggle to read this!

_______________________________________________
Tech mailing list
Tech@lists.lopsa.org
https://lists.lopsa.org/cgi-bin/mailman/listinfo/tech
This list provided by the League of Professional System Administrators
 http://lopsa.org/

Reply via email to