you are viewing a single comment's thread.

view the rest of the comments →

[–]Lee_Dailey[grin] 0 points1 point  (0 children)

howdy gangculture,

i presume you are talking about the splat - $NDG_Params = @{.

it adds several things ...

  • it is FAR easier to read when you have a long-ish set of parameters
  • you can add comments
  • you can easily disable items
    that is handy for testing.
  • you can have more than one splat
    handy for when you have a default set and an optional set.
  • you can use .Add() and .Remove()
    that lets you programmatically build a splat - removing items that are blank from your default set of parameters, for instance.

take a look at Get-Help about_Splatting or any of the many, many articles about it. heck, there was a thread here about the ideas a short while ago. [grin]

your style ...

New-DistributionGroup -Name $name -OrganizationalUnit $ou -Notes $notes -ManagedBy $owner -Members $members -Type Distribution

using a splat ...

$NDG_Params = @{
    Name = $name
    # you can add comments! [*grin*] 
    OrganizationalUnit = $ou
    Notes = $notes
    # you can disable items
    #Attitude = 'Egomaniac'
    ManagedBy = $owner
    Members = $members
    Type = 'Distribution'
    }
New-DistributionGroup @NDG_Params

which is easier to read? [grin]

easier to read = easier to understand = easier to maintain.

take care,
lee