| external help file | PSScriptTools-help.xml |
|---|---|
| Module Name | PSScriptTools |
| online version | http://bit.ly/31SLU7X |
| schema | 2.0.0 |
Convert a hashtable to a string representation.
Convert-HashTableToCode [-Hashtable] <Hashtable> [-Indent <Int32>] [<CommonParameters>]Convert-HashTableToCode [-Hashtable] <Hashtable> [-Inline] [<CommonParameters>]Use this command to convert a hashtable into its text or string equivalent.
PS C:\> $h = @{Name="SRV1";Asset=123454;Location="Omaha"}
PS C:\> convert-hashtabletocode $h
@{
Name = 'SRV1'
Asset = 123454
Location = 'Omaha'
}Convert a hashtable object to a string equivalent that you can copy into your script.
PS C:\> convert-hashtabletocode $h -inline
@{Name = 'SRV1';Asset = 123454;Location = 'Omaha'}Create an inline string version of the hashtable.
A hashtable to convert. In can be standard or ordered hashtable.
Type: Hashtable
Parameter Sets: (All)
Aliases:
Required: True
Position: 0
Default value: None
Accept pipeline input: True (ByValue)
Accept wildcard characters: FalseSpecify the number of tabs to indent. You shouldn't need this parameter. It exists for situations where there are nested hashtables.
Type: Int32
Parameter Sets: psd1
Aliases: tab
Required: False
Position: Named
Default value: 1
Accept pipeline input: False
Accept wildcard characters: FalseWrite the hashtable as an inline expression.
Type: SwitchParameter
Parameter Sets: inline
Aliases:
Required: False
Position: Named
Default value: None
Accept pipeline input: False
Accept wildcard characters: FalseThis cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable. For more information, see about_CommonParameters.
Learn more about PowerShell: http://jdhitsolutions.com/blog/essential-powershell-resources/