Skip to content

ConvertFrom DscResourceInstance

dscbot edited this page Feb 13, 2024 · 2 revisions

ConvertFrom-DscResourceInstance

SYNOPSIS

Convert any object to hashtable.

SYNTAX

ConvertFrom-DscResourceInstance [-InputObject] <PSObject> [[-OutputFormat] <String>]
 [<CommonParameters>]

DESCRIPTION

This function is used to convert a PSObject into a hashtable.

EXAMPLES

EXAMPLE 1

$object = [PSCustomObject] = @{
    FirstName = 'John'
    LastName = 'Smith'
}
ConvertFrom-DscResourceInstance -InputObject $object

This creates a PSCustomObject and converts its properties and values to key/value pairs in a hashtable.

EXAMPLE 2

$objectArray = [PSCustomObject] = @{
    FirstName = 'John'
    LastName = 'Smith'
}, [PSCustomObject] = @{
    FirstName = 'Peter'
    LastName = 'Smith'
}
$objectArray | ConvertFrom-DscResourceInstance

This creates an array of PSCustomObject and converts their properties and values to key/value pairs in a hashtable.

PARAMETERS

-InputObject

The object that should be convert to hashtable.

Type: PSObject
Parameter Sets: (All)
Aliases:

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

-OutputFormat

Set the format you do want to convert the object. The default value is HashTable. It's the only value accepted at this time.

Type: String
Parameter Sets: (All)
Aliases:

Required: False
Position: 2
Default value: HashTable
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

OUTPUTS

System.Collections.Hashtable

NOTES

RELATED LINKS

Clone this wiki locally