NAME

remove-nullSplatted

SYNOPSIS

Removes any entries with null values from a hashtable.

SYNTAX

remove-nullSplatted [-a] <Hashtable> [<CommonParameters>]

DESCRIPTION

Removes any entries with null values from a hashtable. Useful when
splatting arguments to a command to remove unnecessary empty or
unspecified argument values.

PARAMETERS

-a <Hashtable>
the table of values to cull

Required? true
Position? 1
Default value
Accept pipeline input? true (ByValue)
Accept wildcard characters?


<CommonParameters>
This cmdlet supports the common parameters: Verbose, Debug,
ErrorAction, ErrorVariable, WarningAction, WarningVariable,
OutBuffer and OutVariable. For more information, type,
"get-help about_commonparameters".

INPUTS

System.Collections.Hashtable. The splatted argument hashtable.

OUTPUTS

System.Collections.Hashtable. The splatted argument hashtable with
unspecified arguments removed.

NOTES



This cmdlet is used internally by commands that proxy arguments to other commands.

EXAMPLES

EXAMPLE 1

C:\PS>@{ a=1, b=$null} | remove-nullSplatted   
    
    Name    Value
    ----    -----
    a        1


EXAMPLE 2

C:\PS>$a = @{       
    Category = $category;
            Priority = $priority;
            Icon = $icon;
            Checkable = $checkable;
            File = $file;
            Line = $line;
            ReadOnly = $readOnly;
            NoFlush = $noFlush;
        } | remove-nullSplatted;
C:\PS> new-item dte:tasks -value $inputObject @a | out-null;

This example uses splatting to proxy local variables to the new-item cmdlet. The remove-nullSplatted cmdlet ensures that no unspecified options are passed to
the new-item cmdlet.

Last edited Dec 30, 2011 at 3:46 AM by beefarino, version 1

Comments

No comments yet.