Skip to content

Latest commit

 

History

History
75 lines (49 loc) · 1.43 KB

Convert-CommandtoHashtable.md

File metadata and controls

75 lines (49 loc) · 1.43 KB
external help file Module Name online version schema
PSScriptTools-help.xml
PSScriptTools
2.0.0

Convert-CommandtoHashtable

SYNOPSIS

Convert a PowerShell expression into a hashtable.

SYNTAX

Convert-CommandtoHashtable [-Text] <String> [<CommonParameters>]

DESCRIPTION

This command is intended to convert a long PowerShell expression with named parameters into a splatting alternative.

EXAMPLES

Example 1

PS C:\> Convert-CommandtoHashtable -Text "get-eventlog -listlog -computername a,b,c,d -erroraction stop"

$paramHash = @{
  listlog = $True
   computername = "a","b","c","d"
   erroraction = "stop"
}

Get-EventLog @paramHash

PARAMETERS

-Text

A PowerShell expression, preferably with named parameters.

Type: String
Parameter Sets: (All)
Aliases:

Required: True
Position: 0
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 (http://go.microsoft.com/fwlink/?LinkID=113216).

INPUTS

None

OUTPUTS

[Hashtable]

NOTES

Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/

RELATED LINKS