Skip to content

ConvertFrom-UriQueryString

SYNOPSIS

Parses a URL query string into a hashtable of parameters.

SYNTAX

__AllParameterSets

ConvertFrom-UriQueryString [[-Query] <string>] [<CommonParameters>]

ALIASES

This cmdlet has the following aliases, {{Insert list of aliases}}

DESCRIPTION

Takes a URI query string (the portion after the '?') and converts it into a hashtable where each key is a parameter name and the corresponding value is the parameter value. If the query string contains the same parameter multiple times, the resulting value will be an array of those values. Percent-encoded characters in the input are decoded back to their normal representation.

EXAMPLES

EXAMPLE 1

ConvertFrom-UriQueryString -Query 'name=John%20Doe&age=30&age=40'

Output:

Name                           Value
----                           -----
name                           John Doe
age                            {30, 40}

Parses the given query string and returns a hashtable where keys are parameter names and values are decoded parameter values.

EXAMPLE 2

'?q=PowerShell%20URI' | ConvertFrom-UriQueryString

Output:

Name                           Value
----                           -----
q                              PowerShell URI

Parses a query string that contains a single parameter and returns the corresponding value.

PARAMETERS

-Query

The query string to parse. This can include the leading '?' or just the key-value pairs. For example, both "?foo=bar&count=10" and "foo=bar&count=10" are acceptable.

Type: System.String
DefaultValue: ''
SupportsWildcards: false
Aliases: []
ParameterSets:
- Name: (All)
  Position: 0
  IsRequired: false
  ValueFromPipeline: true
  ValueFromPipelineByPropertyName: false
  ValueFromRemainingArguments: false
DontShow: false
AcceptedValues: []
HelpMessage: ''

CommonParameters

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

INPUTS

System.String

{{ Fill in the Description }}

OUTPUTS

System.Collections.Hashtable

{{ Fill in the Description }}

NOTES