scripts

Split-Keys.ps1

SYNOPSIS

Clones a dictionary keeping only the specified keys.

SYNTAX

Split-Keys.ps1 [[-Keys] <String[]>] -Dictionary <IDictionary> [-SkipNullValues]
 [-ProgressAction <ActionPreference>] [<CommonParameters>]

DESCRIPTION

EXAMPLES

EXAMPLE 1

@{ A = 1; B = 2; C = 3 } |Split-Keys.ps1 B C D

Name Value —- —– B 2 C 3

EXAMPLE 2

$PSBoundParameters |Split-Keys.ps1 From To Cc Bcc Subject -SkipNullValues |Send-MailMessage

Sends an email using selected params declared by the calling script with values.

PARAMETERS

-Keys

List of keys to include in the new dictionary.

Type: String[]
Parameter Sets: (All)
Aliases:

Required: False
Position: 1
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

-Dictionary

The source dictionary to copy key-value pairs from.

Type: IDictionary
Parameter Sets: (All)
Aliases: Hashtable

Required: True
Position: Named
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: False

-SkipNullValues

When present, indicates that key-value pairs with a null value should not be included.

Type: SwitchParameter
Parameter Sets: (All)
Aliases: NoNulls

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False

-ProgressAction

Type: ActionPreference
Parameter Sets: (All)
Aliases: proga

Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: False

CommonParameters

This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.

INPUTS

System.Collections.IDictionary, the source dictionary to select key-value pairs from by key.

OUTPUTS

System.Collections.Specialized.OrderedDictionary, the dictionary matching key-value pairs are copied to.

NOTES

Only string keys are supported.

https://msdn.microsoft.com/library/System.Collections.IDictionary.aspx